From b9c5d3277851ea143bf2b404b014b5e1b14a6f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Tue, 17 Oct 2023 15:27:42 +0200 Subject: [PATCH] Fix timeout in ui tests and access_page function --- tests/ui/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/ui/main.py b/tests/ui/main.py index 30245083..2d2c749f 100644 --- a/tests/ui/main.py +++ b/tests/ui/main.py @@ -130,7 +130,8 @@ def access_page( *, retries: int = 0, ): - assert_button_click(driver, button) + if retries == 0: + assert_button_click(driver, button) try: title = driver_wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/div/header/div/nav/h6"))) @@ -139,7 +140,7 @@ def access_page( print(f"Didn't get redirected to {name} page, exiting ...", flush=True) exit(1) except TimeoutException: - if retries < 3 and driver.current_url.split("/")[-1].startswith("/loading"): + if retries < 3 and "/loading" in driver.current_url: sleep(2) access_page(driver, driver_wait, button, name, message, retries=retries + 1)