class TestPromote(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx','smokeTest') def setUp(self): logger.info("------推广链接------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_promote'),'test_promote:off') def test_promote(self): '''推广链接''' login1=LoginPage(self.driver) login1.login() pt=Promote(self.driver) pt.promote() msg=pt.get_text(pt.linkAlert) logger.info("增加推广链接提示信息:%s" %msg) try: self.assertEqual("成功生成推广链接!",msg) except: pt.get_screenshot() self.assertEqual("成功生成推广链接!",msg) time.sleep(3) ln_new=pt.get_text(pt.ln_name) logger.info("\n注册链接名: %s \n生成链接名: %s" %(pt.ln,ln_new)) try: self.assertEqual(pt.ln,ln_new) except: pt.get_screenshot() self.assertEqual(pt.ln,ln_new) def tearDown(self): self.driver.quit()
class TestTraceIcon(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx', 'smokeTest') def setUp(self): logger.info("------追号------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_traceIcon'), 'test_traceIcon:off') def test_traceIcon(self): '''追号:腾讯分分彩-后三-复式''' login1 = LoginPage(self.driver) login1.login() ti = TraceIcon(self.driver) ti.traceIcon() msg = ti.get_text(ti.traceAlert) logger.info("追号提示信息:%s" % msg) try: self.assertEqual("订单提交成功!", msg) except: ti.get_screenshot() self.assertEqual("订单提交成功!", msg) t = ti.turnToSeconds() + 60 logger.info("等待追号:%s秒" % t) time.sleep(t) ti.goto_cp_toaddNumber() ti.click_theFristAddNumberRecord() ti.assert_addNumberStatue() def tearDown(self): self.driver.quit()
class TestWithdraw(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx', 'smokeTest') def setUp(self): logger.info("------提现------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_withdraw'), 'test_withdraw:off') def test_withdraw(self): '''提现''' login1 = LoginPage(self.driver) login1.login() withdraw1 = Withdraw(self.driver) withdraw1.withdraw() msg = withdraw1.getMsg() logger.info("提示信息: %s" % msg) try: self.assertIn("提现申请订单成功", msg) except: withdraw1.get_screenshot() self.assertIn("提现申请订单成功", msg) def tearDown(self): self.driver.quit()
class TestOrderCancel(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx', 'smokeTest') def setUp(self): logger.info("------撤单------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_orderCancel'), 'test_orderCancel:off') def test_orderCancel(self): '''撤单:腾讯分分彩-后三-复式''' login1 = LoginPage(self.driver) login1.login() oc = OrderCancel(self.driver) oc.orderCancel() msg = oc.get_text(oc.alert) logger.info("撤单信息:%s" % msg) try: self.assertEqual("撤单成功", msg) except: oc.get_screenshot() self.assertEqual("撤单成功", msg) time.sleep(4) msg = oc.get_bt_con() logger.info("中奖情况:%s" % msg) try: self.assertEqual("个人撤单", msg) except: oc.get_screenshot() self.assertEqual("个人撤单", msg) def tearDown(self): self.driver.quit()
class TestWBGMmc(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx', 'smokeTest') def setUp(self): logger.info("------秒秒彩下注------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_wbgMmcBetting'), 'test_wbgMmcBetting:off') def test_wbgMmcBetting(self): '''WBG秒秒彩-后三-复式''' login1 = LoginPage(self.driver) login1.login() wbg = WBGMmc(self.driver) wbg.wbgMmcBetting() wbg.click_cancel_btn() lot1 = Lottery(self.driver) lot1.click_theNewestTime() bid1 = lot1.get_bettingId() bet1 = Bet(self.driver) wbg.open_url(wbg.base_url + bet1.url_cpBetting) bet1.click_theFirstTime() bid2 = lot1.get_bettingId() logger.info("\n下注注单号: %s \n生成订单号: %s" % (bid1, bid2)) assert (bid1 == bid2) def tearDown(self): self.driver.quit()
class TestReg(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx', 'smokeTest') def setUp(self): logger.info("------注册------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_reg'), 'test_reg:off') def test_reg(self): '''注册''' login1 = LoginPage(self.driver) login1.login() rg = Reg(self.driver) rg.reg() msg = rg.get_text(rg.regAlert) logger.info("注册提示信息:%s" % msg) try: self.assertEqual("开户成功!", msg) except: rg.get_screenshot() self.assertEqual("开户成功!", msg) def tearDown(self): self.driver.quit()
class TestLotteryDraw(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx', 'smokeTest') def setUp(self): logger.info("------开奖------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_lotteryDraw'), 'test_lotteryDraw:off') def test_lotteryDraw(self): '''开奖:腾讯分分彩-后三-复式''' login1 = LoginPage(self.driver) login1.login() ld = LotteryDraw(self.driver) ld.lotteryDraw() num1 = float(Decimal(ld.get_bonusNum()) * Decimal("0.001")) num2 = ld.get_bonusLater() logger.info("\n奖金组: %s \n中奖额: %s" % (num1, num2)) try: self.assertEqual(num1, num2) except: ld.get_screenshot() self.assertEqual(num1, num2) def tearDown(self): self.driver.quit()
class TestCharge(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx', 'smokeTest') def setUp(self): logger.info("------充值------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_charge'), 'test_charge:off') def test_charge(self): '''充值''' login1 = LoginPage(self.driver) login1.login() charge1 = ChargePage(self.driver) charge1.goto_charge() charge1.charge() text = self.driver.title logger.info("支付渠道:%s" % text) try: self.assertNotIn("摩臣", text) self.assertNotIn("摩登", text) except: charge1.get_screenshot() self.assertNotIn("摩臣", text) self.assertNotIn("摩登", text) def tearDown(self): self.driver.quit()
class TestTransfer(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx','smokeTest') def setUp(self): logger.info("------转账------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_tranfer'),'test_tranfer:off') def test_tranfer(self): '''转账''' login1=LoginPage(self.driver) login1.login() transfer1=TransferPage(self.driver) transfer1.transfer() qbBalance1 = Decimal(transfer1.get_qbBalance()) inBalance1 = Decimal(transfer1.get_inBalance()) logger.info("转出钱包转账前余额:%s" %qbBalance1) logger.info("转入钱包转账前余额:%s" %inBalance1) money = random.randint(20, 30) logger.info("转账金额:%s"%money) transfer1.choiceVisbleDivAndSendMoney(money) transfer1.click_submitNow() transfer1.waitAlertToBeVisible() time.sleep(0.5) msg=transfer1.get_msg() logger.info("提示信息:%s" %msg) try: self.assertEqual(msg,"转账成功") except: transfer1.get_screenshot() self.assertEqual(msg,"转账成功") transfer1.transfer() qbBalance2 = Decimal(transfer1.get_qbBalance()) inBalance2 = Decimal(transfer1.get_inBalance()) logger.info("转出钱包转账后余额:%s" % qbBalance2) logger.info("转入钱包转账后余额:%s" % inBalance2) try: self.assertEqual(qbBalance2,qbBalance1-Decimal(str(money))) self.assertEqual(inBalance2,inBalance1+Decimal(str(money))) except: transfer1.get_screenshot() self.assertEqual(qbBalance2, qbBalance1 - Decimal(str(money))) self.assertEqual(inBalance2, inBalance1 + Decimal(str(money))) def tearDown(self): self.driver.quit()
class TestMmcTeamReport(unittest.TestCase): cases = ReadExcel(sys.path[1] + '\\Data\\TestCaseON-OFF.xlsx','smokeTest') def setUp(self): logger.info("------秒秒彩团队报表------") self.driver = webdriver.Chrome() @unittest.skipUnless(cases.excel_case_switch('test_mmcTeamReport'),'test_mmcTeamReport:off') def test_mmcTeamReport(self): '''秒秒彩团队报表''' login1=LoginPage(self.driver) login1.login() tr=MmcTeamReport(self.driver) tr.check_teamReport() def tearDown(self): self.driver.quit()
class Test_bet(unittest.TestCase): data_path = sys.path[1] + '\\Data\\bet.xlsx' data1 = ReadExcel(data_path,"Sheet1").read_excel() @classmethod def setUpClass(cls): cls.driver = webdriver.Chrome() lg1 = LoginPage(cls.driver) lg1.login() @classmethod def tearDownClass(cls): time.sleep(3) print("\n所有用例运行完成") cls.driver.quit() @data(*data1) def test_bet(cls,data): bet1 =Bet(cls.driver) bet1.wait_to_bet(data)