def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.question = QuestionBankPage() cls.filter = FilterPage()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.user_info = UserInfoPage() cls.screen_shot = ScreenShot()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.setting = SettingPage() cls.privacy_clause = PrivacyPage()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.setting = SettingPage() cls.question_feedback = QuestionFeedback()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.setting = SettingPage() cls.protocol = ProtocolPage()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.user_info = UserInfoPage() cls.phone_reset = PhoneReset()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.question = QuestionBankPage() cls.detail = QuestionDetailPage() cls.basket = QuestionBasketPage() cls.collect = CollectionPage()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.user_info = UserInfoPage() cls.change_image = ChangeImage() cls.screen_shot = ScreenShot() cls.base_page = BasePage()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.filter = FilterPage() cls.question = QuestionBankPage() cls.recommend = RecommendPage() cls.release = ReleasePage()
def setUp(cls): """启动应用""" cls.login = TloginPage() cls.home = ThomePage() cls.user = TuserCenterPage() cls.filter = FilterPage() cls.recommend = RecommendPage() cls.question = QuestionBankPage() cls.basket = QuestionBasketPage() cls.detail = QuestionDetailPage()
def logout(self): """退出登录""" self.driver.implicitly_wait(2) ThomePage().click_tab_profile() # 进入首页后点击‘个人中心’按钮 TuserCenterPage().click_setting() # 点击设置按钮 self.logout_button() self.driver.implicitly_wait(2) if TloginPage().wait_check_page(): print('退出登录成功!!!') else: print(' 退出登录失败 ')
def verify_collect_result(self, menu, var): """验证 添加收藏 结果""" if self.wait_check_page(var): ThomePage().click_tab_profile() # 个人中心 if TuserCenterPage().wait_check_page(): TuserCenterPage().click_mine_collect() # 我的收藏 if CollectionPage().wait_check_page(): print('------------------------------------------') print('我的收藏:') FilterPage().all_element() if var == '大题': self.filter_button() # 筛选按钮 if FilterPage().wait_check_page(): FilterPage().click_game_list() # 点击大题 FilterPage().commit_button() # 确定按钮 elif var == '试卷': self.filter_button() # 筛选按钮 if FilterPage().wait_check_page(): CollectionPage().click_test_paper() # 点击试卷 FilterPage().commit_button() # 确定按钮 if CollectionPage().wait_check_page(): item = self.question_name() # 获取 menu1 = item[1][0] if '提分' in menu: menu = menu[:-2] if menu != menu1: print('★★★ Error- 加入收藏失败', menu, menu1) else: for z in range(len(item[0])): print(item[1][z]) if CollectionPage().wait_check_page(): CollectionPage().menu_button(0) # 为了保证脚本每次都可以运行,故将加入收藏的题单取消收藏 time.sleep(1) CollectionPage().cancel_collection() # 取消收藏
def test_assign_paper(self): self.login.app_status() # 判断APP当前状态 if self.home.wait_check_page(): # 页面检查点 self.home.click_tab_question() # 进入首页后 点击 题库tab if self.question.wait_check_page('题单'): # 页面检查点 self.question.filter_button() # 筛选按钮 if FilterPage().wait_check_page(): paper = self.filter.test_paper() if self.filter.selected(paper) == 'false': self.filter.click_test_paper() # 点击 试卷 self.filter.commit_button() # 确定按钮 else: self.filter.commit_button() # 确定按钮 if self.question.wait_check_page('试卷'): # 页面检查点 print('试卷:') item = self.question.question_name() # 获取name if self.question.judge_question_lock(): lock = self.question.question_lock() # 锁定的试卷数 item[0][len(lock)+2].click() # 点击第X个试卷 todo 根据lock数点击未lock的 else: item[0][2].click() # 点击第X个试卷 if self.paper.wait_check_page(): # 页面检查点 title = self.paper_detail_operate() # 试卷详情页 具体操作 self.paper.recommend_button() # 推荐按钮 Toast().find_toast('操作成功') # 获取toast time.sleep(2) self.paper.collect_button() # 收藏按钮 Toast().find_toast('成功加入收藏') # 获取toast time.sleep(2) self.assign_paper_operate() # 布置试卷 具体操作 self.question.verify_collect_result(title, '试卷') # 我的收藏 验证收藏结果 self.question.back_up_button() # 返回按钮 if TuserCenterPage().wait_check_page(): self.home.click_tab_hw() # 返回首页 else: print('未进入题库页面') else: Toast().find_toast(VALID_LOGIN_TOAST.login_failed()) print("未进入主界面")
def back_up(self): """从个人信息页 返回主界面""" self.back_up_button() # 返回按钮 if TuserCenterPage().wait_check_page(): # 页面检查点 ThomePage().click_tab_hw()