[PATCH] toaster/test: Bug-fix test_functional_basic, delay driver actions

Alassane Yattara <[email protected]> Mon, 18 Dec 2023 22:37:51 +0100
Newsgroups org.yoctoproject.lists.toaster
Message-ID <[email protected]>
The errors causing faileds on functional_basic are d=C3=BB to the delay b=
etween actions,
increase between driver actions.

Signed-off-by: Alassane Yattara <[email protected]>
---
 .../tests/functional/test_functional_basic.py | 76 +++++++++----------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/=
toaster/tests/functional/test_functional_basic.py
index e48f13b0..47f7452e 100644
--- a/lib/toaster/tests/functional/test_functional_basic.py
+++ b/lib/toaster/tests/functional/test_functional_basic.py
@@ -7,7 +7,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 #
=20
-import re, time
+import re
 from django.urls import reverse
 import pytest
 from tests.functional.functional_helpers import SeleniumFunctionalTestCa=
se
@@ -26,7 +26,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
         self.driver.find_element(By.ID, "new-project-name").send_keys(pr=
oject_name)
         self.driver.find_element(By.ID, 'projectversion').click()
         self.driver.find_element(By.ID, "create-project-button").click()
-        element =3D self.wait_until_visible('#project-created-notificati=
on')
+        element =3D self.wait_until_visible('#project-created-notificati=
on', poll=3D10)
         self.assertTrue(self.element_exists('#project-created-notificati=
on'),'Project creation notification not shown')
         self.assertTrue(project_name in element.text,
                         "New project name not in new project notificatio=
n")
@@ -36,52 +36,52 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
  #  testcase (1515)
     def test_verify_left_bar_menu(self):
         self.get(reverse('all-projects'))
-        self.wait_until_visible('#projectstable')
+        self.wait_until_visible('#projectstable', poll=3D10)
         self.find_element_by_link_text_in_table('projectstable', 'seleni=
um-project').click()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
         self.assertTrue(self.element_exists('#config-nav'),'Configuratio=
n Tab does not exist')
         project_URL=3Dself.get_URL()
         self.driver.find_element(By.XPATH, '//a[@href=3D"'+project_URL+'=
"]').click()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
=20
         try:
             self.driver.find_element(By.XPATH, "//*[@id=3D'config-nav']/=
ul/li/a[@href=3D"+'"'+project_URL+'customimages/"'+"]").click()
-            self.wait_until_visible('#config-nav')
+            self.wait_until_visible('#config-nav', poll=3D10)
             self.assertTrue(re.search("Custom images",self.driver.find_e=
lement(By.XPATH, "//div[@class=3D'col-md-10']").text),'Custom images info=
rmation is not loading properly')
         except:
             self.fail(msg=3D'No Custom images tab available')
=20
         try:
             self.driver.find_element(By.XPATH, "//*[@id=3D'config-nav']/=
ul/li/a[@href=3D"+'"'+project_URL+'images/"'+"]").click()
-            self.wait_until_visible('#config-nav')
+            self.wait_until_visible('#config-nav', poll=3D10)
             self.assertTrue(re.search("Compatible image recipes",self.dr=
iver.find_element(By.XPATH, "//div[@class=3D'col-md-10']").text),'The Com=
patible image recipes information is not loading properly')
         except:
             self.fail(msg=3D'No Compatible image tab available')
=20
         try:
             self.driver.find_element(By.XPATH, "//*[@id=3D'config-nav']/=
ul/li/a[@href=3D"+'"'+project_URL+'softwarerecipes/"'+"]").click()
-            self.wait_until_visible('#config-nav')
+            self.wait_until_visible('#config-nav', poll=3D10)
             self.assertTrue(re.search("Compatible software recipes",self=
.driver.find_element(By.XPATH, "//div[@class=3D'col-md-10']").text),'The =
Compatible software recipe information is not loading properly')
         except:
             self.fail(msg=3D'No Compatible software recipe tab available=
')
=20
         try:
             self.driver.find_element(By.XPATH, "//*[@id=3D'config-nav']/=
ul/li/a[@href=3D"+'"'+project_URL+'machines/"'+"]").click()
-            self.wait_until_visible('#config-nav')
+            self.wait_until_visible('#config-nav', poll=3D10)
             self.assertTrue(re.search("Compatible machines",self.driver.=
find_element(By.XPATH, "//div[@class=3D'col-md-10']").text),'The Compatib=
le machine information is not loading properly')
         except:
             self.fail(msg=3D'No Compatible machines tab available')
=20
         try:
             self.driver.find_element(By.XPATH, "//*[@id=3D'config-nav']/=
ul/li/a[@href=3D"+'"'+project_URL+'layers/"'+"]").click()
-            self.wait_until_visible('#config-nav')
+            self.wait_until_visible('#config-nav', poll=3D10)
             self.assertTrue(re.search("Compatible layers",self.driver.fi=
nd_element(By.XPATH, "//div[@class=3D'col-md-10']").text),'The Compatible=
 layer information is not loading properly')
         except:
             self.fail(msg=3D'No Compatible layers tab available')
=20
         try:
             self.driver.find_element(By.XPATH, "//*[@id=3D'config-nav']/=
ul/li/a[@href=3D"+'"'+project_URL+'configuration"'+"]").click()
-            self.wait_until_visible('#config-nav')
+            self.wait_until_visible('#config-nav', poll=3D10)
             self.assertTrue(re.search("Bitbake variables",self.driver.fi=
nd_element(By.XPATH, "//div[@class=3D'col-md-10']").text),'The Bitbake va=
riables information is not loading properly')
         except:
             self.fail(msg=3D'No Bitbake variables tab available')
@@ -89,18 +89,18 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
 #   testcase (1516)
     def test_review_configuration_information(self):
         self.get('')
-        self.wait_until_visible('#global-nav')
+        self.wait_until_visible('#global-nav', poll=3D10)
         self.driver.find_element(By.XPATH, "//div[@id=3D'global-nav']/ul=
/li/a[@href=3D"+'"'+'/toastergui/projects/'+'"'+"]").click()
-        self.wait_until_visible('#projectstable')
+        self.wait_until_visible('#projectstable', poll=3D10)
         self.find_element_by_link_text_in_table('projectstable', 'seleni=
um-project').click()
         project_URL=3Dself.get_URL()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
         try:
            self.assertTrue(self.element_exists('#machine-section'),'Mach=
ine section for the project configuration page does not exist')
            self.assertTrue(re.search("qemux86-64",self.driver.find_eleme=
nt(By.XPATH, "//span[@id=3D'project-machine-name']").text),'The machine t=
ype is not assigned')
            self.driver.find_element(By.XPATH, "//span[@id=3D'change-mach=
ine-toggle']").click()
-           self.wait_until_visible('#select-machine-form')
-           self.wait_until_visible('#cancel-machine-change')
+           self.wait_until_visible('#select-machine-form', poll=3D10)
+           self.wait_until_visible('#cancel-machine-change', poll=3D10)
            self.driver.find_element(By.XPATH, "//form[@id=3D'select-mach=
ine-form']/a[@id=3D'cancel-machine-change']").click()
         except:
            self.fail(msg=3D'The machine information is wrong in the conf=
iguration page')
@@ -135,18 +135,18 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase=
):
 #   testcase (1517)
     def test_verify_machine_information(self):
         self.get('')
-        self.wait_until_visible('#global-nav')
+        self.wait_until_visible('#global-nav', poll=3D10)
         self.driver.find_element(By.XPATH, "//div[@id=3D'global-nav']/ul=
/li/a[@href=3D"+'"'+'/toastergui/projects/'+'"'+"]").click()
-        self.wait_until_visible('#projectstable')
+        self.wait_until_visible('#projectstable', poll=3D10)
         self.find_element_by_link_text_in_table('projectstable', 'seleni=
um-project').click()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
=20
         try:
             self.assertTrue(self.element_exists('#machine-section'),'Mac=
hine section for the project configuration page does not exist')
             self.assertTrue(re.search("qemux86-64",self.driver.find_elem=
ent(By.ID, "project-machine-name").text),'The machine type is not assigne=
d')
             self.driver.find_element(By.ID, "change-machine-toggle").cli=
ck()
-            self.wait_until_visible('#select-machine-form')
-            self.wait_until_visible('#cancel-machine-change')
+            self.wait_until_visible('#select-machine-form', poll=3D10)
+            self.wait_until_visible('#cancel-machine-change', poll=3D10)
             self.driver.find_element(By.ID, "cancel-machine-change").cli=
ck()
         except:
             self.fail(msg=3D'The machine information is wrong in the con=
figuration page')
@@ -154,16 +154,16 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase=
):
 #   testcase (1518)
     def test_verify_most_built_recipes_information(self):
         self.get('')
-        self.wait_until_visible('#global-nav')
+        self.wait_until_visible('#global-nav', poll=3D10)
         self.driver.find_element(By.XPATH, "//div[@id=3D'global-nav']/ul=
/li/a[@href=3D"+'"'+'/toastergui/projects/'+'"'+"]").click()
-        self.wait_until_visible('#projectstable')
+        self.wait_until_visible('#projectstable', poll=3D10)
         self.find_element_by_link_text_in_table('projectstable', 'seleni=
um-project').click()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
         project_URL=3Dself.get_URL()
         try:
             self.assertTrue(re.search("You haven't built any recipes yet=
",self.driver.find_element(By.ID, "no-most-built").text),'Default message=
 of no builds is not present')
             self.driver.find_element(By.XPATH, "//div[@id=3D'no-most-bui=
lt']/p/a[@href=3D"+'"'+project_URL+'images/"'+"]").click()
-            self.wait_until_visible('#config-nav')
+            self.wait_until_visible('#config-nav', poll=3D10)
             self.assertTrue(re.search("Compatible image recipes",self.dr=
iver.find_element(By.XPATH, "//div[@class=3D'col-md-10']").text),'The Cho=
ose a recipe to build link  is not working  properly')
         except:
             self.fail(msg=3D'No Most built information in project detail=
 page')
@@ -171,11 +171,11 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase=
):
 #   testcase (1519)
     def test_verify_project_release_information(self):
         self.get('')
-        self.wait_until_visible('#global-nav')
+        self.wait_until_visible('#global-nav', poll=3D10)
         self.driver.find_element(By.XPATH, "//div[@id=3D'global-nav']/ul=
/li/a[@href=3D"+'"'+'/toastergui/projects/'+'"'+"]").click()
-        self.wait_until_visible('#projectstable')
+        self.wait_until_visible('#projectstable', poll=3D10)
         self.find_element_by_link_text_in_table('projectstable', 'seleni=
um-project').click()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
=20
         try:
             self.assertTrue(re.search("Yocto Project master",self.driver=
.find_element(By.ID, "project-release-title").text),'The project release =
is not defined')
@@ -185,11 +185,11 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase=
):
 #   testcase (1520)
     def test_verify_layer_information(self):
         self.get('')
-        self.wait_until_visible('#global-nav')
+        self.wait_until_visible('#global-nav', poll=3D10)
         self.driver.find_element(By.XPATH, "//div[@id=3D'global-nav']/ul=
/li/a[@href=3D"+'"'+'/toastergui/projects/'+'"'+"]").click()
-        self.wait_until_visible('#projectstable')
+        self.wait_until_visible('#projectstable', poll=3D10)
         self.find_element_by_link_text_in_table('projectstable', 'seleni=
um-project').click()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
         project_URL=3Dself.get_URL()
         try:
            self.driver.find_element(By.XPATH, "//div[@id=3D'layer-contai=
ner']")
@@ -217,19 +217,19 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase=
):
 #   testcase (1521)
     def test_verify_project_detail_links(self):
         self.get('')
-        self.wait_until_visible('#global-nav')
+        self.wait_until_visible('#global-nav', poll=3D10)
         self.driver.find_element(By.XPATH, "//div[@id=3D'global-nav']/ul=
/li/a[@href=3D"+'"'+'/toastergui/projects/'+'"'+"]").click()
-        self.wait_until_visible('#projectstable')
+        self.wait_until_visible('#projectstable', poll=3D10)
         self.find_element_by_link_text_in_table('projectstable', 'seleni=
um-project').click()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
         project_URL=3Dself.get_URL()
         self.driver.find_element(By.XPATH, "//div[@id=3D'project-topbar'=
]/ul[@class=3D'nav nav-tabs']/li[@id=3D'topbar-configuration-tab']/a[@hre=
f=3D"+'"'+project_URL+'"'+"]").click()
-        self.wait_until_visible('#config-nav')
+        self.wait_until_visible('#config-nav', poll=3D10)
         self.assertTrue(re.search("Configuration",self.driver.find_eleme=
nt(By.XPATH, "//div[@id=3D'project-topbar']/ul[@class=3D'nav nav-tabs']/l=
i[@id=3D'topbar-configuration-tab']/a[@href=3D"+'"'+project_URL+'"'+"]").=
text), 'Configuration tab in project topbar is misspelled')
=20
         try:
             self.driver.find_element(By.XPATH, "//div[@id=3D'project-top=
bar']/ul[@class=3D'nav nav-tabs']/li/a[@href=3D"+'"'+project_URL+'builds/=
"'+"]").click()
-            self.wait_until_visible('#project-topbar')
+            self.wait_until_visible('#project-topbar', poll=3D10)
             self.assertTrue(re.search("Builds",self.driver.find_element(=
By.XPATH, "//div[@id=3D'project-topbar']/ul[@class=3D'nav nav-tabs']/li/a=
[@href=3D"+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project =
topbar is misspelled')
             self.driver.find_element(By.XPATH, "//div[@id=3D'empty-state=
-projectbuildstable']")
         except:
@@ -237,7 +237,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
=20
         try:
             self.driver.find_element(By.XPATH, "//div[@id=3D'project-top=
bar']/ul[@class=3D'nav nav-tabs']/li/a[@href=3D"+'"'+project_URL+'importl=
ayer"'+"]").click()
-            self.wait_until_visible('#project-topbar')
+            self.wait_until_visible('#project-topbar', poll=3D10)
             self.assertTrue(re.search("Import layer",self.driver.find_el=
ement(By.XPATH, "//div[@id=3D'project-topbar']/ul[@class=3D'nav nav-tabs'=
]/li/a[@href=3D"+'"'+project_URL+'importlayer"'+"]").text), 'Import layer=
 tab in project topbar is misspelled')
             self.driver.find_element(By.XPATH, "//fieldset[@id=3D'repo-s=
elect']")
             self.driver.find_element(By.XPATH, "//fieldset[@id=3D'git-re=
po']")
@@ -246,7 +246,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
=20
         try:
             self.driver.find_element(By.XPATH, "//div[@id=3D'project-top=
bar']/ul[@class=3D'nav nav-tabs']/li/a[@href=3D"+'"'+project_URL+'newcust=
omimage/"'+"]").click()
-            self.wait_until_visible('#project-topbar')
+            self.wait_until_visible('#project-topbar', poll=3D10)
             self.assertTrue(re.search("New custom image",self.driver.fin=
d_element(By.XPATH, "//div[@id=3D'project-topbar']/ul[@class=3D'nav nav-t=
abs']/li/a[@href=3D"+'"'+project_URL+'newcustomimage/"'+"]").text), 'New =
custom image tab in project topbar is misspelled')
             self.assertTrue(re.search("Select the image recipe you want =
to customise",self.driver.find_element(By.XPATH, "//div[@class=3D'col-md-=
12']/h2").text),'The new custom image tab is not loading correctly')
         except:
--=20
2.34.1