def home_link_text(self, expect_value): """ 获取首页链接文本 :return: """ if api.wait_text_equal(self.home_link, expect_value): return True else: api.save_page_img('首页链接文本显示错误') return False
def username_text(self, expect_value): """ 获取导航栏右侧的用户姓名 :return: """ if api.wait_text_equal(self.username, expect_value): return True else: api.save_page_img('首页用户名显示错误') return False
def news_list_item_article_len_gt_0(self): """ 判断新闻列表页选项简介长度是否大于0 :return: """ self.news_list_first_item_name_exist() elements = self.news_list_article_els() for el in elements: el_text = el.text logger().info('新闻列表选项简介:%s' % el_text) if el_text is None or len(el_text) == 0: api.save_page_img('新闻列表选项简介长度等于0') return False return True
def list_text(self): if api.el_is_display(self.unfinish_workflow_list_has_data): text = api.get_text(self.unfinish_workflow_list_has_data) logger().info('待办任务列表选项标题:%s' % text) if len(text) > 0: return True else: return False elif api.get_text( self.unfinish_workflow_list_no_data) == '您的待办已经全部处理完成': return True else: api.save_page_img('待办列表显示错误') return False
def wrapper(self): log.info('*' * 30 + f.__name__ + '*' * 30) log.info('开始执行用例[%s]' % f.__name__) try: f(self) except Exception as e: DriverApi.save_page_img(f.__name__) log.exception(e) self.fail() raise e finally: log.info('执行用例[%s]完成' % f.__name__) log.info('*' * 30 + f.__name__ + '*' * 30) log.info('\n\n')