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_flow_complete(self): '''自由流程结束流程''' name = '自由流程结束流程' comp = ProcessApproverPage(self.driver) # 判断是否要删除记录 lp = ListViewPage(self.driver) if lp.get_rows_total() != 0: lp.delete_all_data() # 删除所有数据 comp.click_newbtn() # 点击新建进入表单 comp.input_reason(name) # 录入请假原因 comp.click_submit_star_flowbtn() # 点击提交按钮 comp.select_user('员工') # 选择审批人 comp.submit() # 点击确认 comp.wait_loading_hide() # 等待视图loading消失 lp.click_row() # 点击第一条记录 comp.click_end_flow() # 点击结束流程按钮 comp.wait_elem_visible( '#flowprocessDiv #div_button_place') # 等待流程面板展开按钮可见 comp.submit() # 点击确认按钮 # comp.wait_loading_hide() # 等待视图loading消失 lp.click_row() # 点击第一条记录 self.assertFalse(comp.is_flow_actbutton_exist('提交 _结束流程'), 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_adjustment_process_case(self): '''前台手动调整流程''' name = '前台手动调整流程' comp = ProcessApproverPage(self.driver) btn = ButtonPage(self.driver) #判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) #点击新建进入表单 comp.click_newbtn() #录入请假原因 #time.sleep(0.5) comp.input_reason(name) #点击保存并启动按钮 comp.click_starprocessbtn() #time.sleep(0.5) self.assertTrue(btn.is_button_visiable('流程调整'), msg=name + "检验不通过") lp.wait_loading_hide() # 等待视图加载 #点击前台流程调整按钮 comp.click_editFlowbtn() #回到主文档,没有iframe self.driver.switch_to.default_content() #获取弹出框的title text = comp.get_popuptitle() self.assertEqual("调整流程", text, msg=name + "检验不通过") mp = MainPage(self.driver) mp.switch_to_div_iframe() self.assertTrue(comp.is_embed_visit(), msg=name + "检验不通过")
def lilingnew(self, name): """李玲新建单据""" comp = ProcessApproverPage(self.driver) # 点击新建进入表单 comp.click_newbtn() # 录入请假原因 if (comp.find_elem_visible( 'span[id="11e7-6619-cde06435-8f1a-bfe936d3ae2a_divid"]>textarea' ) == None): comp.wait_elem_visible( 'span[id="11e7-6619-cde06435-8f1a-bfe936d3ae2a_divid"]>textarea' ) time.sleep(1) comp.find_elem_visible( 'span[id="11e7-6619-cde06435-8f1a-bfe936d3ae2a_divid"]>textarea' ).send_keys(name) else: comp.find_elem_visible( 'span[id="11e7-6619-cde06435-8f1a-bfe936d3ae2a_divid"]>textarea' ).send_keys(name) # 点击提交按钮 comp.click_flow_processbtn() # 点击指定审批人选择框 comp.find_elem_is_clickable('span.flowToPerson>img').click() # 回到主文档,没有iframe self.driver.switch_to.default_content() # 切到指定审批人iframe comp.switchto_designatedapprover() comp.wait_elem_visible('.contentDiv.on') #等待审批人框显示 # 勾选审批人伟强 comp.find_elem_visible( '#rightcontent>div>input[name="伟强"]+span').click() if (comp.find_elem('#rightcontent>div>input[name="伟强"]').is_selected() == False): for i in range(10): print('次数 %s' % i) comp.find_elem_visible( '#rightcontent>div>input[name="伟强"]+span').click() if (comp.find_elem( '#rightcontent>div>input[name="伟强"]').is_selected()): break comp.wait_elem_visible('#selectedUserDiv>span[title="点击删除"]') #等待用户选中 comp.find_elem_is_clickable('input#doReturn').click() # 等待确认后的灰色锁屏消失 self.driver.switch_to.default_content() comp.wait_elem_disappear('#lock_screen_div>div') #等待确认后的灰色锁屏消失 # 返回到表单所在的iframe comp.switch_to_formiframe() # 点击确认提交 comp.submit()
def test_cc_for_iscript_case(self): '''流程抄送通过iscript''' menu1 = '流程' menu2 = '抄送设置' # 主页打开菜单时使用 menu3 = '流程抄送通过iscript' name = "流程抄送通过iscript" name2 = "消息中心" comp = ProcessApproverPage(self.driver) comp.goback() comp.switch_account('zhangqiang', '123456') comp.go_messagecenter_toclear() #进入消息中心清空工作事项通知 self.assertEqual(0, comp.get_messagecenter_totalRowPanel(), msg='进入消息中心清空工作事项通知失败') #张强去消息中心清空数据 #退出登录#33 comp.goback() # 切换账号登陆 comp.switch_account('liling', '123456') #李玲发起请假申请单 comp.open_m(menu1, menu2, menu3) # 判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) comp.click_newbtn() #comp.switch_to_formiframe() #李玲建单提交 # 录入请假原因 comp.input_reason(name) # 点击提交按钮 comp.click_flow_processbtn() #选择抄送人 comp.select_user_by_rolename("自动化测试组长") # 返回到表单所在的iframe comp.switch_to_formiframe() #time.sleep(0.5) # 点击确认提交 comp.submit() #time.sleep(0.5) #退出登录 comp.goback() #张强进入消息中心获取抄送消息 comp.switch_account('zhangqiang', '123456') #获取消息中心的工作事项内容 text = comp.get_messagecentercontent() self.assertIn("流程抄送", text, msg=name + "检验不通过") def init(self): self.test_cc_for_iscript_case()
def overcount(self): '''审批意见超出''' name = '审批意见超出' title = '很好允许通过' comp = ProcessApproverPage(self.driver) comp.wait_loading_hide() #等待视图页面加载完成 comp.click_newbtn() comp.wait_loading_hide() #等待表单页面加载完成 comp.click_flow_processbtn() i = 0 while i < 24: comp.find_elem('textarea[name="_attitude"]').send_keys(title) i += 1 count = comp.get_usefulopinions_count() self.assertEqual('140', count, msg=name + "检测不通过")
def test_freeflow_case(self): '''自由流程提交''' name = '自由流程直接提交' comp = ProcessApproverPage(self.driver) self.driver.switch_to_default_content() comp.close_message() comp.switch_to_formiframe() # 判断是否要删除记录 lp = ListViewPage(self.driver) if lp.get_rows_total() != 0: lp.delete_all_data() # 删除所有数据 comp.click_newbtn() # 点击新建进入表单 comp.input_reason(name) # 录入请假原因 comp.click_submit_star_flowbtn() # 点击提交按钮 comp.select_user('自动化测试组长') # 选择审批人 comp.submit() # 点击确认发起 lp.click_row() # 打开第一条记录 self.assertFalse(comp.is_flow_actbutton_exist('提交 _提交流程'), msg=name + '校验不通过')
def test_ccForRole_case(self): '''流程抄送通过角色''' menu1 = '流程' menu2 = '抄送设置' # 主页打开菜单时使用 menu3 = '流程抄送' name = "流程抄送" name2 = "消息中心" #time.sleep(0.5) comp = ProcessApproverPage(self.driver) comp.goback() # 伟强去消息中心清空数据 comp.switch_account('weiqiang', '123456') comp.go_messagecenter_toclear() #退出登录#33 comp.goback() # 切换账号登陆 comp.switch_account('liling', '123456') #李玲发起请假申请单 comp.open_m(menu1, menu2, menu3) # 判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) comp.click_newbtn() #李玲建单提交 # 录入请假原因 comp.input_reason(name) # 点击提交按钮 comp.click_flow_processbtn() #选择抄送人 comp.select_user_by_rolename("测试主管") # 返回到表单所在的iframe comp.switch_to_formiframe() # 点击确认提交 comp.submit() #退出登录 comp.goback() #张强进入消息中心获取抄送消息 comp.switch_account('weiqiang', '123456') # 获取消息中心的工作事项内容 text = comp.get_messagecentercontent() self.assertIn("流程抄送", text, msg=name + "检验不通过")
def test_adjustment_process_case(self): '''前台手动调整流程''' name = '前台手动调整流程' comp = ProcessApproverPage(self.driver) #判断是否要删除记录 lp = ListViewPage(self.driver) lp.judge_delete(name) #点击新建进入表单 comp.click_newbtn() #录入请假原因 comp.input_reason(name) #点击保存并启动按钮 comp.click_starprocessbtn() #点击前台流程调整按钮 comp.click_editFlowbtn() #回到主文档,没有iframe self.driver.switch_to.default_content() #获取弹出框的title text = comp.get_popuptitle() self.assertEqual("调整流程", text, msg=name + "检验不通过") self.assertTrue(comp.is_embed_visit(), msg=name + "检验不通过")
def test_use_usefulopinions_case(self): '''常用意见选用''' name = '常用意见选用' comp = ProcessApproverPage(self.driver) comp.wait_loading_hide() #等待视图页面加载完成 comp.click_newbtn() comp.wait_loading_hide() #等待表单页面加载完成 comp.click_flow_processbtn() #点击展开常用意见 comp.open_usefulopinionsboard() #判断是否已存在相同的意见 comp.judgedel_usefulopinions("常用意见选用") #点击常用意见的值 comp.select__usefulopinions("批准") time.sleep(0.5) #必须,等待交互完成 #获取意见面板的内容 text = comp.get_usefulopinionsval() self.assertEqual('批准', text, msg=name + "检测不通过") #获取意见面板的字数 count = comp.get_usefulopinions_count() self.assertEqual('2', count, msg=name + "检测不通过")
def test_timeout_submit_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.wait_elem_visible('div[data-type="nodeItem"]') #等待提交节点显示 # 点击确认提交 comp.submit() # 再次相应记录 comp.openagain_record(name) # 获取流程状态的处理人 text = comp.get_approver() # 断言 self.assertIn('王聪', text, msg=name + "检验不通过") #点击返回按钮 comp.click_rebackbtn() time.sleep(60) #等待系统超时自动提交,再验证是否已提交 # 再次相应记录 comp.openagain_record(name) #time.sleep(0.5) bool = comp.is_filed() self.assertIsNone(bool, msg=name + "检验不通过") def init(self): self.test_timeout_submit_case()
def test_flow_backoff(self): '''自由流程回退''' name = '自由流程回退' comp = ProcessApproverPage(self.driver) # 判断是否要删除记录 lp = ListViewPage(self.driver) if lp.get_rows_total() != 0: lp.delete_all_data() # 删除所有数据 comp.click_newbtn() # 点击新建进入表单 comp.input_reason(name) # 录入请假原因 comp.click_submit_star_flowbtn() # 点击提交按钮 comp.select_user('自动化测试组长') # 选择审批人 comp.submit() # 点击确认提交 comp.goback() # 退出登录 # 张强回退流程 comp.switch_account('zhangqiang', '123456') # 切换帐号 self.open_3_menus() mp = MainPage(self.driver) mp.switch_to_iframe() lp.click_row() # 点击第一条记录 self.assertTrue(comp.is_flow_actbutton_exist('提交_回退流程'), msg=name + '校验不通过') comp.click_backoff_btn() # 点击回退按钮 comp.backoff_select_approver('李玲') # 选择审批人 comp.wait_lock_screen_div_not_visible() # 等待用户选择div消失 comp.submit() # 点击确认回退 comp.switch_account('liling', '123456') # 切换帐号 self.open_3_menus() mp = MainPage(self.driver) mp.switch_to_iframe() comp.wait_loading_hide() # 等待视图loading消失 lp.click_row() # 点击第一条记录 self.assertTrue(comp.is_flow_actbutton_exist('提交_回退流程'), msg=name + '校验不通过')
def test_default_lockandcheck_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() #time.sleep(0.5) bool1 = comp.find_elem('fieldset#fieldset_commit_to > div:nth-child(2)>label>input').get_attribute('locked') self.assertTrue(bool1, msg=name + '检验不通过') bool2 = comp.find_elem('fieldset#fieldset_commit_to > div:nth-child(3)>label>input').get_attribute('locked') self.assertTrue(bool2, msg=name + '检验不通过') comp.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 init(self): self.test_default_lockandcheck_case()
def test_add_usefulopinions_case(self): '''新增常用意见''' name = '新增常用意见' title = '很好允许通过' comp = ProcessApproverPage(self.driver) comp.wait_loading_hide() #等待视图页面加载完成 comp.click_newbtn() comp.wait_loading_hide() #等待表单页面加载完成 #time.sleep(0.5) comp.click_flow_processbtn() #点击展开常用意见 comp.open_usefulopinionsboard() #判断是否已存在相同的意见 comp.judgedel_usefulopinions(title) #点击添加常用意见 comp.add_usefulopinions(title) time.sleep(0.5) #必须,等待交互完成 #点击常用意见的值 comp.select__usefulopinions(title) time.sleep(5) #必须,等待交互完成 text = comp.get_usefulopinionsval() self.assertEqual('很好允许通过', text, msg=name + "检测不通过") count = comp.get_usefulopinions_count() self.assertEqual('6', count, msg=name + "检测不通过")