def test_editApprover_case(self): '''允许编辑当前节点的审批人''' menu1 = '流程' menu2 = '基本信息' # 主页打开菜单时使用 menu3 = '允许编辑当前节点的审批人' name = "允许编辑当前节点的审批人" #time.sleep(0.5) comp = ProcessApproverPage(self.driver) # 判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) #李玲建单提交 comp.launch_a_flowform(name) #退出当前登录,切换账号并打开菜单记录 comp.logoff_and_openrecord("zhangqiang", "123456", menu1, menu2, menu3, name) #time.sleep(0.5) comp.select_approver("测试主管") #time.sleep(0.5) bool = comp.is_elementPresent() self.assertEqual("true", bool, msg=name + "检验不通过") #time.sleep(0.5) #退出当前登录,切换账号并打开菜单记录 comp.logoff_and_openrecord("weiqiang", "123456", menu1, menu2, menu3, name) #提交后判断流程是否已归档 bool = comp.is_filed_for_aftersumbit(name) self.assertIsNone(bool, msg=name + "检验不通过") def init(self): self.test_editApprover_case()
def test_arbitrarily_adopt_case(self): '''任意审批人通过则节点通过''' menu1 = '流程' menu2 = '流程节点通过条件' # 主页打开菜单时使用 menu3 = '任意审批人通过则节点通过' name = "任意审批人通过则节点通过" #time.sleep(0.5) comp = ProcessApproverPage(self.driver) #把消息关掉 self.driver.switch_to_default_content() comp.close_message() comp.switch_to_formiframe() # 判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) comp.launch_a_flowform(name) comp.goback() comp.switch_account('zhangqiang', '123456') comp.close_message() comp.open_m(menu1,menu2,menu3) text = comp.openagain_to_getapprover(name) # 断言 self.assertIn('王聪', text, msg=name + "检验不通过") # 判断总经理此时有无提交按钮 bb = comp.is_elementPresent() self.assertEqual("true", bb, msg=name + "检验不通过") #time.sleep(0.5) #提交后判断流程是否已归档 bool = comp.is_filed_for_aftersumbit(name) self.assertIsNone(bool, msg=name + "检验不通过") def init(self): self.test_arbitrarily_adopt_case()
def test_paging_10(self): '''分页-每页10条''' menu3 = '列表视图_分页_10条' self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertEqual(10, lp.get_rows_total(), msg='分页-每页10条检验不通过')
def test_flow_img_case(self): '''图表''' lp = ListViewPage(self.driver) lp.click_row() name = '流程历史_图表' comp = FlowhistoryPage(self.driver, name) self.assertTrue(comp.check_flow_img(), msg=name + '检验不通过')
def test_watermark_not(self): '''不显示水印''' menu3 = '列表视图_水印_否' self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertFalse(lp.is_show_watermark(), msg='不显示水印检验不通过')
def test_non_polymerization_case(self): '''流程非聚合''' menu1 = '流程' menu2 = '审批送出设置' # 主页打开菜单时使用 menu3 = '流程非聚合' name = "流程非聚合" #time.sleep(0.5) comp = ProcessApproverPage(self.driver) # 判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) #李玲建单提交 comp.launch_a_flowform(name) #time.sleep(0.5) #退出当前登录,切换账号并打开菜单记录 comp.logoff_and_openrecord('weiqiang', '123456', menu1, menu2, menu3, name) #time.sleep(0.5) comp.direct_sumit() #退出当前登录,切换账号并打开菜单记录for表单 comp.logoff_and_openmenu('zjl01', '123456', menu1, menu2, menu3) text = comp.openagain_to_getapprover(name) # 断言 self.assertIn('张强', text, msg=name + "检验不通过") # 判断总经理此时有无提交按钮 bb = comp.is_elementPresent() self.assertEqual("true", bb, msg=name + "检验不通过") #time.sleep(0.5) #提交后判断流程是否已归档 bool = comp.is_filed_for_aftersumbit(name) self.assertIsNone(bool, msg=name + "检验不通过") def init(self): self.test_non_polymerization_case()
def test_watermark_show(self): '''显示水印''' menu3 = '列表视图_水印_是' self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertTrue(lp.is_show_watermark(), msg='显示水印检验不通过')
def default_notcheck_case(self): """并行默认不选中""" name = "并行默认不选中" #time.sleep(0.5) comp = ProcessApproverPage(self.driver) # 判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) # 点击新建进入表单 comp.click_newbtn() # 录入请假原因 comp.input_reason(name) # 点击提交按钮 comp.click_flow_processbtn() #time.sleep(0.5) bool1 = self.find_elem( 'fieldset#fieldset_commit_to > div:nth-child(2)>label>input' ).is_selected() self.assertFalse(bool1, msg=name + '检验不通过') bool2 = self.find_elem( 'fieldset#fieldset_commit_to > div:nth-child(3)>label>input' ).is_selected() self.assertFalse(bool2, msg=name + '检验不通过') self.find_elem( 'fieldset#fieldset_commit_to > div:nth-child(2)>label>input' ).click() # 点击确认提交 comp.submit() #time.sleep(0.5) # 再次相应记录 comp.openagain_record(name) # 获取流程状态的处理人 text = comp.get_approver() # 断言 self.assertIn('王聪', text, msg=name + "检验不通过")
def test_approver_iscript_case(self): '''流程审批人for_iscript形式''' menu1 = '流程' menu2 = '审批人设置' # 主页打开菜单时使用 menu3 = '' name = "流程审批人设置_通过iscript形式" #time.sleep(0.5) comp = ProcessApproverPage(self.driver) # 判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) #李玲新建单据 self.lilingnew(name) #退出当前登录,切换账号并打开菜单记录for视图 comp.logoff_and_openrecord('weiqiang', '123456', menu1, menu2, menu3, name) comp.direct_sumit() # 直接提交 #退出切换账号,查看是否有提交按钮 bb = comp.logoff_and_check_submitbtn('zhangqiang', '123456', menu1, menu2, menu3, name) self.assertEqual("true", bb, msg=name + "检验不通过") #time.sleep(0.5) #表单是否已归档 bool = comp.is_filed_for_aftersumbit(name) self.assertIsNone(bool, msg=name + "检验不通过")
def test_skipprocess_case(self): """流程节点跳过""" name = "流程节点跳过" #time.sleep(0.5) comp = ProcessApproverPage(self.driver) #把消息关掉 self.driver.switch_to_default_content() comp.close_message() comp.switch_to_formiframe() # 判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) # 点击新建进入表单 comp.click_newbtn() # 录入请假原因 comp.input_reason(name) # 点击提交按钮 comp.click_flow_processbtn() # 点击确认提交 comp.submit() time.sleep(10) # 再次相应记录 comp.openagain_record(name) #表单是否已归档 bool = comp.is_filed() self.assertIsNone(bool, msg=name + "检验不通过")
def test_paging_not(self): '''不分页''' menu3 = '列表视图_分页_否' self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertFalse(lp.get_pagination_body(), msg='不分页检验不通过')
def test_column_width_px(self): '''列宽度px''' menu3 = '列表视图_列_列宽_像素' self.open_menu3(menu3) lp = ListViewPage(self.driver) width = lp.get_column_head_width('列表视图_文本一') self.assertEqual('200px', width, msg='列宽固定px检验不通过')
def test_column_width_percent(self): '''列宽百分比''' menu3 = '列表视图_列_列宽_百分比' self.open_menu3(menu3) lp = ListViewPage(self.driver) width = lp.get_column_head_width('列表视图_文本一') self.assertEqual('30%', width, msg='列宽百分比检验不通过')
def test_column_true_val(self): '''真实值''' menu3 = '列表视图_列_值类型_真实值' self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertEqual('11e7-5f99-e70d1a49-917f-e799edecb417', lp.get_column_row1_col1(), msg='真实值检验不通过')
def test_column_sort_down(self): '''排序降序''' menu3 = '列表视图_列_排序_降序' self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertIn('down.gif', lp.get_column_sort_img_src('列表视图_部门选择框'), msg='真实值检验不通过')
def test_style_lib(self): '''样式库使用''' menu3 = '列表视图_样式库' self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertIn('background-color:yellow', lp.get_style_lib(), msg='样式库使用检验不通过')
def test_select_all(self): '''全选''' menu3 = '列表视图_全选和翻页' mp = MainPage(self.driver) self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertTrue(lp.check_select_all(), msg=menu3 + '检验不通过') #一次选中 self.assertTrue(lp.check_select_all(), msg=menu3 + '检验不通过') #一次取消选中
def test_show_when_hide_case(self): '''隐藏时显示值''' lp = ListViewPage(self.driver) lp.click_row() name = '流程催办历史_隐藏时显示值' comp = FlowRemindHistoryPage(self.driver, name) self.assertTrue(comp.is_elem_invisibility('[name="' + name + '"]'), msg=name + '检验不通过') self.assertTrue(comp.show_when_hide('隐藏时显示值'), msg=name + '检验不通过')
def test_val_type_title(self): '''列_显示提示文字''' menu3 = '列表视图_列_显示提示文字' mp = MainPage(self.driver) self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertEqual('666666', lp.get_column_row1_col1_title(), msg=menu3 + '检验不通过')
def test_val_type_font_length(self): '''列_显示文字方式_文字长度''' menu3 = '列表视图_列_显示文字方式_文字长度' mp = MainPage(self.driver) self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertEqual('666666...', lp.get_column_row1_col1(), msg=menu3 + '检验不通过')
def test_val_type_cash(self): '''列-格式-类型-货币_小数位美元''' menu3 = '列表视图_列_格式类型_货币_小数位美元' mp = MainPage(self.driver) self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertEqual('$22,222.000', lp.get_column_row1_col1(), msg=menu3 + '检验不通过')
def test_val_type_number(self): '''列-格式-类型-数值-小数3位且使用千分位分隔符''' menu3 = '列表视图_列_格式类型_数值_小数位千分位' mp = MainPage(self.driver) self.open_menu3(menu3) lp = ListViewPage(self.driver) self.assertEqual('22,222.000', lp.get_column_row1_col1(), msg=menu3 + '检验不通过')
def test_readonly_not(self): '''非只读''' menu3 = '列表视图_只读_否' self.open_menu3(menu3) lp = ListViewPage(self.driver) lp.click_row() btn = ButtonPage(self.driver) btn_title = btn.get_button_title(btn.save) self.assertEqual('保存', btn_title, msg='非只读检验不通过')
def test_readonly_case(self): '''控件属性''' lp = ListViewPage(self.driver) lp.click_row() name = '微信录音控件_只读条件' comp = RecordPage(self.driver, name) #time.sleep(0.5) comp.from_scroll_to('300') self.assertFalse(comp.check_del_icon(), msg=name + '检验不通过') #删除后音频文件不存在
def test_record_total_show(self): '''显示记录总数''' menu3 = '列表视图_显示记录总数_是' self.open_menu3(menu3) lp = ListViewPage(self.driver) total_text = lp.get_record_total() print('显示总记录数:%s' % total_text) self.assertIn('总条数:', total_text, msg='显示总记录数检验不通过')
def test_jump_url_current_page_btn(self): '''跳转(当前页)按钮''' menu3 = '按钮_case002' self.open_menu3(menu3) #打开菜单 btn = ButtonPage(self.driver) btn.click_button_by_type_title(btn.jump_to, '跳转(当前页)') #点击跳转 #time.sleep(0.5) lp = ListViewPage(self.driver) self.assertEqual('保存', lp.get_column_row1_col1(), msg='跳转(当前页)按钮检验不通过')
def test_edit_not(self): '''是否可编辑脚本_否''' menu3 = '表单_是否可编辑脚本_否' self.open_menu3(menu3) lp = ListViewPage(self.driver) lp.click_row() btn = ButtonPage(self.driver) comp = InputPage(self.driver, '文本一') self.assertTrue(comp.readonly_test(), msg='是否可编辑脚本_否检验不通过')
def test_desription_case(self): '''描述''' lp = ListViewPage(self.driver) lp.click_row() name = '流程历史_描述' #time.sleep(0.5) comp = FlowhistoryPage(self.driver, name) self.assertEqual('流程历史_描述描述', comp.get_description_text(), msg=name + '检验不通过')
def test_edit_yes(self): '''是否可编辑脚本_是''' menu3 = '表单_是否可编辑脚本_是' self.open_menu3(menu3) lp = ListViewPage(self.driver) lp.click_row() btn = ButtonPage(self.driver) self.assertNotEqual('none', btn.get_button(btn.save), msg='是否可编辑脚本_是检验不通过')
def test_readonly(self): '''只读''' menu3 = '列表视图_只读_是' self.open_menu3(menu3) lp = ListViewPage(self.driver) lp.click_row() btn = ButtonPage(self.driver) btn_title = btn.get_button_title(btn.new_btn) self.assertEqual('新建', btn_title, msg='非只读检验不通过')