def setup_class(self): self.dev = webdriver.Chrome() self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) self.loggerobj = Logger().get_logger() self.answerobj = Mtx_Answers(self.dev) self.loggerobj.info('初始化')
class Test_Answers(): def setup_class(self): self.dev = webdriver.Chrome() self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) self.loggerobj = Logger().get_logger() self.answerobj = Mtx_Answers(self.dev) self.loggerobj.info('初始化') def test_login(self): try: self.loginobj.login() self.loggerobj.info('登录成功') except Exception as e: self.loggerobj.warn(f'出错{e}') def test_goto_answers(self): try: self.leftobj.myshopt() self.leftobj.answers() self.loggerobj.info('页面跳转') except Exception as e: self.loggerobj.warn(f'出错了{e}') def test_answers(self): try: self.answerobj.answers() self.loggerobj.info('问答页面') except Exception as e: self.loggerobj.warn(f'出错了{e}') def teardown_class(self): self.dev.quit()
class Test_Footstep(): def setup_class(self): self.dev = webdriver.Chrome() self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) self.logerobj = Logger().get_logger() self.footobj = Mtx_Footstep(self.dev) self.logerobj.info("初始化") def test_login(self): self.loginobj.login() self.logerobj.info("登录") def test_goto_foot(self): self.leftobj.myshopt() self.leftobj.footstep() self.logerobj.info("足迹页面") def test_footstep(self): self.footobj.footstep() self.logerobj.info("足迹搜索") def teardown_class(self): self.dev.quit()
class Test_Orderlater(): def setup_class(self): self.dev = webdriver.Chrome() self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) self.ordobj = Mtx_OrderLater(self.dev) self.loggerobj = Logger().get_logger() self.loggerobj.info('初始化') def test_login(self): try: self.loginobj.login() self.loggerobj.info("登录成功") except Exception as e: self.loggerobj.error(f"异常模块提示{e}") def test_goto_orderlate(self): try: self.leftobj.myshopt() self.leftobj.order_later() self.loggerobj.info("页面跳转") except Exception as e: self.loggerobj.error(f'错误信息提示{e}') def test_orderlate(self): try: self.ordobj.later_searcher() self.loggerobj.info("售后模块正常") except Exception as e: self.loggerobj.error(f'异常处理{e}') def teardown_class(self): self.dev.quit()
def setup_class(self): self.dev = webdriver.Chrome() self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) self.logerobj = Logger().get_logger() self.footobj = Mtx_Footstep(self.dev) self.logerobj.info("初始化")
class Test_Address(): def setup_class(self): self.dev = webdriver.Chrome() self.adrobj = Mtx_Address(self.dev) self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) def test_login(self): self.loginobj.login() def test_goto_address(self): self.leftobj.myshopt() self.leftobj.myaddress() def test_case_1(self): # name = self.adrobj.address() # eles = self.adrobj.dev.find_elements_by_xpath("//span[@class='user']") # lst = [] # for i in eles: # lst.append(i.text) # print(lst) # assert name in lst self.adrobj.address() def teardown_class(self): self.adrobj.dev.quit()
def setup_class(self): self.dev = webdriver.Chrome() self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) self.ordobj = Mtx_OrderLater(self.dev) self.loggerobj = Logger().get_logger() self.loggerobj.info('初始化')
class Test_Myjifen(): def setup_class(self): self.dev = webdriver.Chrome() self.loggerobj = Logger().get_logger() self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) self.jifenobj = Mtx_Myjifen(self.dev) self.loggerobj.info("初始化") def test_login(self): self.loginobj.login() self.loggerobj.info("登录") def test_goto_jifen(self): self.leftobj.myshopt() self.leftobj.myjifen() self.loggerobj.info("积分页面") def test_search(self): self.jifenobj.jifen_search() self.loggerobj.info("搜索") def test_search_condition(self): self.jifenobj.jifen_clear() self.jifenobj.jifen_search_condition() self.loggerobj.info("搜索条件") def teardown_class(self): self.dev.quit() self.loggerobj.info("退出")
def setup_class(self): self.dev = webdriver.Chrome() self.loggerobj = Logger().get_logger() self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev) self.jifenobj = Mtx_Myjifen(self.dev) self.loggerobj.info("初始化")
class Test_Login(): def setup_class(self): dev = webdriver.Chrome() self.logobj = Mtx_Login(dev) #正向case @pytest.mark.parametrize('account,pwd', [('zhang', '123456')]) def test_case1(self, account, pwd): self.logobj.login(account, pwd) path = f"//div[@class='menu-hd']/em[contains(text(),{account})]" # assert self.logobj.mtx_find_xpath(path) if pytest.assume(self.logobj.mtx_find_xpath(path)): Logger().get_logger().info('success') else: Logger.get_logger().info('faile') def teardown_class(self): self.logobj.dev.quit()
class Test_Order(): def setup_class(self): self.dev = webdriver.Chrome() self.loginobj = Mtx_Login(self.dev) self.loggerobj = Logger().get_logger() self.orderobj = Mtx_Order(self.dev) self.leftobj = Mtx_Left(self.dev) def test_login(self): self.loggerobj.info("登录") self.loginobj.login() def test_goto_order(self): self.loggerobj.info("跳转到订单页面") self.leftobj.myshopt() self.leftobj.order() def test_order(self): self.loggerobj.info("订单条件处理") self.orderobj.search_condition() def teardown_class(self): self.dev.quit()
def setup_class(self): self.dev = webdriver.Chrome() self.adrobj = Mtx_Address(self.dev) self.loginobj = Mtx_Login(self.dev) self.leftobj = Mtx_Left(self.dev)
def setup_class(self): dev = webdriver.Chrome() self.logobj = Mtx_Login(dev)