예제 #1
0
 def project(self, data):
     driver = self.base_driver
     #休眠等待
     # driver.sleep(1)
     #点击项目
     log = Log('logs')
     log.info('点击项目')
     driver.click(self.PROJ_XMU)
     driver.sleep(1)
     #点击添加区块
     log.info('点击添加区块')
     driver.switch_to_frame(self.PROJ_FRAME)
     driver.click(self.PROJ_QUKUAI)
     driver.sleep(1)
     driver.select_by_visible_text(self.PROJ_QUK, data['blocks'])
     driver.sleep(1)
     #编辑项目类型
     if data['blocks'] == '任务列表':
         # 输入任务区块名称
         log.info('输入任务区块名称')
         driver.click(self.PROJ_TITLE)
         driver.type1(self.PROJ_TITLE, data['title'])
         #编辑外观
         log.info('编辑外观')
         driver.select_by_visible_text(self.PROJ_KUANGD, data['grid'])
         driver.get_attribute(self.PROJ_YANSE, data['data-id'])
         #编辑类型
         log.info('编辑类型')
         driver.click(self.PROJ_LEIXING)
         driver.type1(self.PROJ_LEIX, '由我创建')
         #编辑数量
         log.info('编辑数量')
         driver.click(self.PROJ_NUM)
         driver.type(self.PROJ_NUM, data['num'])
         #编辑排序
         log.info('编辑排序')
         driver.click(self.PROJ_ORDERBY)
         driver.type1(self.PROJ_ORDERBY, '优先级递增')
         #编辑任务状态
         log.info('编辑任务状态')
         driver.click(self.PROJ_DSTATUS)
         driver.type1(self.PROJ_DSTATUS, '已关闭')
         #点击保存
         log.info('点击保存')
         driver.click(self.PROJ_BUTTON)
     if data['blocks'] == '项目列表':
         driver.type1(self.PROJ_TITLE, data['title'])
         # 编辑外观
         log.info('编辑外观')
         driver.select_by_visible_text(self.PROJ_KUANGD, data['grid'])
         driver.get_attribute(self.PROJ_YANSE, data['data-id'])
         # 编辑状态
         log.info('编辑状态')
         driver.click(self.PROJ_STATUS)
         driver.type1(self.PROJ_JINXZ, '我参与的')
         # 编辑数量
         log.info('编辑数量')
         driver.click(self.PROJ_NUM)
         driver.type(self.PROJ_NUM, data['num'])
         # 编辑排序
         log.info('编辑排序')
         driver.click(self.PROJ_ORDERBY)
         driver.type1(self.PROJ_ORDERBY, '优先级递增')
         # 点击保存
         log.info('点击保存')
         driver.click(self.PROJ_BUTTON)
     log.info('跳出最外层框架')
     driver.switch_default_frame()
예제 #2
0
def index():
    Log.debug('Mensagem de DEBUG', app)
    Log.info('Mensagem de INFO', app)
    controller = IndexController(app)
    return controller.index()
