From: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
To: bitbake-devel@lists.openembedded.org
Cc: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Subject: [PATCH v4 1/4] toaster/test: Setup delay after drvier action self.get(url)
Date: Tue, 9 Jan 2024 17:30:31 +0100 [thread overview]
Message-ID: <20240109163034.534593-1-alassane.yattara@savoirfairelinux.com> (raw)
Recurring test failures result from insufficient delays in driver actions.
Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
lib/toaster/tests/browser/selenium_helpers_base.py | 7 +++++++
lib/toaster/tests/browser/test_all_builds_page.py | 4 +++-
lib/toaster/tests/browser/test_builddashboard_page.py | 1 +
lib/toaster/tests/browser/test_new_custom_image_page.py | 1 +
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py
index 562fedec..393be754 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 7019b3db..ab6da821 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 b713f300..d838ce36 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 4ad22c7a..9f0b6397 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)
--
2.34.1
next reply other threads:[~2024-01-09 16:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 16:30 Alassane Yattara [this message]
2024-01-09 16:30 ` [PATCH v4 2/4] toaster/test: bug-fix "#hint-error-project-name" should be visible Alassane Yattara
2024-01-09 16:30 ` [PATCH v4 3/4] toaster/test: Bug-fix "element not interactable" in TestLayerDetailsPage::test_edit_layerdetails Alassane Yattara
2024-01-09 16:30 ` [PATCH v4 4/4] toaster/test: Bug-fix ToasterTable show_rows testcases Alassane Yattara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240109163034.534593-1-alassane.yattara@savoirfairelinux.com \
--to=alassane.yattara@savoirfairelinux.com \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).