def setUp(self): self.browser = webdriver.Chrome( executable_path="../../lib/chromedriver.exe") self.common = Common(self.browser) self.common.start() self.daf = DirAndFiles() self.common.loading_pass()
self.common.landscape() target_line_num = self.common.setting_view_line_num() self.common.setting_view_line_cost_min_btn_click() sleep(1) info_bar_line_num = self.common.info_bar_view_line_num_label() info_bar_line_cost = self.common.info_bar_view_line_cost_label() info_bar_bet_money = self.common.info_bar_view_bet_money_label() bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:]) target_bet_money = "¥" + locale.format("%.2f", bet_money, 1) target_line_cost = self.common.setting_view_line_cost() try: self.assertEqual(info_bar_line_num, target_line_num, "横竖屏切换,点击线注 - 按钮,线数会改变!") self.assertEqual(info_bar_line_cost, target_line_cost, "横竖屏切换,点击线注 - 按钮,设置窗口的线注与下导航栏的不一致!") self.assertEqual(info_bar_bet_money, target_bet_money, "横竖屏切换,点击线注 - 按钮,总赌注数值错误!") except AssertionError: self.daf.get_screenshot(self.browser) raise if __name__ == "__main__": # 启动测试时创建文件夹 DirAndFiles().create_dir() unittest.main()
def setUp(self): self.browser = webdriver.Chrome(executable_path="../../lib/chromedriver.exe") self.browser.get("https://www.baidu.com") self.daf = DirAndFiles()
def setUp(self): self.browser = webdriver.Chrome(executable_path="../../lib/chromedriver.exe") self.common = Common(self.browser) self.common.get_lobby() self.common.login() self.daf = DirAndFiles()