예제 #3
0
 def docs(self,data):
     driver = self.base_driver
     # 休眠等待
     driver.sleep(1)
     log = Log('..\\logs')
     # 点击文档
     log.info('点击文档')
     driver.click(self.DOCS_WEND)
     driver.sleep(1)
     # 点击创建文档库
     log.info('点击创建文档库')
     driver.switch_to_frame(self.DOCS_FRAME)
     driver.sleep(1)
     driver.click(self.DOCS_JIAN)
     # 编辑文档库类型
     log.info('编辑文档库类型')
     driver.select_by_visible_text(self.DOCS_KULX, data['libtype'])
     driver.sleep(1)
     if data['libtype'] == '自定义文档库':
         # 编辑文档库名称
         log.info('编辑文档库名称')
         driver.click(self.DOCS_MZI)
         driver.type1(self.DOCS_MZI,data['name'])
         driver.sleep(1)
         # 编辑文档库授权用户
         log.info('编辑文档库授权用户')
         driver.click(self.DOCS_SHOUQ)
         driver.type1(self.DOCS_SHOUQ,data['username'])
         # 编辑文档库授权分组
         log.info('编辑文档库授权分组')
         if data['group'] == '管理员':
             driver.click(self.DOCS_GROUP1)
         if data['group'] == '财务专员':
             driver.click(self.DOCS_GROUP2)
         if data['group'] == '销售经理':
             driver.click(self.DOCS_GROUP3)
         if data['group'] == '销售人员':
             driver.click(self.DOCS_GROUP4)
         if data['group'] == '普通用户':
             driver.click(self.DOCS_GROUP5)
         #点击保存
         log.info('点击保存')
         driver.click(self.DOCS_BUTTON)
         driver.sleep(2)
     if data['libtype'] == '项目文档库':
         #编辑所属项目
         log.info('编辑所属项目')
         driver.click(self.DOCS_XMSS)
         driver.type1(self.DOCS_INPUT,'太阳当空照,花儿对我笑')
         # 编辑文档库名称
         log.info('编辑文档库名称')
         driver.click(self.DOCS_MZI)
         driver.type1(self.DOCS_MZI,data['name'])
         # 编辑文档库授权用户
         log.info('编辑文档库授权用户')
         driver.click(self.DOCS_SHOUQ)
         driver.type1(self.DOCS_SHOUQ,data['username'])
         # 编辑文档库授权分组
         log.info('编辑文档库授权分组')
         if data['group'] == '管理员':
             driver.click(self.DOCS_GROUP1)
         if data['group'] == '财务专员':
             driver.click(self.DOCS_GROUP2)
         if data['group'] == '销售经理':
             driver.click(self.DOCS_GROUP3)
         if data['group'] == '销售人员':
             driver.click(self.DOCS_GROUP4)
         if data['group'] == '普通用户':
             driver.click(self.DOCS_GROUP5)
         #点击保存
         log.info('点击保存')
         driver.click(self.DOCS_BUTTON)
         driver.sleep(2)
     # 添加维护分类
     # driver.click(self.DOCS_FENLEI)
     # driver.sleep(1)
     # 编辑类目
     # driver.type1(self.DOCS_LEI1, '金融')
     # driver.type1(self.DOCS_LEI2, '汽车')
     # driver.type1(self.DOCS_LEI3, '旅游')
     # driver.type1(self.DOCS_LEI4, '美食')
     # driver.type1(self.DOCS_LEI5, '人道')
     # driver.sleep(1)
     # driver.click(self.DOCS_BUTTON)
     # driver.sleep(2)
     log.info('跳出最外层框架')
     driver.switch_default_frame()
     driver.sleep(2)
예제 #4
0
 def adddoc(self, data):
     driver = self.base_driver
     log = Log('..\\logs')
     # 休眠等待
     driver.sleep(1)
     # 点击文档
     log.info('点击文档')
     driver.click(self.DOCS_WEND)
     driver.sleep(1)
     #点击首页
     log.info('点击首页')
     driver.switch_to_frame(self.DOCS_FRAME)
     driver.click(self.ADOC_SHOUYE)
     #点击我的项目库
     log.info('点击我的项目库')
     driver.click(self.ADDOC_XMUKU)
     #点击创建文档
     driver.click(self.ADDOC_CJWD)
     #编辑所属分类
     log.info('选择所属分类')
     driver.click(self.ADDOC_SHUXING)
     driver.select_by_visible_text(self.ADDOC_SHUXING,data['module'])
     #编辑文档库授权用户
     log.info('选择授权用户')
     driver.click(self.DOCS_SHOUQ)
     driver.type1(self.DOCS_SHOUQ,data['username'])
     # 编辑文档库授权分组
     log.info('选择授权分组')
     if data['group'] == '管理员':
         driver.click(self.DOCS_GROUP1)
     if data['group'] == '财务专员':
         driver.click(self.DOCS_GROUP2)
     if data['group'] == '销售经理':
         driver.click(self.DOCS_GROUP3)
     if data['group'] == '销售人员':
         driver.click(self.DOCS_GROUP4)
     if data['group'] == '普通用户':
         driver.click(self.DOCS_GROUP5)
         log.info('选择文档')
     if data['type'] == '文档':
         driver.click(self.ADDOC_WENG)
         log.info('输入文档标题')
         driver.click(self.ADDOC_TITLE)
         driver.type(self.ADDOC_TITLE, data['title'])
         log.info('点击段落')
         driver.click1(self.ADDOC_DUANL)
         driver.click(self.ADDOC_GS)
         log.info('输入文档正文')
         driver.type2(self.ADDOC_ZWEN, data['body'])
         log.info('输入关键字')
         driver.type(self.ADDOC_KEY, data['key'])
         log.info('输入文档摘要')
         driver.click(self.ADDOC_ZHAIY)
         driver.type1(self.ADDOC_ZHAIY,data['body'])
     if data['type'] == '链接':
         log.info('选择链接')
         driver.click(self.ADDOC_LIANJIE)
         log.info('输入文档标题')
         driver.click(self.ADDOC_LIEJIE)
         driver.type1(self.ADDOC_TITLE, data['title'])
         log.info('输入url')
         driver.type1(self.ADDOC_URL,'http://baidu.com')
         log.info('输入关键字')
         driver.click(self.ADDOC_KEY)
         driver.type1(self.ADDOC_KEY, data['key'])
         log.info('输入文档摘要')
         driver.click(self.ADDOC_ZHAIY)
         driver.type1(self.ADDOC_ZHAIY,data['body'])
     #上传附件
     log.info('上传附件')
     driver.type2(self.ADDOC_FUJIAN,r"C:\Users\hzpower\PycharmProjects\ranzhi39\data\adddoc.csv")
     #点击保存
     log.info('点击保存')
     driver.click(self.DOCS_BUTTON)
     driver.sleep(2)
     driver.switch_default_frame()
