bitbake: toaster/tests/functional/utils: Handle WebDriverException

Fix the exception handling in the cancel builds function.

This involved adding WebDriverException which sometimes occurs but
also correcting the other exception handlers to continue to increment
the timeout to avoid test hangs.

(Bitbake rev: e111a2bd4f7a8a4dc2c63e94e91ac6cacca95af8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2024-10-22 14:04:57 +01:00
parent 56a8e5283e
commit 6ee37562d4

View File

@@ -8,7 +8,7 @@
from time import sleep from time import sleep
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, TimeoutException from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, TimeoutException, WebDriverException
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from orm.models import Build from orm.models import Build
@@ -66,12 +66,14 @@ def wait_until_build_cancelled(test_instance):
pass pass
if 'cancelled' in str(build_state).lower(): if 'cancelled' in str(build_state).lower():
break break
except NoSuchElementException:
continue
except StaleElementReferenceException:
continue
except TimeoutException: except TimeoutException:
break break
except NoSuchElementException:
pass
except StaleElementReferenceException:
pass
except WebDriverException:
pass
start_time += 1 start_time += 1
sleep(1) # take a breath and try again sleep(1) # take a breath and try again