summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlassane Yattara <alassane.yattara@savoirfairelinux.com>2023-12-29 16:10:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-01 23:13:50 +0000
commit6a67f24773111bc48272cd5ac51b7c9e9bab7b27 (patch)
tree162bc6f6feecd146a31866e9b013fb26d6e392c1
parent4b7e54846392410cfed9c0a56b895f041f55d9df (diff)
downloadpoky-6a67f24773111bc48272cd5ac51b7c9e9bab7b27.tar.gz
bitbake: toaster/tests: bug-fix An element matching "#projectstable" should be visible
(Bitbake rev: 1edb97f741a48481b1b9f26c5cb31acd9059f07f) 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/browser/selenium_helpers_base.py2
-rw-r--r--bitbake/lib/toaster/tests/functional/test_functional_basic.py87
2 files changed, 46 insertions, 43 deletions
diff --git a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
index 13806624f3..562fedec8c 100644
--- a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
+++ b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
@@ -206,6 +206,8 @@ class SeleniumTestCaseBase(unittest.TestCase):
206 is_present = lambda driver: self.find(selector) 206 is_present = lambda driver: self.find(selector)
207 msg = 'An element matching "%s" should be on the page' % selector 207 msg = 'An element matching "%s" should be on the page' % selector
208 element = Wait(self.driver, poll=poll).until(is_present, msg) 208 element = Wait(self.driver, poll=poll).until(is_present, msg)
209 if poll > 2:
210 time.sleep(poll) # element need more delay to be present
209 return element 211 return element
210 212
211 def wait_until_visible(self, selector, poll=1): 213 def wait_until_visible(self, selector, poll=1):
diff --git a/bitbake/lib/toaster/tests/functional/test_functional_basic.py b/bitbake/lib/toaster/tests/functional/test_functional_basic.py
index 47f7452e81..e4070fbb88 100644
--- a/bitbake/lib/toaster/tests/functional/test_functional_basic.py
+++ b/bitbake/lib/toaster/tests/functional/test_functional_basic.py
@@ -14,15 +14,27 @@ from tests.functional.functional_helpers import SeleniumFunctionalTestCase
14from orm.models import Project 14from orm.models import Project
15from selenium.webdriver.common.by import By 15from selenium.webdriver.common.by import By
16 16
17from tests.functional.utils import get_projectId_from_url
17 18
19
20@pytest.mark.django_db
18@pytest.mark.order("second_to_last") 21@pytest.mark.order("second_to_last")
19class FuntionalTestBasic(SeleniumFunctionalTestCase): 22class FuntionalTestBasic(SeleniumFunctionalTestCase):
23 """Basic functional tests for Toaster"""
24 project_id = None
25
26 def setUp(self):
27 super(FuntionalTestBasic, self).setUp()
28 if not FuntionalTestBasic.project_id:
29 self._create_slenium_project()
30 current_url = self.driver.current_url
31 FuntionalTestBasic.project_id = get_projectId_from_url(current_url)
20 32
21# testcase (1514) 33# testcase (1514)
22 @pytest.mark.django_db 34 def _create_slenium_project(self):
23 def test_create_slenium_project(self):
24 project_name = 'selenium-project' 35 project_name = 'selenium-project'
25 self.get(reverse('newproject')) 36 self.get(reverse('newproject'))
37 self.wait_until_visible('#new-project-name', poll=3)
26 self.driver.find_element(By.ID, "new-project-name").send_keys(project_name) 38 self.driver.find_element(By.ID, "new-project-name").send_keys(project_name)
27 self.driver.find_element(By.ID, 'projectversion').click() 39 self.driver.find_element(By.ID, 'projectversion').click()
28 self.driver.find_element(By.ID, "create-project-button").click() 40 self.driver.find_element(By.ID, "create-project-button").click()
@@ -32,69 +44,68 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
32 "New project name not in new project notification") 44 "New project name not in new project notification")
33 self.assertTrue(Project.objects.filter(name=project_name).count(), 45 self.assertTrue(Project.objects.filter(name=project_name).count(),
34 "New project not found in database") 46 "New project not found in database")
47 return Project.objects.last().id
35 48
36 # testcase (1515) 49 # testcase (1515)
37 def test_verify_left_bar_menu(self): 50 def test_verify_left_bar_menu(self):
38 self.get(reverse('all-projects')) 51 self.get(reverse('all-projects'))
39 self.wait_until_visible('#projectstable', poll=10) 52 self.wait_until_present('#projectstable', poll=10)
40 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 53 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
41 self.wait_until_visible('#config-nav', poll=10) 54 self.wait_until_present('#config-nav', poll=10)
42 self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist') 55 self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist')
43 project_URL=self.get_URL() 56 project_URL=self.get_URL()
44 self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click() 57 self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click()
45 self.wait_until_visible('#config-nav', poll=10) 58 self.wait_until_present('#config-nav', poll=10)
46 59
47 try: 60 try:
48 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() 61 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click()
49 self.wait_until_visible('#config-nav', poll=10) 62 self.wait_until_present('#config-nav', poll=10)
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') 63 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')
51 except: 64 except:
52 self.fail(msg='No Custom images tab available') 65 self.fail(msg='No Custom images tab available')
53 66
54 try: 67 try:
55 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click() 68 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click()
56 self.wait_until_visible('#config-nav', poll=10) 69 self.wait_until_present('#config-nav', poll=10)
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') 70 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: 71 except:
59 self.fail(msg='No Compatible image tab available') 72 self.fail(msg='No Compatible image tab available')
60 73
61 try: 74 try:
62 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click() 75 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click()
63 self.wait_until_visible('#config-nav', poll=10) 76 self.wait_until_present('#config-nav', poll=10)
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') 77 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')
65 except: 78 except:
66 self.fail(msg='No Compatible software recipe tab available') 79 self.fail(msg='No Compatible software recipe tab available')
67 80
68 try: 81 try:
69 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click() 82 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click()
70 self.wait_until_visible('#config-nav', poll=10) 83 self.wait_until_present('#config-nav', poll=10)
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') 84 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')
72 except: 85 except:
73 self.fail(msg='No Compatible machines tab available') 86 self.fail(msg='No Compatible machines tab available')
74 87
75 try: 88 try:
76 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click() 89 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click()
77 self.wait_until_visible('#config-nav', poll=10) 90 self.wait_until_present('#config-nav', poll=10)
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') 91 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')
79 except: 92 except:
80 self.fail(msg='No Compatible layers tab available') 93 self.fail(msg='No Compatible layers tab available')
81 94
82 try: 95 try:
83 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click() 96 self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click()
84 self.wait_until_visible('#config-nav', poll=10) 97 self.wait_until_present('#config-nav', poll=10)
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') 98 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')
86 except: 99 except:
87 self.fail(msg='No Bitbake variables tab available') 100 self.fail(msg='No Bitbake variables tab available')
88 101
89# testcase (1516) 102# testcase (1516)
90 def test_review_configuration_information(self): 103 def test_review_configuration_information(self):
91 self.get('') 104 self.get(reverse('all-projects'))
92 self.wait_until_visible('#global-nav', poll=10) 105 self.wait_until_present('#projectstable', poll=10)
93 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
94 self.wait_until_visible('#projectstable', poll=10)
95 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 106 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
96 project_URL=self.get_URL() 107 project_URL=self.get_URL()
97 self.wait_until_visible('#config-nav', poll=10) 108 self.wait_until_present('#config-nav', poll=10)
98 try: 109 try:
99 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') 110 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist')
100 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned') 111 self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned')
@@ -134,12 +145,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
134 145
135# testcase (1517) 146# testcase (1517)
136 def test_verify_machine_information(self): 147 def test_verify_machine_information(self):
137 self.get('') 148 self.get(reverse('all-projects'))
138 self.wait_until_visible('#global-nav', poll=10) 149 self.wait_until_present('#projectstable', poll=10)
139 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
140 self.wait_until_visible('#projectstable', poll=10)
141 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 150 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
142 self.wait_until_visible('#config-nav', poll=10) 151 self.wait_until_present('#config-nav', poll=10)
143 152
144 try: 153 try:
145 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') 154 self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist')
@@ -153,29 +162,25 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
153 162
154# testcase (1518) 163# testcase (1518)
155 def test_verify_most_built_recipes_information(self): 164 def test_verify_most_built_recipes_information(self):
156 self.get('') 165 self.get(reverse('all-projects'))
157 self.wait_until_visible('#global-nav', poll=10) 166 self.wait_until_present('#projectstable', poll=10)
158 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
159 self.wait_until_visible('#projectstable', poll=10)
160 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 167 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
161 self.wait_until_visible('#config-nav', poll=10) 168 self.wait_until_present('#config-nav', poll=10)
162 project_URL=self.get_URL() 169 project_URL=self.get_URL()
163 try: 170 try:
164 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') 171 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')
165 self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click() 172 self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click()
166 self.wait_until_visible('#config-nav', poll=10) 173 self.wait_until_present('#config-nav', poll=10)
167 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') 174 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')
168 except: 175 except:
169 self.fail(msg='No Most built information in project detail page') 176 self.fail(msg='No Most built information in project detail page')
170 177
171# testcase (1519) 178# testcase (1519)
172 def test_verify_project_release_information(self): 179 def test_verify_project_release_information(self):
173 self.get('') 180 self.get(reverse('all-projects'))
174 self.wait_until_visible('#global-nav', poll=10) 181 self.wait_until_present('#projectstable', poll=10)
175 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
176 self.wait_until_visible('#projectstable', poll=10)
177 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 182 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
178 self.wait_until_visible('#config-nav', poll=10) 183 self.wait_until_present('#config-nav', poll=10)
179 184
180 try: 185 try:
181 self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text),'The project release is not defined') 186 self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text),'The project release is not defined')
@@ -184,12 +189,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
184 189
185# testcase (1520) 190# testcase (1520)
186 def test_verify_layer_information(self): 191 def test_verify_layer_information(self):
187 self.get('') 192 self.get(reverse('all-projects'))
188 self.wait_until_visible('#global-nav', poll=10) 193 self.wait_until_present('#projectstable', poll=10)
189 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
190 self.wait_until_visible('#projectstable', poll=10)
191 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 194 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
192 self.wait_until_visible('#config-nav', poll=10) 195 self.wait_until_present('#config-nav', poll=10)
193 project_URL=self.get_URL() 196 project_URL=self.get_URL()
194 try: 197 try:
195 self.driver.find_element(By.XPATH, "//div[@id='layer-container']") 198 self.driver.find_element(By.XPATH, "//div[@id='layer-container']")
@@ -216,15 +219,13 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
216 219
217# testcase (1521) 220# testcase (1521)
218 def test_verify_project_detail_links(self): 221 def test_verify_project_detail_links(self):
219 self.get('') 222 self.get(reverse('all-projects'))
220 self.wait_until_visible('#global-nav', poll=10) 223 self.wait_until_present('#projectstable', poll=10)
221 self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
222 self.wait_until_visible('#projectstable', poll=10)
223 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() 224 self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
224 self.wait_until_visible('#config-nav', poll=10) 225 self.wait_until_present('#config-nav', poll=10)
225 project_URL=self.get_URL() 226 project_URL=self.get_URL()
226 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() 227 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()
227 self.wait_until_visible('#config-nav', poll=10) 228 self.wait_until_present('#config-nav', poll=10)
228 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') 229 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')
229 230
230 try: 231 try: