aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster
diff options
context:
space:
mode:
authorAlassane Yattara <alassane.yattara@savoirfairelinux.com>2024-01-09 14:54:06 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-10 13:54:35 +0000
commitb0de2a61d14fbf30e338751b285b3bab80192275 (patch)
treecbf4899e7192f4be62f490c6cbf0f487d3a8a0a9 /lib/toaster
parent664de3f6d3484b94f5d82ec634b512b825553aa9 (diff)
downloadbitbake-b0de2a61d14fbf30e338751b285b3bab80192275.tar.gz
toaster/tests: Setup delay after driver action self.get(url)
Recurring test failures result from insufficient delays in driver actions. Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster')
-rw-r--r--lib/toaster/tests/browser/selenium_helpers_base.py7
-rw-r--r--lib/toaster/tests/browser/test_all_builds_page.py4
-rw-r--r--lib/toaster/tests/browser/test_builddashboard_page.py1
-rw-r--r--lib/toaster/tests/browser/test_new_custom_image_page.py1
4 files changed, 12 insertions, 1 deletions
diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py
index 562fedec8..393be7549 100644
--- a/lib/toaster/tests/browser/selenium_helpers_base.py
+++ b/lib/toaster/tests/browser/selenium_helpers_base.py
@@ -182,6 +182,13 @@ class SeleniumTestCaseBase(unittest.TestCase):
abs_url = '%s%s' % (self.live_server_url, url)
self.driver.get(abs_url)
+ try: # Ensure page is loaded before proceeding
+ self.wait_until_visible("#global-nav", poll=3)
+ except NoSuchElementException:
+ self.driver.implicitly_wait(3)
+ except TimeoutException:
+ self.driver.implicitly_wait(3)
+
def find(self, selector):
""" Find single element by CSS selector """
return self.driver.find_element(By.CSS_SELECTOR, selector)
diff --git a/lib/toaster/tests/browser/test_all_builds_page.py b/lib/toaster/tests/browser/test_all_builds_page.py
index 7019b3dbe..ab6da821b 100644
--- a/lib/toaster/tests/browser/test_all_builds_page.py
+++ b/lib/toaster/tests/browser/test_all_builds_page.py
@@ -224,6 +224,7 @@ class TestAllBuildsPage(SeleniumTestCase):
url = reverse('all-builds')
self.get(url)
+ self.wait_until_visible('#allbuildstable', poll=3)
# get the project name cells from the table
cells = self.find_all('#allbuildstable td[class="project"]')
@@ -232,7 +233,7 @@ class TestAllBuildsPage(SeleniumTestCase):
for cell in cells:
content = cell.get_attribute('innerHTML')
- help_icons = cell.find_elements_by_css_selector(selector)
+ help_icons = cell.find_elements(By.CSS_SELECTOR, selector)
if re.search(self.PROJECT_NAME, content):
# no help icon next to non-cli project name
@@ -256,6 +257,7 @@ class TestAllBuildsPage(SeleniumTestCase):
url = reverse('all-builds')
self.get(url)
+ self.wait_until_visible('#allbuildstable', poll=3)
# test recent builds area for successful build
element = self._get_build_time_element(build1)
diff --git a/lib/toaster/tests/browser/test_builddashboard_page.py b/lib/toaster/tests/browser/test_builddashboard_page.py
index b713f3003..d838ce363 100644
--- a/lib/toaster/tests/browser/test_builddashboard_page.py
+++ b/lib/toaster/tests/browser/test_builddashboard_page.py
@@ -162,6 +162,7 @@ class TestBuildDashboardPage(SeleniumTestCase):
"""
url = reverse('builddashboard', args=(build.id,))
self.get(url)
+ self.wait_until_visible('#global-nav', poll=3)
def _get_build_dashboard_errors(self, build):
"""
diff --git a/lib/toaster/tests/browser/test_new_custom_image_page.py b/lib/toaster/tests/browser/test_new_custom_image_page.py
index 4ad22c7aa..9f0b6397f 100644
--- a/lib/toaster/tests/browser/test_new_custom_image_page.py
+++ b/lib/toaster/tests/browser/test_new_custom_image_page.py
@@ -90,6 +90,7 @@ class TestNewCustomImagePage(SeleniumTestCase):
"""
url = reverse('newcustomimage', args=(self.project.id,))
self.get(url)
+ self.wait_until_visible('#global-nav', poll=3)
self.click('button[data-recipe="%s"]' % self.recipe.id)