Fix timeout in ui tests and access_page function

This commit is contained in:
Théophile Diot 2023-10-17 15:27:42 +02:00
parent b1b1ab8680
commit b9c5d32778
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06

View file

@ -130,7 +130,8 @@ def access_page(
*, *,
retries: int = 0, retries: int = 0,
): ):
assert_button_click(driver, button) if retries == 0:
assert_button_click(driver, button)
try: try:
title = driver_wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/div/header/div/nav/h6"))) 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) print(f"Didn't get redirected to {name} page, exiting ...", flush=True)
exit(1) exit(1)
except TimeoutException: except TimeoutException:
if retries < 3 and driver.current_url.split("/")[-1].startswith("/loading"): if retries < 3 and "/loading" in driver.current_url:
sleep(2) sleep(2)
access_page(driver, driver_wait, button, name, message, retries=retries + 1) access_page(driver, driver_wait, button, name, message, retries=retries + 1)