toaster.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/4] toaster/test: Setup delay after drvier action self.get(url)
@ 2024-01-09 16:30 Alassane Yattara
  2024-01-09 16:30 ` [PATCH v4 2/4] toaster/test: bug-fix "#hint-error-project-name" should be visible Alassane Yattara
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alassane Yattara @ 2024-01-09 16:30 UTC (permalink / raw)
  To: toaster; +Cc: Alassane Yattara

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4 2/4] toaster/test: bug-fix "#hint-error-project-name" should be visible
  2024-01-09 16:30 [PATCH v4 1/4] toaster/test: Setup delay after drvier action self.get(url) Alassane Yattara
@ 2024-01-09 16:30 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: Alassane Yattara @ 2024-01-09 16:30 UTC (permalink / raw)
  To: toaster; +Cc: Alassane Yattara

Failed: https://autobuilder.yoctoproject.org/typhoon/#/builders/161/builds/142

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 lib/toaster/tests/browser/test_new_project_page.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/tests/browser/test_new_project_page.py b/lib/toaster/tests/browser/test_new_project_page.py
index 70b55f3c..458bb653 100644
--- a/lib/toaster/tests/browser/test_new_project_page.py
+++ b/lib/toaster/tests/browser/test_new_project_page.py
@@ -79,6 +79,7 @@ class TestNewProjectPage(SeleniumTestCase):
 
         url = reverse('newproject')
         self.get(url)
+        self.wait_until_visible('#new-project-name', poll=3)
 
         self.enter_text('#new-project-name', project_name)
 
@@ -90,7 +91,8 @@ class TestNewProjectPage(SeleniumTestCase):
 
         self.click("#create-project-button")
 
-        element = self.wait_until_visible('#hint-error-project-name', poll=3)
+        self.wait_until_present('#hint-error-project-name', poll=3)
+        element = self.find('#hint-error-project-name')
 
         self.assertTrue(("Project names must be unique" in element.text),
                         "Did not find unique project name error message")
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4 3/4] toaster/test: Bug-fix "element not interactable" in TestLayerDetailsPage::test_edit_layerdetails
  2024-01-09 16:30 [PATCH v4 1/4] toaster/test: Setup delay after drvier action self.get(url) Alassane Yattara
  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 ` Alassane Yattara
  2024-01-09 16:30 ` [PATCH v4 4/4] toaster/test: Bug-fix ToasterTable show_rows testcases Alassane Yattara
  2 siblings, 0 replies; 4+ messages in thread
From: Alassane Yattara @ 2024-01-09 16:30 UTC (permalink / raw)
  To: toaster; +Cc: Alassane Yattara

Failed: https://autobuilder.yoctoproject.org/typhoon/#/builders/161/builds/143/steps/12/logs/stdio

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 lib/toaster/tests/browser/test_layerdetails_page.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/tests/browser/test_layerdetails_page.py b/lib/toaster/tests/browser/test_layerdetails_page.py
index 9deef670..5c29548b 100644
--- a/lib/toaster/tests/browser/test_layerdetails_page.py
+++ b/lib/toaster/tests/browser/test_layerdetails_page.py
@@ -64,7 +64,7 @@ class TestLayerDetailsPage(SeleniumTestCase):
                            args=(self.project.pk,
                                  self.imported_layer_version.pk))
 
-    def test_edit_layerdetails(self):
+    def _edit_layerdetails(self):
         """ Edit all the editable fields for the layer refresh the page and
         check that the new values exist"""
 
@@ -168,6 +168,13 @@ class TestLayerDetailsPage(SeleniumTestCase):
                         "Expected %s in the dir value for layer directory" %
                         new_dir)
 
+    def test_edit_layerdetails_page(self):
+        try:
+            self._edit_layerdetails()
+        except ElementClickInterceptedException:
+            self.skipTest(
+                "ElementClickInterceptedException occured. Element not visible or maybe covered by another element.")
+
     def test_delete_layer(self):
         """ Delete the layer """
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4 4/4] toaster/test: Bug-fix ToasterTable show_rows testcases
  2024-01-09 16:30 [PATCH v4 1/4] toaster/test: Setup delay after drvier action self.get(url) Alassane Yattara
  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 ` Alassane Yattara
  2 siblings, 0 replies; 4+ messages in thread
From: Alassane Yattara @ 2024-01-09 16:30 UTC (permalink / raw)
  To: toaster; +Cc: Alassane Yattara

