def test_001(self): # 跳转流量管家是否正确 traffic = shouyepage.Traffic(driver) try: assert traffic.try_text(shouyepage.Shouye.title_loc) == "流量查询" logging.info('跳转流量查询页面') except: logging.error("跳转流量管家错误") traffic.get_screenshot("跳转流量管家错误") raise
def test_005(self): # 流量商品跳转是否正确 traffic = shouyepage.Traffic(driver) traffic.shangpin() try: assert traffic.try_text(shouyepage.Shouye.title_loc) == "业务" logging.info('流量商品跳转正确') except: logging.error("流量商品跳转错误") traffic.get_screenshot("流量商品跳转错误") raise finally: traffic.back()
def test_003(self): # 流量订单跳转是否正确 traffic = shouyepage.Traffic(driver) traffic.dingdan() try: assert traffic.try_find(shouyepage.Traffic.chongzhi_loc) is True logging.info('流量订单跳转正确') except: logging.error("流量订单跳转错误") traffic.get_screenshot("流量订单跳转错误") raise finally: traffic.back()
def test_002(self): # 分享增加微信快照 traffic = shouyepage.Traffic(driver) traffic.fenxiang() try: assert traffic.try_find(shouyepage.Traffic.kuaizhao_loc) is True logging.info('分享增加微信快照') except: logging.error("分享未增加微信快照") traffic.get_screenshot("分享未增加微信快照") raise finally: traffic.quxiao()
def test_006(self): # 流量详单跳转是否正确 traffic = shouyepage.Traffic(driver) traffic.xiangdan() try: assert traffic.try_find(shouyepage.Traffic.shenfen_loc) is True logging.info('流量详单跳转正确') except: logging.error("流量详单跳转错误") traffic.get_screenshot("流量订单跳转错误") raise finally: traffic = loginpage.Login(driver) traffic.close()
def test_004(self): # 境外流量跳转是否正确 traffic = shouyepage.Traffic(driver) traffic.jingwai() time.sleep(3) try: assert traffic.try_text(shouyepage.Shouye.title_loc) == "国际/港澳台业务" logging.info('境外流量跳转正确') except: logging.error("境外流量跳转错误") traffic.get_screenshot("境外流量跳转错误") raise finally: traffic.back()
def teardown(self): # 每个用例结束返回 traffic = shouyepage.Traffic(driver) traffic.back()
def setup(self): # 每个用例执行进入流量管家 traffic = shouyepage.Traffic(driver) traffic.liuliang()