summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlassane Yattara <alassane.yattara@savoirfairelinux.com>2023-11-21 14:49:18 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-23 12:06:06 +0000
commitfd740a6b6dc37d0a872f4013e2cf34501064f269 (patch)
treed30dd5327e02b8726ef0915ba7d6b4a08420c444 /bitbake
parentf002040d7779965f8b426c4023dd658ae71ecab2 (diff)
downloadpoky-fd740a6b6dc37d0a872f4013e2cf34501064f269.tar.gz
bitbake: toaster/tests: Add UI TestCase - Test project page has right tabs displayed
Test project tabs: - "configuration" tab - "Builds" tab - "Import layers" tab - "New custom image" tab Check search box used to build recipes (Bitbake rev: 13a55ebe630ad20e8ab4cdcb3dc6dcbf4fa7243a) Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/tests/functional/test_project_page.py78
1 files changed, 78 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_project_page.py b/bitbake/lib/toaster/tests/functional/test_project_page.py
index a83a994ba8..3edf967a2c 100644
--- a/bitbake/lib/toaster/tests/functional/test_project_page.py
+++ b/bitbake/lib/toaster/tests/functional/test_project_page.py
@@ -167,3 +167,81 @@ class TestProjectPage(SeleniumFunctionalTestCase):
167 self.assertTrue( 167 self.assertTrue(
168 'New Name' in str(self.find('#project-name-container').text) 168 'New Name' in str(self.find('#project-name-container').text)
169 ) 169 )
170
171 def test_project_page_tabs(self):
172 """ Test project tabs:
173 - "configuration" tab
174 - "Builds" tab
175 - "Import layers" tab
176 - "New custom image" tab
177 Check search box used to build recipes
178 """
179 # navigate to the project page
180 url = reverse("project", args=(1,))
181 self.get(url)
182
183 # check "configuration" tab
184 self.wait_until_visible('#topbar-configuration-tab')
185 config_tab = self.find('#topbar-configuration-tab')
186 self.assertTrue(config_tab.get_attribute('class') == 'active')
187 self.assertTrue('Configuration' in config_tab.text)
188 config_tab_link = config_tab.find_element(By.TAG_NAME, 'a')
189 self.assertTrue(
190 f"/toastergui/project/1" in str(config_tab_link.get_attribute(
191 'href'))
192 )
193
194 def get_tabs():
195 # tabs links list
196 return self.driver.find_elements(
197 By.XPATH,
198 '//div[@id="project-topbar"]//li'
199 )
200
201 def check_tab_link(tab_index, tab_name, url):
202 tab = get_tabs()[tab_index]
203 tab_link = tab.find_element(By.TAG_NAME, 'a')
204 self.assertTrue(url in tab_link.get_attribute('href'))
205 self.assertTrue(tab_name in tab_link.text)
206 self.assertTrue(tab.get_attribute('class') == 'active')
207
208 # check "Builds" tab
209 builds_tab = get_tabs()[1]
210 builds_tab.find_element(By.TAG_NAME, 'a').click()
211 check_tab_link(
212 1,
213 'Builds',
214 f"/toastergui/project/1/builds"
215 )
216
217 # check "Import layers" tab
218 import_layers_tab = get_tabs()[2]
219 import_layers_tab.find_element(By.TAG_NAME, 'a').click()
220 check_tab_link(
221 2,
222 'Import layer',
223 f"/toastergui/project/1/importlayer"
224 )
225
226 # check "New custom image" tab
227 new_custom_image_tab = get_tabs()[3]
228 new_custom_image_tab.find_element(By.TAG_NAME, 'a').click()
229 check_tab_link(
230 3,
231 'New custom image',
232 f"/toastergui/project/1/newcustomimage"
233 )
234
235 # check search box can be use to build recipes
236 search_box = self.find('#build-input')
237 search_box.send_keys('core-image-minimal')
238 self.find('#build-button').click()
239 self.wait_until_visible('#latest-builds')
240 lastest_builds = self.driver.find_elements(
241 By.XPATH,
242 '//div[@id="latest-builds"]',
243 )
244 last_build = lastest_builds[0]
245 self.assertTrue(
246 'core-image-minimal' in str(last_build.text)
247 )