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_column_type_submit(self): '''列-操作类型-提交流程''' menu3 = '列表视图_列_操作类型_提交流程' self.open_menu3(menu3) lp = ListViewPage(self.driver) if lp.get_rows_total() == 0: lp.add_one_row() if lp.get_rows_total() >= 1: lp.delete_record() lp.add_one_row() lp.click_submit() #点击视图的流程提交按钮 mp = MainPage(self.driver) mp.switch_to_parent() mp.wait_elem_visible('div.aui_content') #等待动画弹框显示 lp.set_val_and_submit('请审批') #设置提交审批意见并确定提交 mp.switch_to_iframe() mp.wait_loading_hide() #等待loading加载完 #点击行数据 lp.click_row() bp = ButtonPage(self.driver) fp = FormPage(self.driver) self.assertEqual(0, fp.get_nextids(), msg='列-操作类型-提交流程检验不通过')
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_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_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_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_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_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_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_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='非只读检验不通过')
def test_type_case(self): '''控件属性''' lp = ListViewPage(self.driver) lp.click_row() name = '微信录音控件_名称' #time.sleep(0.5) comp = RecordPage(self.driver, name) self.assertNotEqual('none', comp.get_the_div(), msg=name + '检验不通过') self.assertNotEqual('none', comp.get_the_audio(), msg=name + '检验不通过') self.assertEqual('none', comp.check_del_function(), msg=name + '检验不通过') #删除后音频文件不存在
def test_show_when_hide_case(self): '''隐藏时显示值''' lp = ListViewPage(self.driver) lp.click_row() name = '微信录音控件_隐藏时显示值' comp = RecordPage(self.driver, name) self.assertEqual('none', comp.find_element_by_css_selector('[name="' + name + '"]'), msg=name + '检验不通过') self.assertTrue(comp.show_when_hide('隐藏时显示值'), msg=name + '检验不通过')
def test_text_list_case(self): '''文本列表''' lp = ListViewPage(self.driver) lp.click_row() name = '流程历史_文本列表' comp = FlowhistoryPage(self.driver, name) self.assertTrue(comp.check_title(), msg=name + '检验不通过') self.assertEqual('审批节点', comp.get_table_head_first_td_text(), msg=name + '检验不通过') self.assertEqual('申请人', comp.get_table_tbody_first_td_text(), msg=name + '检验不通过')
def test_show_when_hide_case(self): '''隐藏时显示值''' lp = ListViewPage(self.driver) lp.click_row() name = '流程历史_隐藏时显示值' comp = FlowhistoryPage(self.driver, name) #time.sleep(0.5) comp.from_scroll_to('1000') self.assertEqual('none', comp.find_element_by_css_selector('[name="' + name + '"]'), msg=name + '检验不通过') self.assertTrue(comp.show_when_hide('隐藏时显示值'), msg=name + '检验不通过')
def test_show_when_print_case(self): '''打印隐藏时显示值''' lp = ListViewPage(self.driver) lp.click_row() name = '微信录音控件_打印隐藏时显示值' comp = RecordPage(self.driver, '') comp.open_and_switch_to_print_page() #time.sleep(0.5) comp.window_scroll_to('1000') self.assertEqual('none', comp.find_element_by_css_selector('input[name="' + name + '"]'), msg=name + '检验不通过') self.assertTrue(comp.show_when_print('打印隐藏时显示值'), msg=name + '检验不通过') comp.close_currentwindow()
def test_desription_case(self): '''描述''' lp = ListViewPage(self.driver) lp.click_row() name = '流程催办历史_描述' comp = FlowRemindHistoryPage(self.driver, name) self.assertTrue(comp.check_title(), msg=name + '检验不通过') self.assertEqual('序号', comp.get_table_head_first_td_text(), msg=name + '检验不通过') self.assertEqual('1', comp.get_table_tbody_first_td_text(), msg=name + '检验不通过') self.assertEqual('流程催办历史_描述', comp.get_description_text(), msg=name + '检验不通过')
def test_batch_submit_case(self): '''批量提交按钮''' menu3 = '按钮_case001' self.open_menu3(menu3) #打开菜单 lp = ListViewPage(self.driver) if 0 != lp.get_rows_total(): lp.clear_all_data() #清空数据 #新建一条数据 btn = ButtonPage(self.driver) btn.click_button(btn.new_btn) lp.wait_Tabloading_show_then_hide() ip = InputPage(self.driver, '单行文本') ip.element.send_keys('保存') btn.click_button(btn.save_start) lp.wait_Tabloading_show_then_hide() btn.click_button(btn.to_return) lp.wait_loading_hide() #表单中 lp.wait_loading_hide() #视图中 #确定数据不止一条 self.assertNotEqual(0, lp.get_rows_total(), msg='批量提交按钮检验不通过') lp.click_select_all() #全选 btn.click_button(btn.batch_submit) #点击批量提交 lp.wait_Tabloading_show_then_hide() mp = MainPage(self.driver) mp.switch_to_parent() #切换到主页 #time.sleep(0.5) lp.set_val_and_submit('请审批') #填写审批意见并确定 lp.wait_Tabloading_show_then_hide() mp.switch_to_iframe() #切换回iframe中 #time.sleep(0.5) lp.click_row() #点击第一行数据 lp.wait_Tabloading_show_then_hide() # 等待表单页面的loading加载完 #没有流程处理按钮则通过 self.assertIsNone(btn.get_button(btn.flow_process), msg='批量提交按钮检验不通过') btn.click_button(btn.to_return) #点击返回 lp.wait_loading_hide() #表单中 lp.wait_loading_hide() #视图中 if 0 != lp.get_rows_total(): #清空数据 lp.clear_all_data()
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_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 + '校验不通过')