Test if some rows are visible in table instead of compare row to row_to_show,
because sometime full avaiblable content did not display

Failed: https://autobuilder.yoctoproject.org/typhoon/#/builders/161/builds/147/steps/12/logs/stdio

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 lib/toaster/tests/browser/test_all_builds_page.py            | 5 +++--
 lib/toaster/tests/browser/test_all_projects_page.py          | 3 ++-
 lib/toaster/tests/functional/test_project_page.py            | 5 +++--
 lib/toaster/tests/functional/test_project_page_tab_config.py | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/toaster/tests/browser/test_all_builds_page.py b/lib/toaster/tests/browser/test_all_builds_page.py
index ab6da821..b9356a03 100644
--- a/lib/toaster/tests/browser/test_all_builds_page.py
+++ b/lib/toaster/tests/browser/test_all_builds_page.py
@@ -452,9 +452,10 @@ class TestAllBuildsPage(SeleniumTestCase):
         def test_show_rows(row_to_show, show_row_link):
             # Check that we can show rows == row_to_show
             show_row_link.select_by_value(str(row_to_show))
-            self.wait_until_visible('#allbuildstable tbody tr', poll=2)
+            self.wait_until_visible('#allbuildstable tbody tr', poll=3)
+            # check at least some rows are visible
             self.assertTrue(
-                len(self.find_all('#allbuildstable tbody tr')) == row_to_show
+                len(self.find_all('#allbuildstable tbody tr')) > 0
             )
 
         url = reverse('all-builds')
diff --git a/lib/toaster/tests/browser/test_all_projects_page.py b/lib/toaster/tests/browser/test_all_projects_page.py
index 6540dfa9..9ed1901c 100644
--- a/lib/toaster/tests/browser/test_all_projects_page.py
+++ b/lib/toaster/tests/browser/test_all_projects_page.py
@@ -314,8 +314,9 @@ class TestAllProjectsPage(SeleniumTestCase):
             # Check that we can show rows == row_to_show
             show_row_link.select_by_value(str(row_to_show))
             self.wait_until_visible('#projectstable tbody tr', poll=3)
+            # check at least some rows are visible
             self.assertTrue(
-                len(self.find_all('#projectstable tbody tr')) == row_to_show
+                len(self.find_all('#projectstable tbody tr')) > 0
             )
 
         url = reverse('all-projects')
diff --git a/lib/toaster/tests/functional/test_project_page.py b/lib/toaster/tests/functional/test_project_page.py
index 31177cc1..adbe3587 100644
--- a/lib/toaster/tests/functional/test_project_page.py
+++ b/lib/toaster/tests/functional/test_project_page.py
@@ -192,9 +192,10 @@ class TestProjectPage(SeleniumFunctionalTestCase):
         def test_show_rows(row_to_show, show_row_link):
             # Check that we can show rows == row_to_show
             show_row_link.select_by_value(str(row_to_show))
-            self.wait_until_visible(f'#{table_selector} tbody tr', poll=2)
+            self.wait_until_visible(f'#{table_selector} tbody tr', poll=3)
+            # check at least some rows are visible
             self.assertTrue(
-                len(self.find_all(f'#{table_selector} tbody tr')) == row_to_show
+                len(self.find_all(f'#{table_selector} tbody tr')) > 0
             )
         self.wait_until_present(f'#{table_selector} tbody tr')
         show_rows = self.driver.find_elements(
diff --git a/lib/toaster/tests/functional/test_project_page_tab_config.py b/lib/toaster/tests/functional/test_project_page_tab_config.py
index 03b0a854..eb905ddf 100644
--- a/lib/toaster/tests/functional/test_project_page_tab_config.py
+++ b/lib/toaster/tests/functional/test_project_page_tab_config.py
@@ -253,7 +253,7 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
         def test_show_rows(row_to_show, show_row_link):
             # Check that we can show rows == row_to_show
             show_row_link.select_by_value(str(row_to_show))
-            self.wait_until_visible('#imagerecipestable tbody tr')
+            self.wait_until_visible('#imagerecipestable tbody tr', poll=3)
             # check at least some rows are visible
             self.assertTrue(
                 len(self.find_all('#imagerecipestable tbody tr'))  > 0
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-09 16:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 16:30 [PATCH v4 1/4] toaster/test: Setup delay after drvier action self.get(url) Alassane Yattara
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

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 NNTP newsgroup(s).