def setUp(self): self.user_id = 199566 self.passwdus = 11122223333 self.me = 199585 self.passwdme = 11133332222 reduction_non_service_certification_task(self.me) restore_card(self.user_id) self.udid = get_ios_udid() print(self.udid) sleep(3) stop_ios_appium() start_ios_appium(self.udid) # 连接ios设备 self.desired_caps = { 'platformName': 'iOS', 'deviceName': 'iPhone SE', 'device': 'iOS', 'bundleId': 'com.iscs.SmallAnimal', 'version': '9.3', 'udid': self.udid } self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps) sleep(3) LoginPage(self.driver).login(username=self.passwdus, password=123456) # 登录 CardPage(self.driver).click_card_one() # 卡片1 pass
def setUp(self): # 恢复测试数据 release_labor_demand() self.udid = get_ios_udid() stop_ios_appium() start_ios_appium(self.udid) # 连接ios设备 self.desired_caps = { 'platformName': 'iOS', 'deviceName': 'iPhone SE', 'device': 'iOS', 'bundleId': 'com.iscs.SmallAnimal', 'version': '9.3', 'udid': self.udid } self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps) sleep(3) # 登录 LoginPage(self.driver).login(username=13588880000, password=123456) # 登录后手机桌面空白卡片 self.driver.find_element_by_xpath( "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAScrollView[1]" "/UIACollectionView[1]/UIACollectionCell[2]").click() sleep(2) assert is_element_present(self.driver, ('ACCESSIBILITY_ID', '发布劳务需求')) pass
def FUN_TaskHandover(self): if is_element_present(self.driver, ['ACCESSIBILITY_ID', '非服务认证']): CardPage(self.driver).click_non_service_certification_card() # 非服务认证 self.swipe() sleep(5) if is_element_present(self.driver, ['ACCESSIBILITY_ID', 'icon send']) is False: self.swipe() # 移交任务,认证 self.task_handover_instant = TaskHandoverPage(self.driver) self.task_handover_instant.page_factory() self.task_handover_instant.handover() print('移交非服务认证任务') sleep(7) self.driver.quit() self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps) LoginPage(self.driver).login(username=self.passwdine, password=123456) # 登录 CardPage(self.driver).click_card_one() # 卡片1 if is_element_present(self.driver, ['ACCESSIBILITY_ID', '刷新']): sleep(7) CardPage(self.driver).click_f5() # 刷新 sleep(7) CardPage(self.driver).click_f5() # 刷新 sleep(7) CardPage(self.driver).click_f5() # 刷新 if is_element_present(self.driver, ['ACCESSIBILITY_ID', '非服务认证']): CardPage(self.driver).click_non_service_certification_card() # 非服务认证 print('移交非服务认证任务给') self.non_service_certification_instant = NonServiceCertification(self.driver) self.non_service_certification_instant.page_factory() self.non_service_certification_instant.only_one(self.me) self.non_service_certification_instant.submit() sleep(1) # self.tmp2 = [u'拣选商品'.encode('utf-8'), u'打印入库单'.encode('utf-8'), # u'下采购单'.encode('utf-8'), u'非服务认证'.encode('utf-8')] self.driver.quit() self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps) LoginPage(self.driver).login(username=self.passwdme, password=123456) # 登录 CardPage(self.driver).click_card_one() # 卡片1 sleep(2) print('认证通过,获取权限')
def setUp(self): self.user_id = 10000237 self.invitee_id = 1111111003 # 用户账号从10000297变为428, 从迭代二数据结构变化导致的老账号失效 self.admin = 10000428 sleep(3) self.udid = get_ios_udid() stop_ios_appium() start_ios_appium(self.udid) # 连接ios设备 self.desired_caps = {'platformName': 'iOS', 'deviceName': 'iPhone SE', 'device': 'iOS', 'bundleId': 'com.iscs.SmallAnimal', 'version': '9.3', 'udid': self.udid} self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps) sleep(3) #self.get_ui_locator(self.driver) LoginPage(self.driver).login(username=self.admin) # 登录 CardPage(self.driver).click_card_one() # 登入卡片一 pass
def NonServiceCertification002(self): if is_element_present(self.driver, ['ACCESSIBILITY_ID', '非服务认证']): CardPage( self.driver).click_non_service_certification_card() # 非服务认证 self.non_service_certification_instant = NonServiceCertification( self.driver) self.non_service_certification_instant.page_factory() self.non_service_certification_instant.only_one(self.me) self.non_service_certification_instant.submit() sleep(1) print(u'认证通过') self.driver.quit() self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps) LoginPage(self.driver).login(username=self.passwdme, password=123456) # 登录 CardPage(self.driver).click_card_one() # 卡片1 sleep(2) print('认证通过,获取权限') # self.tmp2 = [u'拣选商品'.encode('utf-8'), u'打印入库单'.encode('utf-8'), # u'下采购单'.encode('utf-8'), u'非服务认证'.encode('utf-8')] if is_element_present(self.driver, ['ACCESSIBILITY_ID', '管理者授权']): CardPage(self.driver).manager_authorization_card() # 管理者授权 pass