From d528bc808e6b7dbdfc23fcd85adef13f2468d349 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 22 Apr 2024 12:37:06 -0400 Subject: [PATCH] Add retries around some 'test -t auto' intermittent failures. --- tools/autotest.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/autotest.py b/tools/autotest.py index 2aead948..86320ebb 100755 --- a/tools/autotest.py +++ b/tools/autotest.py @@ -56,7 +56,13 @@ try: wait.until(expected_conditions.presence_of_element_located((By.ID, 'create_id'))).click() driver.switch_to.alert.accept() - id0 = wait.until(expected_conditions.presence_of_element_located((By.TAG_NAME, 'li'))).text.split(' ')[-1] + # StaleElementReferenceException + while True: + try: + id0 = wait.until(expected_conditions.presence_of_element_located((By.TAG_NAME, 'li'))).text.split(' ')[-1] + break + except: + pass wait.until(expected_conditions.presence_of_element_located((By.XPATH, '//li/button[text()="Export Identity"]'))).click() driver.switch_to.default_content() wait.until(expected_conditions.presence_of_element_located((By.XPATH, '//button[text()="✅ Allow"]'))).click() @@ -115,7 +121,13 @@ try: wait.until(expected_conditions.presence_of_element_located((By.ID, 'content'))) - driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.LINK_TEXT, 'logout testuser').click() + # NoSuchElementException + while True: + try: + driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.LINK_TEXT, 'logout testuser').click() + break + except: + pass driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'guest_label').click() driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'guestButton').click()