예제 #5
0
 def log(self, msg):
     log = Log('logs')
     log.info(msg)
예제 #6
0
 def adduser(self,data):
     driver =self.base_driver
     #休眠等待
     driver.sleep(1)
     #点击后台管理
     log = Log('..\\logs')
     log.info('点击后台管理')
     driver.click(self.ADDUSER_HOUITAI)
     # 点击组织
     log.info('点击组织')
     driver.sleep(2)
     driver.switch_to_frame(self.ADDUSER_FRAME)
     driver.click(self.ADDUSER_ZUZHI)
     #点击添加成员
     log.info('点击添加成员')
     driver.click(self.ADDUSER_TIANJIA)
     #输入用户名,真实姓名
     log.info('输入用户名,真实姓名')
     driver.type(self.ADDUSER_NAME,data['name'])
     driver.type(self.ADDUSER_RLNM,data['realname'])
     #选择性别
     log.info('选择性别')
     if data['sex'] =='男':
         driver.click(self.GENDERM_BUTTON)
     if data['sex'] =='女':
         driver.click(self.GENDERF_BUTTON)
     else:
         pass
     #选择部门,角色
     log.info('选择部门,角色')
     driver.select_by_visible_text(self.ADDUSER_DEPT,data['dept'])
     driver.select_by_value(self.ADDUSER_ROLE,data['role'])
     #输入密码,重复密码,邮箱
     log.info('输入密码,重复密码,邮箱')
     driver.type(self.ADDUSER_PWD1,data['password1'])
     driver.type(self.ADDUSER_PWD2,data['password2'])
     driver.type(self.ADDUSER_EMAIL,data['email'])
     #点击保存
     log.info('点击保存')
     driver.click(self.BAOCUN_BUTTON)
     driver.sleep(1)
     # 获取url
     log.info('获取url')
     self.ADDUSER_URL = driver.get_url()
     try:
         driver.click(self.ADDUSER_URL)
     except Exception as msg:
         driver.get_screenshot('screenshot')
     #获取错误提示文本
     log.info('获取用户名错误提示文本')
     if data['casetype'] =='用户名错误' \
             or data['casetype'] =='用户名错误1' \
             or data['casetype'] =='用户名错误2' \
             or data['casetype'] =='用户名错误3':
         self.nametext =driver.get_text(self.ADDUSER_NAMETEXT)
     log.info('获取姓名错误提示文本')
     if data['casetype'] =='姓名错误':
         self.realnametext =driver.get_text(self.ADDUSER_RLNMTEXT)
     log.info('获取角色错误提示文本')
     if data['casetype'] =='角色错误':
         self.roletext =driver.get_text(self.ADDUSER_ROLETEXT)
     log.info('获取密码错误提示文本')
     if data['casetype'] =='密码错误':
         self.pwd1text =driver.get_text(self.ADDUSER_PWD1TEXT)
     log.info('获取邮箱错误提示文本')
     if data['casetype'] =='邮箱错误' \
             or data['casetype'] =='邮箱错误1'\
             or data['casetype'] =='邮箱错误2' \
             or data['casetype'] == '邮箱错误3':
         self.emailtext =driver.get_text(self.ADDUSER_EMAILTEXT)
     driver.switch_default_frame()
예제 #7
0
 def login(self, data):
     '''测试登陆'''
     # 通过base_driver获取RanzhiDriver里面的driver
     driver =self.base_driver
     #休眠等待
     driver.sleep(1)
     #输入用户名密码
     log = Log('logs')
     log.info('输入用户名')
     driver.type1(self.LOGIN_USER,data['name'])
     log.info('输入密码')
     driver.type1(self.LOGIN_PWD,data['password'])
     #点击登录
     log.info('登录然之协同')
     driver.click(self.LOGIN_BUTTON)
     #休眠等待
     driver.sleep(1)
     if data['casetype'] =='登陆成功':
         log.info('登录成功后获取页面标题')
         self.LOGIN_TITLE = driver.get_title()
         print(self.LOGIN_TITLE)
         log.info('点击签退')
         driver.click(self.LOGINOUT_BUTTON)
         driver.sleep(1)
     if data['casetype'] =='登陆失败':
         log.info('登录失败后获取错误提示信息')
         self.LOGIN_TEXT = driver.get_text()
         print(self.LOGIN_TEXT)
         log.info('点击确定按钮')
         driver.click(self.LOGIN_BUTTON_DISMISS)
         driver.sleep(1)