summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlassane Yattara <alassane.yattara@savoirfairelinux.com>2023-12-14 23:11:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-15 14:37:28 +0000
commitc8382b35e843591a34f867c5eb34a24cc17634e2 (patch)
treebcc9328ca5e53eef453fd336fd8bca83f915cdb1
parent5648636a8b5c7b45d5c37a73bfd41cb416f91557 (diff)
downloadpoky-c8382b35e843591a34f867c5eb34a24cc17634e2.tar.gz
bitbake: toaster/tests: Removed all time.sleep occurrence
Use wait_until_visible instead of time.sleep to delay driver actions (Bitbake rev: 96bf461d5860dad2377963c8dad6c754670738a6) Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/toaster/tests/functional/test_functional_basic.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_functional_basic.py b/bitbake/lib/toaster/tests/functional/test_functional_basic.py
index dcd84c3f64..5d7a86bb9b 100644
--- a/bitbake/lib/toaster/tests/functional/test_functional_basic.py
+++ b/bitbake/lib/toaster/tests/functional/test_functional_basic.py
@@ -15,7 +15,7 @@ from orm.models import Project
15from selenium.webdriver.common.by import By 15from selenium.webdriver.common.by import By
16 16
17 17
18@pytest.mark.order("last") 18@pytest.mark.order("second_to_last")
19class FuntionalTestBasic(SeleniumFunctionalTestCase): 19class FuntionalTestBasic(SeleniumFunctionalTestCase):
20 20
21# testcase (1514) 21# testcase (1514)
@@ -26,7 +26,6 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
26 self.driver.find_element(By.ID, "new-project-name").send_keys(project_name) 26 self.driver.find_element(By.ID, "new-project-name").send_keys(project_name)
27 self.driver.find_element(By.ID, 'projectversion').click() 27 self.driver.find_element(By.ID, 'projectversion').click()
28 self.driver.find_element(By.ID, "create-project-button").click() 28 self.driver.find_element(By.ID, "create-project-button").click()
29 time.sleep(2)
30 element = self.wait_until_visible('#project-created-notification') 29 element = self.wait_until_visible('#project-created-notification')
31 self.assertTrue(self.element_exists('#project-created-notification'),'Project creation notification not shown') 30 self.assertTrue(self.element_exists('#project-created-notification'),'Project creation notification not shown')
32 self.assertTrue(project_name in element.text, 31 self.assertTrue(project_name in element.text,
@@ -39,45 +38,50 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
39 self.get(reverse('all-projects')) 38 self.get(reverse('all-projects'))
40 self.wait_until_visible('#projectstable') 39 self.wait_until_visible('#projectstable')
41 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 40 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
42 time.sleep(2) 41 self.wait_until_visible('#config-nav')
43 self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist') 42 self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist')
44 project_URL=self.get_URL() 43 project_URL=self.get_URL()
45 self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click() 44 self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click()
46 time.sleep(2) 45 self.wait_until_visible('#config-nav')
47 46
48 try: 47 try:
49 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() 48 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click()
50 time.sleep(2) 49 self.wait_until_visible('#config-nav')
51 self.assertTrue(re.search("Custom images",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'Custom images information is not loading properly') 50 self.assertTrue(re.search("Custom images",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'Custom images information is not loading properly')
52 except: 51 except:
53 self.fail(msg='No Custom images tab available') 52 self.fail(msg='No Custom images tab available')
54 53
55 try: 54 try:
56 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click() 55 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click()
56 self.wait_until_visible('#config-nav')
57 self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible image recipes information is not loading properly') 57 self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible image recipes information is not loading properly')
58 except: 58 except:
59 self.fail(msg='No Compatible image tab available') 59 self.fail(msg='No Compatible image tab available')
60 60
61 try: 61 try:
62 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click() 62 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click()
63 self.wait_until_visible('#config-nav')
63 self.assertTrue(re.search("Compatible software recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible software recipe information is not loading properly') 64 self.assertTrue(re.search("Compatible software recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible software recipe information is not loading properly')
64 except: 65 except:
65 self.fail(msg='No Compatible software recipe tab available') 66 self.fail(msg='No Compatible software recipe tab available')
66 67
67 try: 68 try:
68 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click() 69 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click()
70 self.wait_until_visible('#config-nav')
69 self.assertTrue(re.search("Compatible machines",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible machine information is not loading properly') 71 self.assertTrue(re.search("Compatible machines",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible machine information is not loading properly')
70 except: 72 except:
71 self.fail(msg='No Compatible machines tab available') 73 self.fail(msg='No Compatible machines tab available')
72 74
73 try: 75 try:
74 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click() 76 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click()
77 self.wait_until_visible('#config-nav')
75 self.assertTrue(re.search("Compatible layers",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible layer information is not loading properly') 78 self.assertTrue(re.search("Compatible layers",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible layer information is not loading properly')
76 except: 79 except:
77 self.fail(msg='No Compatible layers tab available') 80 self.fail(msg='No Compatible layers tab available')
78 81
79 try: 82 try:
80 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click() 83 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click()
84 self.wait_until_visible('#config-nav')
81 self.assertTrue(re.search("Bitbake variables",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Bitbake variables information is not loading properly') 85 self.assertTrue(re.search("Bitbake variables",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Bitbake variables information is not loading properly')
82 except: 86 except:
83 self.fail(msg='No Bitbake variables tab available') 87 self.fail(msg='No Bitbake variables tab available')
@@ -86,16 +90,14 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
86 def test_review_configuration_information(self): 90 def test_review_configuration_information(self):
87 self.get('') 91 self.get('')
88 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() 92 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
89 time.sleep(2)
90 self.wait_until_visible('#projectstable') 93 self.wait_until_visible('#projectstable')
91 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 94 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
92 project_URL=self.get_URL() 95 project_URL=self.get_URL()
93 time.sleep(2) 96 self.wait_until_visible('#config-nav')
94 try: 97 try:
95 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') 98 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist')
96 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned') 99 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned')
97 self.driver.find_element(By.XPATH, "//span[@id='change-machine-toggle']").click() 100 self.driver.find_element(By.XPATH, "//span[@id='change-machine-toggle']").click()
98 time.sleep(2)
99 self.wait_until_visible('#select-machine-form') 101 self.wait_until_visible('#select-machine-form')
100 self.wait_until_visible('#cancel-machine-change') 102 self.wait_until_visible('#cancel-machine-change')
101 self.driver.find_element(By.XPATH, "//form[@id='select-machine-form']/a[@id='cancel-machine-change']").click() 103 self.driver.find_element(By.XPATH, "//form[@id='select-machine-form']/a[@id='cancel-machine-change']").click()
@@ -133,16 +135,14 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
133 def test_verify_machine_information(self): 135 def test_verify_machine_information(self):
134 self.get('') 136 self.get('')
135 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() 137 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
136 time.sleep(2)
137 self.wait_until_visible('#projectstable') 138 self.wait_until_visible('#projectstable')
138 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 139 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
139 time.sleep(2) 140 self.wait_until_visible('#config-nav')
140 141
141 try: 142 try:
142 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') 143 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist')
143 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.ID, "project-machine-name").text),'The machine type is not assigned') 144 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.ID, "project-machine-name").text),'The machine type is not assigned')
144 self.driver.find_element(By.ID, "change-machine-toggle").click() 145 self.driver.find_element(By.ID, "change-machine-toggle").click()
145 time.sleep(2)
146 self.wait_until_visible('#select-machine-form') 146 self.wait_until_visible('#select-machine-form')
147 self.wait_until_visible('#cancel-machine-change') 147 self.wait_until_visible('#cancel-machine-change')
148 self.driver.find_element(By.ID, "cancel-machine-change").click() 148 self.driver.find_element(By.ID, "cancel-machine-change").click()
@@ -153,15 +153,14 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
153 def test_verify_most_built_recipes_information(self): 153 def test_verify_most_built_recipes_information(self):
154 self.get('') 154 self.get('')
155 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() 155 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
156 time.sleep(2)
157 self.wait_until_visible('#projectstable') 156 self.wait_until_visible('#projectstable')
158 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 157 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
158 self.wait_until_visible('#config-nav')
159 project_URL=self.get_URL() 159 project_URL=self.get_URL()
160 time.sleep(2)
161 try: 160 try:
162 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') 161 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')
163 self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click() 162 self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click()
164 time.sleep(2) 163 self.wait_until_visible('#config-nav')
165 self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Choose a recipe to build link is not working properly') 164 self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Choose a recipe to build link is not working properly')
166 except: 165 except:
167 self.fail(msg='No Most built information in project detail page') 166 self.fail(msg='No Most built information in project detail page')
@@ -170,10 +169,9 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
170 def test_verify_project_release_information(self): 169 def test_verify_project_release_information(self):
171 self.get('') 170 self.get('')
172 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() 171 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
173 time.sleep(2)
174 self.wait_until_visible('#projectstable') 172 self.wait_until_visible('#projectstable')
175 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 173 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
176 time.sleep(2) 174 self.wait_until_visible('#config-nav')
177 175
178 try: 176 try:
179 self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text),'The project release is not defined') 177 self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text),'The project release is not defined')
@@ -186,8 +184,8 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
186 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() 184 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
187 self.wait_until_visible('#projectstable') 185 self.wait_until_visible('#projectstable')
188 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 186 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
187 self.wait_until_visible('#config-nav')
189 project_URL=self.get_URL() 188 project_URL=self.get_URL()
190 time.sleep(2)
191 try: 189 try:
192 self.driver.find_element(By.XPATH, "//div[@id='layer-container']") 190 self.driver.find_element(By.XPATH, "//div[@id='layer-container']")
193 self.assertTrue(re.search("3",self.driver.find_element(By.ID, "project-layers-count").text),'There should be 3 layers listed in the layer count') 191 self.assertTrue(re.search("3",self.driver.find_element(By.ID, "project-layers-count").text),'There should be 3 layers listed in the layer count')
@@ -215,16 +213,17 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
215 def test_verify_project_detail_links(self): 213 def test_verify_project_detail_links(self):
216 self.get('') 214 self.get('')
217 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() 215 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
218 time.sleep(2)
219 self.wait_until_visible('#projectstable') 216 self.wait_until_visible('#projectstable')
220 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 217 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
218 self.wait_until_visible('#config-nav')
221 project_URL=self.get_URL() 219 project_URL=self.get_URL()
222 time.sleep(2)
223 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").click() 220 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").click()
221 self.wait_until_visible('#config-nav')
224 self.assertTrue(re.search("Configuration",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").text), 'Configuration tab in project topbar is misspelled') 222 self.assertTrue(re.search("Configuration",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").text), 'Configuration tab in project topbar is misspelled')
225 223
226 try: 224 try:
227 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click() 225 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click()
226 self.wait_until_visible('#project-topbar')
228 self.assertTrue(re.search("Builds",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project topbar is misspelled') 227 self.assertTrue(re.search("Builds",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project topbar is misspelled')
229 self.driver.find_element(By.XPATH, "//div[@id='empty-state-projectbuildstable']") 228 self.driver.find_element(By.XPATH, "//div[@id='empty-state-projectbuildstable']")
230 except: 229 except:
@@ -232,6 +231,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
232 231
233 try: 232 try:
234 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click() 233 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click()
234 self.wait_until_visible('#project-topbar')
235 self.assertTrue(re.search("Import layer",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").text), 'Import layer tab in project topbar is misspelled') 235 self.assertTrue(re.search("Import layer",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").text), 'Import layer tab in project topbar is misspelled')
236 self.driver.find_element(By.XPATH, "//fieldset[@id='repo-select']") 236 self.driver.find_element(By.XPATH, "//fieldset[@id='repo-select']")
237 self.driver.find_element(By.XPATH, "//fieldset[@id='git-repo']") 237 self.driver.find_element(By.XPATH, "//fieldset[@id='git-repo']")
@@ -240,6 +240,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
240 240
241 try: 241 try:
242 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click() 242 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click()
243 self.wait_until_visible('#project-topbar')
243 self.assertTrue(re.search("New custom image",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").text), 'New custom image tab in project topbar is misspelled') 244 self.assertTrue(re.search("New custom image",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").text), 'New custom image tab in project topbar is misspelled')
244 self.assertTrue(re.search("Select the image recipe you want to customise",self.driver.find_element(By.XPATH, "//div[@class='col-md-12']/h2").text),'The new custom image tab is not loading correctly') 245 self.assertTrue(re.search("Select the image recipe you want to customise",self.driver.find_element(By.XPATH, "//div[@class='col-md-12']/h2").text),'The new custom image tab is not loading correctly')
245 except: 246 except: