From c25b25c64ef066aa7c31e31a8908c0172e17a941 Mon Sep 17 00:00:00 2001 From: Eve Martin Date: Wed, 28 Aug 2024 09:58:32 +0000 Subject: [PATCH] fix playthrough test --- game/end_to_end_tests/base_game_test.py | 7 +++++-- game/end_to_end_tests/game_page.py | 11 +++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/game/end_to_end_tests/base_game_test.py b/game/end_to_end_tests/base_game_test.py index aa5c074bb..bf17646b7 100644 --- a/game/end_to_end_tests/base_game_test.py +++ b/game/end_to_end_tests/base_game_test.py @@ -72,8 +72,11 @@ def complete_and_check_level( if final_level: return page if next_episode is None: - page.next_level(from_python_den) - page.assert_level_number(level_number + 1, from_python_den) + if next_level is None: + page.next_level_redirected(from_python_den) + else: + page.next_level(from_python_den) + page.assert_level_number(level_number + 1, from_python_den) else: page.next_episode() page.assert_episode_number(next_episode, from_python_den) diff --git a/game/end_to_end_tests/game_page.py b/game/end_to_end_tests/game_page.py index 9fcfe39ff..3e6ced332 100644 --- a/game/end_to_end_tests/game_page.py +++ b/game/end_to_end_tests/game_page.py @@ -268,6 +268,17 @@ def next_level(self, from_python_den=False): ) return self + def next_level_redirected(self, from_python_den=False): + self.assert_success() + self.browser.find_element(By.ID, "next_level_button").click() + + episodeId = "episode-16" if from_python_den else "episode-1" + + WebDriverWait(self.browser, 10).until( + presence_of_all_elements_located((By.ID, episodeId)) + ) + return self + def _run_failing_program(self, text): self.run_program("try_again_button") error_message = self.browser.find_element(By.ID, "myModal-lead").text