def traverseGameList(game_list, needClickRigt=False): for game in game_list: if not BaseCase.gameIsAutoReady(self, game) and BaseCase.enterGame(self, game, needClickRigt): gameId = game.get_attribute("name") hasChangeBtn = True for i in range(0,5): try: self.game_page.wait_element("换桌").click() if i != 4: time.sleep(6) except: self.assert_equal(gameId+" 游戏没有找到换桌按钮", True, False) hasChangeBtn = False # self.game_page.screenshot(gameId + "_noChangeTableBtn.png") break if hasChangeBtn: if not self.game_page.element_is_exist("准备", 30): self.assert_equal(gameId+" 多次点击换桌按钮后准备按钮消失", True, False) else: self.game_page.wait_element("准备").click() self.game_page.screenshot(gameId + "_readyAfterContinuousChangeTable.png") BaseCase.gameToHall(self)
def traverseGameList(game_list, needClickRigt=False): for game in game_list: if not BaseCase.gameIsAutoReady(self, game) and BaseCase.enterGame(self, game, needClickRigt): gameId = game.get_attribute("name") if not self.game_page.element_is_exist("准备"): self.assert_equal(gameId+"游戏没有找到准备按钮", True, False) else: self.game_page.screenshot(gameId + "_intoTheRoom.png") BaseCase.gameToHall(self)
def run_test(self): def traverseGameList(game_list, needClickRigt=False): for game in game_list: if not BaseCase.gameIsAutoReady(self, game) and BaseCase.enterGame(self, game, needClickRigt): gameId = game.get_attribute("name") if not self.game_page.element_is_exist("准备"): self.assert_equal(gameId+"游戏没有找到准备按钮", True, False) else: time.sleep(60) self.game_page.screenshot(gameId + "_after60sNotReady.png") BaseCase.gameToHall(self) BaseCase.test(self, traverseGameList)
def traverseGameList(game_list, needClickRigt=False): for game in game_list: if not BaseCase.gameIsAutoReady(self, game) and BaseCase.enterGame(self, game, needClickRigt): gameId = game.get_attribute("name") try: self.game_page.wait_element("准备").click() if self.game_page.element_is_exist("准备", 2): self.assert_equal(gameId+" 点击准备按钮没有准备", True, False) else: self.game_page.screenshot(gameId + "_afterClickReady.png") except: self.assert_equal(gameId+" 游戏没有找到准备按钮", True, False) # self.game_page.screenshot(gameId + "_noReadBtn.png") BaseCase.gameToHall(self)
def traverseGameList(game_list, needClickRigt=False): for game in game_list: if not BaseCase.gameIsAutoReady(self, game) and BaseCase.enterGame(self, game, needClickRigt): gameId = game.get_attribute("name") try: changeBtn = self.game_page.wait_element("换桌") time.sleep(1) changeBtn.click() if not self.game_page.element_is_exist("准备", 30): self.assert_equal(gameId+" 点击换桌按钮后准备按钮消失", True, False) else: self.game_page.screenshot(gameId + "_changeTableBeforeReady.png") except: self.assert_equal(gameId+" 游戏没有找到换桌按钮", True, False) # self.game_page.screenshot(gameId + "_noChangeTableBtn.png") BaseCase.gameToHall(self)
def traverseGameList(game_list, needClickRigt=False): for game in game_list: if not BaseCase.gameIsAutoReady(self, game) and BaseCase.enterGame(self, game, needClickRigt): gameId = game.get_attribute("name") if not self.game_page.element_is_exist("准备"): self.assert_equal(gameId+" 进入房间没有准备按钮", True, False) else: time.sleep(15) try: self.game_page.wait_element("换桌").click() if not self.game_page.element_is_exist("准备", 30): self.assert_equal(gameId+" 假房间内换桌后不存在准备按钮", True, False) else: self.game_page.screenshot(gameId + "_fakeRoomReady.png") except: self.assert_equal(gameId+" 15S不准备后,没有换桌按钮", True, False) BaseCase.gameToHall(self)
def run_test(self): def traverseGameList(game_list, needClickRigt=False): for game in game_list: if not BaseCase.gameIsAutoReady(self, game) and BaseCase.enterGame(self, game, needClickRigt): gameId = game.get_attribute("name") try: self.game_page.wait_element("准备").click() try: self.game_page.wait_element("换桌").click() if self.game_page.element_is_exist("准备", 2): self.assert_equal(gameId+" 点击准备后换桌准备又出现", True, False) else: self.game_page.screenshot(gameId + "_afterReadyChangeTable.png") except: self.assert_equal(gameId+" 游戏没有找到换桌按钮", True, False) except: self.assert_equal(gameId+" 游戏没有找到准备按钮", True, False) BaseCase.gameToHall(self) BaseCase.test(self, traverseGameList)
def pre_test(self): BaseCase.pre_test(self)
def post_test(self): BaseCase.post_test(self)