summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-18 10:51:46 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-24 11:24:03 +0100
commitfa2ca6f1f9d3d9219ac1851b4b064fe945077743 (patch)
treee343ae15fb3f0b4d5028f01197d71cab8cb6c267 /bitbake/lib/toaster
parentb04308f6706f98aa78007fd85d25c413377d1fe2 (diff)
downloadpoky-fa2ca6f1f9d3d9219ac1851b4b064fe945077743.tar.gz
bitbake: toaster/tests/function/basic: Make element detection more specific
The tests would race and potentially fail as the elements on the page being waited for were not specific enough. Add suitable elements to wait for and drop the remainder of the poll parameters since these are no longer needed since we no longer need to sleep for things to appear. (Bitbake rev: 9db2fd8534610ad8db90a7a696fa7b748b497d15) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r--bitbake/lib/toaster/tests/functional/test_functional_basic.py55
1 files changed, 32 insertions, 23 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_functional_basic.py b/bitbake/lib/toaster/tests/functional/test_functional_basic.py
index a95ce4862c..c73a278f6c 100644
--- a/bitbake/lib/toaster/tests/functional/test_functional_basic.py
+++ b/bitbake/lib/toaster/tests/functional/test_functional_basic.py
@@ -31,50 +31,50 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
31 self.get(reverse('all-projects')) 31 self.get(reverse('all-projects'))
32 self.wait_until_present('#projectstable', poll=10) 32 self.wait_until_present('#projectstable', poll=10)
33 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 33 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
34 self.wait_until_present('#config-nav', poll=10) 34 self.wait_until_present('#config-nav')
35 self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist') 35 self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist')
36 project_URL=self.get_URL() 36 project_URL=self.get_URL()
37 self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click() 37 self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click()
38 self.wait_until_present('#config-nav', poll=10)
39 38
40 try: 39 try:
40 self.wait_until_present('#config-nav')
41 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() 41 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click()
42 self.wait_until_present('#config-nav', poll=10) 42 self.wait_until_present('#filter-modal-customimagestable')
43 except: 43 except:
44 self.fail(msg='No Custom images tab available') 44 self.fail(msg='No Custom images tab available')
45 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') 45 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')
46 46
47 try: 47 try:
48 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click() 48 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click()
49 self.wait_until_present('#config-nav', poll=10) 49 self.wait_until_present('#filter-modal-imagerecipestable')
50 except: 50 except:
51 self.fail(msg='No Compatible image tab available') 51 self.fail(msg='No Compatible image tab available')
52 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') 52 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')
53 53
54 try: 54 try:
55 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click() 55 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click()
56 self.wait_until_present('#config-nav', poll=10) 56 self.wait_until_present('#filter-modal-softwarerecipestable')
57 except: 57 except:
58 self.fail(msg='No Compatible software recipe tab available') 58 self.fail(msg='No Compatible software recipe tab available')
59 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') 59 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')
60 60
61 try: 61 try:
62 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click() 62 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click()
63 self.wait_until_present('#config-nav', poll=10) 63 self.wait_until_present('#filter-modal-machinestable')
64 except: 64 except:
65 self.fail(msg='No Compatible machines tab available') 65 self.fail(msg='No Compatible machines tab available')
66 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') 66 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')
67 67
68 try: 68 try:
69 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click() 69 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click()
70 self.wait_until_present('#config-nav', poll=10) 70 self.wait_until_present('#filter-modal-layerstable')
71 except: 71 except:
72 self.fail(msg='No Compatible layers tab available') 72 self.fail(msg='No Compatible layers tab available')
73 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') 73 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')
74 74
75 try: 75 try:
76 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click() 76 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click()
77 self.wait_until_present('#config-nav', poll=10) 77 self.wait_until_present('#configvar-list')
78 except: 78 except:
79 self.fail(msg='No Bitbake variables tab available') 79 self.fail(msg='No Bitbake variables tab available')
80 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') 80 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,20 +85,21 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
85 self.wait_until_present('#projectstable', poll=10) 85 self.wait_until_present('#projectstable', poll=10)
86 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 86 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
87 project_URL=self.get_URL() 87 project_URL=self.get_URL()
88 self.wait_until_present('#config-nav', poll=10)
89 88
90 # Machine section of page 89 # Machine section of page
90 self.wait_until_visible('#machine-section')
91 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') 91 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist')
92 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned') 92 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned')
93 try: 93 try:
94 self.driver.find_element(By.XPATH, "//span[@id='change-machine-toggle']").click() 94 self.driver.find_element(By.XPATH, "//span[@id='change-machine-toggle']").click()
95 self.wait_until_visible('#select-machine-form', poll=10) 95 self.wait_until_visible('#select-machine-form')
96 self.wait_until_visible('#cancel-machine-change', poll=10) 96 self.wait_until_visible('#cancel-machine-change')
97 self.driver.find_element(By.XPATH, "//form[@id='select-machine-form']/a[@id='cancel-machine-change']").click() 97 self.driver.find_element(By.XPATH, "//form[@id='select-machine-form']/a[@id='cancel-machine-change']").click()
98 except: 98 except:
99 self.fail(msg='The machine information is wrong in the configuration page') 99 self.fail(msg='The machine information is wrong in the configuration page')
100 100
101 # Most built recipes section 101 # Most built recipes section
102 self.wait_until_visible('#no-most-built')
102 try: 103 try:
103 self.driver.find_element(By.ID, 'no-most-built') 104 self.driver.find_element(By.ID, 'no-most-built')
104 except: 105 except:
@@ -108,6 +109,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
108 self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.XPATH, "//span[@id='project-release-title']").text), 'The project release is not defined in the project detail page') 109 self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.XPATH, "//span[@id='project-release-title']").text), 'The project release is not defined in the project detail page')
109 110
110 # List of layers in project 111 # List of layers in project
112 self.wait_until_visible('#layer-container')
111 self.driver.find_element(By.XPATH, "//div[@id='layer-container']") 113 self.driver.find_element(By.XPATH, "//div[@id='layer-container']")
112 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') 114 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')
113 try: 115 try:
@@ -131,14 +133,15 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
131 self.get(reverse('all-projects')) 133 self.get(reverse('all-projects'))
132 self.wait_until_present('#projectstable', poll=10) 134 self.wait_until_present('#projectstable', poll=10)
133 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 135 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
134 self.wait_until_present('#config-nav', poll=10)
135 136
137 self.wait_until_visible('#machine-section')
136 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') 138 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist')
139 self.wait_until_visible('#project-machine-name')
137 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.ID, "project-machine-name").text),'The machine type is not assigned') 140 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.ID, "project-machine-name").text),'The machine type is not assigned')
138 try: 141 try:
139 self.driver.find_element(By.ID, "change-machine-toggle").click() 142 self.driver.find_element(By.ID, "change-machine-toggle").click()
140 self.wait_until_visible('#select-machine-form', poll=10) 143 self.wait_until_visible('#select-machine-form')
141 self.wait_until_visible('#cancel-machine-change', poll=10) 144 self.wait_until_visible('#cancel-machine-change')
142 self.driver.find_element(By.ID, "cancel-machine-change").click() 145 self.driver.find_element(By.ID, "cancel-machine-change").click()
143 except: 146 except:
144 self.fail(msg='The machine information is wrong in the configuration page') 147 self.fail(msg='The machine information is wrong in the configuration page')
@@ -148,14 +151,16 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
148 self.get(reverse('all-projects')) 151 self.get(reverse('all-projects'))
149 self.wait_until_present('#projectstable', poll=10) 152 self.wait_until_present('#projectstable', poll=10)
150 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 153 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
151 self.wait_until_present('#config-nav', poll=10) 154 self.wait_until_present('#config-nav')
152 project_URL=self.get_URL() 155 project_URL=self.get_URL()
156
157 self.wait_until_visible('#no-most-built')
153 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') 158 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')
154 try: 159 try:
155 self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click() 160 self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click()
156 except: 161 except:
157 self.fail(msg='No Most built information in project detail page') 162 self.fail(msg='No Most built information in project detail page')
158 self.wait_until_present('#config-nav', poll=10) 163 self.wait_until_visible('#config-nav')
159 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')
160 165
161# testcase (1519) 166# testcase (1519)
@@ -163,7 +168,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
163 self.get(reverse('all-projects')) 168 self.get(reverse('all-projects'))
164 self.wait_until_present('#projectstable', poll=10) 169 self.wait_until_present('#projectstable', poll=10)
165 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 170 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
166 self.wait_until_present('#config-nav', poll=10) 171 self.wait_until_visible('#project-release-title')
167 self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text), 'No project release title information in project detail page') 172 self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text), 'No project release title information in project detail page')
168 173
169# testcase (1520) 174# testcase (1520)
@@ -171,9 +176,11 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
171 self.get(reverse('all-projects')) 176 self.get(reverse('all-projects'))
172 self.wait_until_present('#projectstable', poll=10) 177 self.wait_until_present('#projectstable', poll=10)
173 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 178 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
174 self.wait_until_present('#config-nav', poll=10) 179 self.wait_until_present('#config-nav')
175 project_URL=self.get_URL() 180 project_URL=self.get_URL()
181 self.wait_until_visible('#layer-container')
176 self.driver.find_element(By.XPATH, "//div[@id='layer-container']") 182 self.driver.find_element(By.XPATH, "//div[@id='layer-container']")
183 self.wait_until_visible('#project-layers-count')
177 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') 184 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')
178 185
179 try: 186 try:
@@ -205,18 +212,18 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
205 self.get(reverse('all-projects')) 212 self.get(reverse('all-projects'))
206 self.wait_until_present('#projectstable', poll=10) 213 self.wait_until_present('#projectstable', poll=10)
207 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 214 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
208 self.wait_until_present('#config-nav', poll=10) 215 self.wait_until_present('#config-nav')
209 project_URL=self.get_URL() 216 project_URL=self.get_URL()
210 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() 217 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()
211 self.wait_until_present('#config-nav', poll=10) 218 self.wait_until_visible('#topbar-configuration-tab')
212 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') 219 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')
213 220
214 try: 221 try:
215 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click() 222 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click()
216 self.wait_until_visible('#project-topbar', poll=10)
217 except: 223 except:
218 self.fail(msg='Builds tab information is not present') 224 self.fail(msg='Builds tab information is not present')
219 225
226 self.wait_until_visible('#project-topbar')
220 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')
221 try: 228 try:
222 self.driver.find_element(By.XPATH, "//div[@id='empty-state-projectbuildstable']") 229 self.driver.find_element(By.XPATH, "//div[@id='empty-state-projectbuildstable']")
@@ -225,9 +232,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
225 232
226 try: 233 try:
227 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click() 234 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click()
228 self.wait_until_visible('#project-topbar', poll=10)
229 except: 235 except:
230 self.fail(msg='Import layer tab not loading properly') 236 self.fail(msg='Import layer tab not loading properly')
237
238 self.wait_until_visible('#project-topbar')
231 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') 239 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')
232 try: 240 try:
233 self.driver.find_element(By.XPATH, "//fieldset[@id='repo-select']") 241 self.driver.find_element(By.XPATH, "//fieldset[@id='repo-select']")
@@ -237,9 +245,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
237 245
238 try: 246 try:
239 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click() 247 self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click()
240 self.wait_until_visible('#project-topbar', poll=10)
241 except: 248 except:
242 self.fail(msg='New custom image tab not loading properly') 249 self.fail(msg='New custom image tab not loading properly')
250
251 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') 252 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') 253 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 254