def test_ccForRole_case(self): '''流程抄送通过角色''' menu2 = '抄送设置' # 主页打开菜单时使用 menu3 = '流程抄送' title = "流程抄送通过角色" self.open_menus(self.menu1, menu2, menu3) fp = FlowPhonePage(self.driver) lp = ListViewPhonePage(self.driver) mp = MainPhonePage(self.driver) bt = ButtonPhonePage(self.driver) us = UserSelectPhonePage(self.driver, 'copyto_user_select') po = LoginPage(self.driver) lp.clear_all_data() # 清空所有数据 bt.click_button('新建') # 点击新建按钮 fp.input_reason(title) # 录入请假原因 bt.click_button('提交') # 点击提交按钮 fp.click_flow_copyTo() # 点击选择抄送人 self.assertTrue(fp.is_flow_copyTo_exsit(), msg=title + '测试不通过') us.select_user_by_name('伟强') fp.flow_sumit() # 提交流程 lp.open_fisrt_doc() # 打开记录 fp.click_flow_more() # 点击流程栏更多 self.assertEqual('归档', fp.get_cur_flow_state(), msg=title + '测试不通过') # 检查当前流程状态是不是归档
def test_approver_role_case(self): '''流程审批人for角色形式''' menu2 = '审批人设置' # 主页打开菜单时使用 menu3 = '' title = '流程审批人for角色形式' self.open_menus(self.menu1, menu2, menu3) fp = FlowPhonePage(self.driver) lp = ListViewPhonePage(self.driver) mp = MainPhonePage(self.driver) bt = ButtonPhonePage(self.driver) us = UserSelectPhonePage(self.driver, '通过角色指定') po = LoginPage(self.driver) lp.clear_all_data() # 清空所有数据 bt.click_button('新建') # 点击新建按钮 fp.input_reason(title) # 录入请假原因 bt.click_button('提交') # 点击提交按钮 fp.click_flow_submit_user_avatar() # 点击选择流程审批人 us.select_user_by_name('伟强') fp.flow_sumit() # 提交流程 po.user_login('weiqiang', '123456') # 切换伟强登陆 mp.switch_to_menu_page() self.open_menus(self.menu1, menu2, menu3) # 打开相应的菜单 lp.open_fisrt_doc() # 打开记录 bt.click_button('提交') # 点击提交按钮 fp.flow_sumit() # 提交流程 lp.open_fisrt_doc() # 打开记录 fp.click_flow_more() # 点击流程栏更多 self.assertEqual('通过iscript指定', fp.get_cur_flow_state(), msg=title + '测试不通过') # 检查当前流程状态是不是通过iscript指定
def test_approver_organization_case(self): '''流程审批人for组织形式''' menu2 = '审批人设置' # 主页打开菜单时使用 menu3 = '' title = '流程审批人for组织形式' self.open_menus(self.menu1, menu2, menu3) fp = FlowPhonePage(self.driver) lp = ListViewPhonePage(self.driver) mp = MainPhonePage(self.driver) bt = ButtonPhonePage(self.driver) us = UserSelectPhonePage(self.driver, '通过角色指定') lp.clear_all_data() # 清空所有数据 bt.click_button('新建') # 点击新建按钮 fp.input_reason(title) # 录入请假原因 bt.click_button('提交') # 点击提交按钮 fp.click_flow_submit_user_avatar() # 点击选择流程审批人 us.select_user_by_name('伟强') fp.flow_sumit() # 提交流程 lp.open_fisrt_doc() # 打开记录 fp.click_flow_more() # 点击流程栏更多 self.assertEqual('通过角色指定', fp.get_cur_flow_state(), msg=title + '测试不通过') # 检查当前流程状态是不是通过角色指定
def test_type_case(self): '''类型''' name = '用户选择框_名称' comp = UserSelectPhonePage(self.driver, name) self.assertEqual('UserField', comp.get_attr('fieldtype'), msg=name + '检验不通过')
def test_condition_hide_case(self): '''用户选择框_隐藏显示值''' compname2 = '用户选择框_隐藏显示值' comp = UserSelectPhonePage(self.driver, '') self.assertTrue(comp.is_comp_hide(compname2), msg=compname2 + '检验不通过') self.assertIn('控件已隐藏', comp.get_curpage_span(), msg=compname2 + '检验不通过')
def test_not_null_case(self): '''非空校验''' name = '用户选择框_非空校验' comp = UserSelectPhonePage(self.driver, name) btn = ButtonPhonePage(self.driver) btn.click_button('保存') #time.sleep(0.5) text1 = comp.get_msg() self.assertIn("'用户选择框_非空校验'必须填写!", text1, msg=name + '检验不通过')
def test_select_user_bydept_case(self): '''从部门中获取用户''' name = '用户选择框_名称' comp = UserSelectPhonePage(self.driver, name) comp.click_adduser_btn(name) comp.switch_dept_user_select_page() comp.add_user_by_name(['伟强']) self.assertIn('伟强', comp.get_select_users(name), msg='从部门中获取用户检验不通过')
def test_cleanup_user_case(self): '''清除已选用户''' name = '用户选择框_名称' comp = UserSelectPhonePage(self.driver, name) comp.click_adduser_btn(name) comp.add_user(['伟强']) comp.click_clearall_btn() #点击清空 self.assertIn('', comp.get_select_users(name), msg='清除已选用户检验不通过')
def test_selected_radio_type_case(self): '''用户单选''' name = '用户选择框_单选' comp = UserSelectPhonePage(self.driver, name) comp.click_adduser_btn(name) comp.add_user_by_name(['王聪', '伟强']) self.assertEqual('伟强', comp.get_select_users(name), msg=name + '检验不通过')
def test_freeflow_backoff_case(self): '''自由流程回退''' menu2 = '自由流程' # 主页打开菜单时使用 menu3 = '' title = '自由流程回退' self.open_menus(self.menu1, menu2, menu3) fp = FlowPhonePage(self.driver) lp = ListViewPhonePage(self.driver) mp = MainPhonePage(self.driver) bt = ButtonPhonePage(self.driver) us = UserSelectPhonePage(self.driver, 'free_flow') po = LoginPage(self.driver) lp.clear_all_data() # 清空所有数据 bt.click_button('新建') # 点击新建按钮 fp.input_reason(title) # 录入请假原因 bt.click_button('提交') # 点击提交按钮 fp.click_flow_submit_user_avatar() # 点击选择流程审批人 us.select_user_by_name('王聪') bt.click_flowpanel_button('发起') # 提交流程 lp.open_fisrt_doc() # 打开记录 self.assertEqual('王聪', fp.get_curnode_user(), msg=title + '测试不通过') po.user_login('wangcong', '123456') # 切换王聪登陆 mp.switch_to_menu_page() self.open_menus(self.menu1, menu2, menu3) # 打开相应的菜单 lp.open_fisrt_doc() # 打开记录 bt.click_button('回退') # 点击提交按钮 fp.click_flow_submit_user_avatar() # 点击选择流程审批人 self.assertIn('李玲', us.get_all_noAvatar_name(), msg=title + '测试不通过') self.assertNotIn('王聪', us.get_all_noAvatar_name(), msg=title + '测试不通过') us.select_user_by_name('李玲') bt.click_flowpanel_button('回退') lp.open_fisrt_doc() # 打开记录 self.assertEqual('李玲', fp.get_curnode_user(), msg=title + '测试不通过') self.assertFalse(bt.is_button_exist('提交'), msg=title + '测试不通过') self.assertFalse(bt.is_button_exist('回退'), msg=title + '测试不通过') self.assertFalse(bt.is_button_exist('结束流程'), msg=title + '测试不通过') po.user_login('liling', '123456') # 切换李玲登陆 mp.switch_to_menu_page() self.open_menus(self.menu1, menu2, menu3) # 打开相应的菜单 lp.open_fisrt_doc() # 打开记录 self.assertTrue(bt.is_button_exist('提交'), msg=title + '测试不通过') self.assertTrue(bt.is_button_exist('回退'), msg=title + '测试不通过') self.assertTrue(bt.is_button_exist('结束流程'), msg=title + '测试不通过')
def default_notcheck_case(self): """并行默认不选中""" menu2 = '流程并行' # 主页打开菜单时使用 menu3 = '并行默认不选中' title = '并行默认不选中' self.open_menus(self.menu1, menu2, menu3) fp = FlowPhonePage(self.driver) lp = ListViewPhonePage(self.driver) mp = MainPhonePage(self.driver) bt = ButtonPhonePage(self.driver) us = UserSelectPhonePage(self.driver) po = LoginPage(self.driver) lp.clear_all_data() # 清空所有数据 bt.click_button('新建') # 点击新建按钮 fp.input_reason(title) # 录入请假原因 bt.click_button('提交') # 点击提交按钮 self.assertNotIn(True, fp.get_nodes_checked_stable(), msg=title + '测试不通过') fp.flow_sumit() # 提交流程 self.assertIn('请选择一项操作', fp.is_alert_exist(), msg=title + '测试不通过') fp.accept_alert() # 接受alert fp.find_elem( '#flow-submit__node-box > div:nth-child(4) > label > div.weui-cell__hd > i' ).click() # 点击 第一个流程节点状态使他成为选中 fp.flow_sumit() # 提交流程 lp.open_fisrt_doc() # 打开记录 self.assertNotIn('张强', fp.get_curnode_user(), msg=title + '测试不通过') self.assertIn('王聪', fp.get_curnode_user(), msg=title + '测试不通过') self.assertIn('伟强', fp.get_curnode_user(), msg=title + '测试不通过') po.user_login('weiqiang', '123456') # 切换伟强登陆 mp.switch_to_menu_page() self.open_menus(self.menu1, menu2, menu3) # 打开相应的菜单 lp.open_fisrt_doc() # 打开记录 bool = bt.is_button_exist('提交') # 查看有没有提交按钮 self.assertTrue(bool, msg=title + "测试不通过") bt.click_button('提交') fp.flow_sumit() # 提交流程 lp.open_fisrt_doc() # 打开记录 fp.click_flow_more() # 点击流程栏更多 self.assertEqual('归档', fp.get_cur_flow_state(), msg=title + '测试不通过') # 检查当前流程状态是不是归档
def set_val_by_component_type(self, type, comp_name, val): '''根据类型初始化控件并设置控件值''' col_num = '2' if type == 'input': comp = InputPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '2' if type == 'textarea': comp = TextareaPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '3' if type == 'radio': comp = RadioPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '4' if type == 'checkbox': comp = CheckboxPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '5' if type == 'select': comp = SelectPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '6' if type == 'date': comp = DatePhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '7' if type == 'depart': comp = DepartmentPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '8' if type == 'tree_depart': comp = TreeDepartmentPhonePage(self.driver) comp.select_depts(comp_name, [val]) # 输入文本 col_num = '9' if type == 'user': comp = UserSelectPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '10' if type == 'suggest': comp = SuggestPhonePage(self.driver, (comp_name + '_show')) comp.set_val(val) # 输入文本 col_num = '12' if type == 'reset': comp = ButtonPhonePage(self.driver) comp.click_button('重置') col_num = '3' return col_num
def test_freeflow_complete(self): '''自由流程结束流程''' menu2 = '自由流程' # 主页打开菜单时使用 menu3 = '' title = '自由流程结束流程' self.open_menus(self.menu1, menu2, menu3) fp = FlowPhonePage(self.driver) lp = ListViewPhonePage(self.driver) mp = MainPhonePage(self.driver) bt = ButtonPhonePage(self.driver) us = UserSelectPhonePage(self.driver, 'free_flow') po = LoginPage(self.driver) lp.clear_all_data() # 清空所有数据 bt.click_button('新建') # 点击新建按钮 fp.input_reason(title) # 录入请假原因 bt.click_button('提交') # 点击提交按钮 fp.click_flow_submit_user_avatar() # 点击选择流程审批人 us.select_user_by_name('王聪') bt.click_flowpanel_button('发起') # 提交流程 lp.open_fisrt_doc() # 打开记录 self.assertEqual('王聪', fp.get_curnode_user(), msg=title + '测试不通过') po.user_login('wangcong', '123456') # 切换王聪登陆 mp.switch_to_menu_page() self.open_menus(self.menu1, menu2, menu3) # 打开相应的菜单 lp.open_fisrt_doc() # 打开记录 bt.click_button('结束流程') # 点击提交按钮 bt.click_flowpanel_button('结束') lp.open_fisrt_doc() # 打开记录 fp.click_flow_more() # 点击流程栏更多 self.assertEqual('完成', fp.get_cur_flow_state(), msg=title + '测试不通过') # 检查当前流程状态是不是归档
def test_refresh_recaculate_case(self): '''刷新重计算值脚本''' refresh_name = '用户选择框_刷新' comp1 = UserSelectPhonePage(self.driver, refresh_name) comp1.click_adduser_btn(refresh_name) comp1.add_user_by_name(['王聪', '伟强']) comp1.wait_Tabloading_show_then_hide() recaculate_name = '用户选择框_重计算' comp2 = UserSelectPhonePage(self.driver, recaculate_name) self.assertEqual('王聪;伟强', comp2.get_select_users(recaculate_name), msg='刷新重计算值脚本检验不通过')
def test_desription_case(self): '''描述''' name = '用户选择框_名称' comp = UserSelectPhonePage(self.driver, name) bool = comp.is_desription_effect(name) self.assertTrue(bool, msg=name + '检验不通过')
def test_hide_case(self): '''显示隐藏和条件隐藏''' name = '用户选择框_显示隐藏' comp = UserSelectPhonePage(self.driver, name) bool = comp.is_comp_hide(name) self.assertTrue(bool, msg=name + '检验不通过')
def test_condition_readonly_case(self): '''用户选择框_条件只读''' name = '用户选择框_条件只读' comp = UserSelectPhonePage(self.driver, '') bool = comp.is_comp_readonly(name) self.assertTrue(bool, msg=name + '检验不通过')
def test_readonly_case(self): '''只读判断''' name = '用户选择框_显示只读' comp = UserSelectPhonePage(self.driver, name) bool = comp.is_comp_readonly(name) self.assertTrue(bool, msg=name + '检验不通过')
def test_select_user_byrole_case(self): '''从职务用户中获取用户''' name = '用户选择框_名称' comp = UserSelectPhonePage(self.driver, name) comp.click_adduser_btn(name) comp.switch_role_user_select_page('测试主管') #添加等待loading comp.wait_Tabloading_show_then_hide() comp.add_user_by_name(['伟强']) self.assertIn('伟强', comp.get_select_users(name), msg='从职务中获取用户检验不通过')
def test_select_user_bysearch_case(self): '''从查询中获取用户''' name = '用户选择框_名称' comp = UserSelectPhonePage(self.driver, name) comp.set_val('李玲') self.assertIn('李玲', comp.get_select_users(name), msg='从通讯录中获取用户检验不通过')