def content(self): try: sleep(2) for i in range(100): try: base.name_click(Energy.cp.get('energy', 'energy')) break except BaseException: Energy.DropDown.dropDown() l = len( base.driver.find_elements_by_id( 'com.facilityone.product.shang:id/enery_task_detail_item_name_tv' )) i = 1 for i in range(int(l)): try: base.id_click_number( 'com.facilityone.product.shang:id/enery_task_detail_item_name_tv', int(i)) except BaseException: Energy.DropDown.dropDown() base.id_click_number( 'com.facilityone.product.shang:id/enery_task_detail_item_name_tv', int(i)) base.id_sendkey( 'com.facilityone.product.shang:id/enerty_write_taks_result_et', i) base.name_click('保存') sleep(3) base.class_name_click_number('android.widget.LinearLayout', 3) except BaseException: self.assertEqual(0, 1, "能源模块,抄表测试未通过")
def close(self): try: base.name_click('关闭') base.name_click('确定') Refunds.Returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "缴费单查询模块,关闭测试未通过")
def activity(self,manage): for i in range(100): try: base.name_click(manage) break except BaseException: Management.DropDown.dropDown()
def completed(self): try: base.driver.implicitly_wait(300) completed.click.click() base.driver.implicitly_wait(0) base.name_click('处理完成') except BaseException: self.assertEqual(0, 1, "工单待处理模块,完成测试未通过")
def Archive(self): try: base.driver.implicitly_wait(300) base.id_click('com.facilityone.product.shang:id/actionbar_right_handle_ll') base.driver.implicitly_wait(0) base.name_click('存档') except BaseException: self.assertEqual(0, 1, "工单待存档模块,存档测试未通过")
def refuse(self, base): try: base.id_click( 'com.facilityone.product.shang:id/actionbar_right_handle_ll') base.name_click('取消出库') StorageOut.returnpage.returnpage(base) except BaseException: self.assertEqual(0, 1, "库存出库模块,取消出库测试未通过")
def archive(self): try: Management.click.click() sleep(2) base.name_click('存档') sleep(2) Management.Returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "合同模块,存档测试未通过")
def con(self): try: sleep(3) base.driver.implicitly_wait(300) completed.click.click() base.driver.implicitly_wait(0) base.name_click('继续工作') except BaseException: self.assertEqual(0, 1, "工单待处理模块,继续工作测试未通过")
def Reject(self): try: base.id_sendkey( 'com.facilityone.product.shang:id/adjust_inventory_batch_num_et', '不通过' + str(Unapproved.i)) base.name_click('不通过') Unapproved.returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "库存审核模块,审核不通过测试未通过")
def refuse(self): Unapproved.click.click() base.name_click('审批') base.id_sendkey( 'com.facilityone.product.shang:id/work_order_verify_content_et', '审批不通过') base.id_click( 'com.facilityone.product.shang:id/work_order_verify_cancel_btn') Unapproved.returnpage.returnpage()
def recovery(self): try: Management.click.click() i = random.randint(0, 1000) base.name_click('恢复') base.id_sendkey('com.facilityone.product.shang:id/adjust_inventory_batch_num_et', '恢复' + str(i)) base.id_click('com.facilityone.product.shang:id/inventory_pass_btn') Management.Returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "合同模块,恢复测试未通过")
def close(self): try: base.name_click('关闭') base.id_sendkey( 'com.facilityone.product.shang:id/work_order_verify_content_et', '缴费关闭') base.id_click( 'com.facilityone.product.shang:id/work_order_verify_sure_btn') except BaseException: self.assertEqual(0, 1, "已缴费单模块,关闭测试未通过")
def verifyF(self): try: i = random.randint(0, 1000) base.driver.implicitly_wait(300) base.id_click('com.facilityone.product.shang:id/actionbar_right_handle_ll') base.driver.implicitly_wait(0) base.name_click('验证') base.id_sendkey('com.facilityone.product.shang:id/work_order_verify_content_et', '验证不通过' + str(i)) base.name_click('拒绝') except BaseException: self.assertEqual(0, 1, "工单待存档模块,验证不通过测试未通过")
def Pass(self): try: Unapproved.click.click() base.name_click('审批') base.id_sendkey( 'com.facilityone.product.shang:id/work_order_verify_content_et', '审批通过一下') base.id_click( 'com.facilityone.product.shang:id/work_order_verify_sure_btn') Unapproved.returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "服务台待审批模块,审批通过测试未通过")
def Read(self,title): base.name_click('已读') i = 0 while i <= 100: try: base.name_click(title) break except BaseException: Affiche.DropDown.dropDown() i = i + 1 Affiche.ReturnPage.returnpag() Affiche.ReturnPage.returnpage()
def invalid(self): try: base.name_click('作废') i = random.randint(0, 1000) base.id_sendkey( 'com.facilityone.product.shang:id/work_order_verify_content_et', '作废' + str(i)) base.id_click( 'com.facilityone.product.shang:id/work_order_verify_sure_btn') Unpaid.Returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "待缴费单模块,作废测试未通过")
def create(self, source): try: cp = configparser.SafeConfigParser() cp.read('base.ini', encoding='utf-8') phone = base.id_text( 'com.facilityone.product.shang:id/edit_item_content_et') if phone == "" or phone is None: base.id_sendkey( 'com.facilityone.product.shang:id/edit_item_content_et', '15042540563') phone = '15042540563' base.id_click( 'com.facilityone.product.shang:id/report_department_ll') base.id_sendkey( 'com.facilityone.product.shang:id/search_edit_text', cp.get('workorder', 'department')) base.id_click( 'com.facilityone.product.shang:id/report_select_item_rl') try: base.name_click('确定') except BaseException: print('只有一级部门') if source == '工单': base.id_click( 'com.facilityone.product.shang:id/report_position_ll') base.id_sendkey( 'com.facilityone.product.shang:id/search_edit_text', cp.get('workorder', 'location')) base.id_click( 'com.facilityone.product.shang:id/report_select_item_rl') try: base.name_click('确定') except BaseException: print('只有一级位置') base.id_click( 'com.facilityone.product.shang:id/report_service_type_ll') base.id_sendkey( 'com.facilityone.product.shang:id/search_edit_text', cp.get('workorder', 'type')) base.id_click( 'com.facilityone.product.shang:id/report_select_item_rl') try: base.name_click('确定') except BaseException: print('只有一级服务类型') base.id_click( 'com.facilityone.product.shang:id/report_priority_ll') base.id_click( 'com.facilityone.product.shang:id/report_select_item_rl') priority = base.id_text( 'com.facilityone.product.shang:id/edit_item_content_tv') WCreated.DropDown.dropDown() i = random.randint(0, 1000) if source == '工单': base.name_sendkey('请输入内容', '测试描述' + str(i)) base.name_click('提交') if source == '工单': return '测试描述' + str(i) except BaseException: self.assertEqual(0, 1, "工单创建模块,测试未通过")
def assign(self): try: sleep(3) cp = configparser.SafeConfigParser() cp.read('base.ini', encoding='utf-8') try: base.name_click('派工') except BaseException: base.driver.implicitly_wait(300) assigned.click.click() base.driver.implicitly_wait(0) # 设置预计时间 base.name_click('派工') # base.id_click('com.facilityone.product.shang:id/home_work_order_arrange_begin_time_ll') # base.name_click('确定') # StartTime=base.id_text('com.facilityone.product.shang:id/edit_item_content_tv') # base.id_click('com.facilityone.product.shang:id/home_work_order_arrange_end_time_ll') # base.name_click('确定') # EndTime=base.id_text('com.facilityone.product.shang:id/edit_item_content_tv') base.id_click('com.facilityone.product.shang:id/apply_approval_person_add_btn') base.id_sendkey('com.facilityone.product.shang:id/search_edit_text', cp.get('login', 'realname')) base.id_click('com.facilityone.product.shang:id/person_search_person_item_select_status_cb') sleep(1) base.name_click('确定') i = random.randint(0, 1000) base.id_sendkey('com.facilityone.product.shang:id/send_wo_content_et', '派发内容测试' + str(i)) base.name_click('派工') except BaseException: self.assertEqual(0, 1, "工单待派工模块,派工测试未通过")
def Return(self): try: sleep(3) try: base.name_click('退单') except BaseException: base.driver.implicitly_wait(300) completed.click.click() base.driver.implicitly_wait(0) base.name_click('退单') i = random.randint(0, 1000) base.id_sendkey('com.facilityone.product.shang:id/work_order_verify_content_et', '退单原因' + str(i)) sleep(1) base.id_click('com.facilityone.product.shang:id/work_order_verify_sure_btn') except BaseException: self.assertEqual(0, 1, "工单待处理模块,退单测试未通过")
def complete(self, no): try: try: uncompleted.click.click() except BaseException: base.name_click(no) uncompleted.click.click() base.name_click(u'完成') try: detail = base.id_text( 'com.facilityone.product.shang:id/actionbar_title_tv') if detail == "需求详情": print('该需求存在工单未完成') uncompleted.Returnpage.returnpage() except BaseException: print('需求已完成') except BaseException: self.assertEqual(0, 1, "待处理需求模块,完成测试未通过")
def project(self): try: cp = configparser.SafeConfigParser() cp.read('E:\\app\\base.ini', encoding='utf-8') sleep(1) try: base.class_name_sendkey('android.widget.EditText', cp.get('project', 'proj')) except BaseException: try: base.id_click('com.facilityone.product.shang:id/msg_fm_header_title_tv') except BaseException: base.name_click('消息') base.id_click('com.facilityone.product.shang:id/msg_fm_header_title_tv') base.class_name_sendkey('android.widget.EditText', cp.get('project', 'proj')) base.id_click('com.facilityone.product.shang:id/content_rl') sleep(5) except BaseException: self.assertEqual(0, 1, "选择项目,测试未通过")
def wo(self, no): try: # 创建工单 cp = configparser.SafeConfigParser() cp.read('base.ini', encoding='utf-8') try: uncompleted.click.click() except BaseException: base.name_click(no) uncompleted.click.click() sleep(2) base.name_click(u'生成工单') # 信息未验证 uncompleted.woCreate.create('需求') uncompleted.Returnpage.returnpage() sleep(1) uncompleted.Returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "待处理需求模块,需求创建工单测试未通过")
def reserved(self, base, no): try: cp = configparser.SafeConfigParser() cp.read('base.ini', encoding='utf-8') try: base.name_click(no) except BaseException: for StorageOut.i in range(10000): n = 1 StorageOut.DropDown.dropDown(base) try: base.name_click(no) break except BaseException: n = n + 1 StorageOut.DropDown.dropDown(base) base.name_click('请选择领用人') base.driver.implicitly_wait(300) base.id_sendkey( 'com.facilityone.product.shang:id/search_edit_text', cp.get('login', 'realname')) base.class_name_click_number('android.widget.RelativeLayout', 1) base.driver.implicitly_wait(0) except BaseException: self.assertEqual(0, 1, "库存出库模块,预定出库测试未通过")
def delivery(self, base): try: base.id_click( 'com.facilityone.product.shang:id/ll_book_details_order_number' ) number = base.id_text( 'com.facilityone.product.shang:id/book_num_tv') StorageOut.DropDown.dropDown(base) sleep(2) base.driver.find_element_by_xpath( '/hierarchy/android.widget.FrameLayout/cn.bingoogolapple.swipebacklayout.BGASwipeBackLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout[1]' ).click() sleep(2) base.id_sendkey( 'com.facilityone.product.shang:id/adjust_inventory_batch_num_et', number) base.name_click('确定') sleep(2) base.name_click('确定') base.id_click( 'com.facilityone.product.shang:id/actionbar_right_handle_ll') base.name_click('出库') StorageOut.returnpage.returnpage(base) except BaseException: self.assertEqual(0, 1, "库存出库模块,预定出库测试未通过")
def download(self): try: try: base.name_click(u'我的') except BaseException: print('当前页面就是“我的”页面') # 是否存在离线数据没有判断, base.name_click(u'离线下载') base.class_name_click('android.widget.Button') # s=base.class_name_text('android.widget.TextView') s = {} for i in range(8): s[i] = base.driver.find_elements_by_id( 'com.facilityone.product.shang:id/outline_data_item_new_tv' )[i].text source = '未下载' if source in s: print('存在未下载状态') else: base.id_click( 'com.facilityone.product.shang:id/actionbar_back_ll') except BaseException: self.assertEqual(0, 1, "离线下载,测试未通过")
def change(self): try: sleep(2) base.name_click(Energy.cp.get('energy', 'energy')) l = len( base.driver.find_elements_by_id( 'com.facilityone.product.shang:id/enery_task_detail_item_name_tv' )) i = 1 for i in range(int(l)): try: base.id_click_number( 'com.facilityone.product.shang:id/enery_task_detail_item_name_tv', int(i)) except BaseException: Energy.DropDown.dropDown() base.id_click_number( 'com.facilityone.product.shang:id/enery_task_detail_item_name_tv', int(i)) base.id_click( 'com.facilityone.product.shang:id/energy_write_change_sb') base.id_click( 'com.facilityone.product.shang:id/confirm_button') base.id_sendkey( 'com.facilityone.product.shang:id/enerty_write_taks_result_et', i) base.id_sendkey( 'com.facilityone.product.shang:id/energy_change_meter_multi_et', 2) base.id_sendkey( 'com.facilityone.product.shang:id/energy_change_meter_value_et', int(int(i) + 1)) base.name_click('保存') base.class_name_click_number('android.widget.LinearLayout', 3) except BaseException: self.assertEqual(0, 1, "能源模块,换表测试未通过")
def asset(self): try: try: base.name_click(u'资产') except BaseException: base.name_click(u'工作') base.name_click(u'资产') Asset.DropDown.dropDown() base.id_click('com.facilityone.product.shang:id/ll') except BaseException: self.assertEqual(0, 1, "资产模块,进入详情测试未通过")
def acceptReject(self): try: Management.click.click() i = random.randint(0, 1000) base.name_click('验收') base.id_sendkey('com.facilityone.product.shang:id/multi_input_content_et', '验收不通过' + str(i)) base.name_click('验收') sleep(2) base.name_click('不通过') Management.Returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "合同模块,验收不通过测试未通过")
def apply(self): try: sleep(3) cp = configparser.SafeConfigParser() cp.read('base.ini', encoding='utf-8') try: base.name_click('审批申请') except BaseException: base.driver.implicitly_wait(300) completed.click.click() base.driver.implicitly_wait(0) base.name_click('审批申请') i = random.randint(0, 1000) base.id_sendkey('com.facilityone.product.shang:id/multi_input_content_et', '审批事由' + str(i)) base.id_click('com.facilityone.product.shang:id/apply_approval_person_add_btn') base.id_sendkey('com.facilityone.product.shang:id/search_edit_text', cp.get('login', 'realname')) base.id_click('com.facilityone.product.shang:id/person_search_person_item_select_status_cb') base.name_click('确定') base.name_click('提交') except BaseException: self.assertEqual(0, 1, "工单待处理模块,审批申请测试未通过")
def refund(self): try: base.name_click('退款') phone = base.id_text( 'com.facilityone.product.shang:id/edit_item_content_et') if phone == "" or phone == None: base.id_sendkey( 'com.facilityone.product.shang:id/edit_item_content_et', '15542540563') Paid.DropDown.dropDown() Paid.DropDown.dropDown() base.id_sendkey( 'com.facilityone.product.shang:id/multi_input_content_et', '退款') base.driver.tap([(102, 1114)], 1) base.name_click('从相册中选择') base.id_click('com.facilityone.product.shang:id/cb_photo_lpsi') base.name_click('确定') base.name_click('提交') Paid.Returnpage.returnpage() except BaseException: self.assertEqual(0, 1, "已缴费单模块,退款测试未通过")