summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/tests
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-11 21:39:52 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-14 21:44:38 +0100
commit70672522bb027051f9a11a34f126c5619d0c8630 (patch)
treef5b70add0c1b3229122a872bebd049d899e5036c /bitbake/lib/toaster/tests
parentaa546ea0c316116d1f6f34f729a9e23f24322e0e (diff)
downloadpoky-70672522bb027051f9a11a34f126c5619d0c8630.tar.gz
bitbake: toaster/tests: Replace assertTrue for more specific asserts
assetTrue is a poor choice for "x in y" since assertIn gives much more useful output upon failure. Change such inserts to assertIn or assertEqual to make errors easier to debug. (Bitbake rev: dde78e0ff8af872fdc5cdf5354174fc713141102) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/tests')
-rw-r--r--bitbake/lib/toaster/tests/functional/test_project_page.py124
-rw-r--r--bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py58
2 files changed, 91 insertions, 91 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_project_page.py b/bitbake/lib/toaster/tests/functional/test_project_page.py
index 8b34658418..5d10513d9d 100644
--- a/bitbake/lib/toaster/tests/functional/test_project_page.py
+++ b/bitbake/lib/toaster/tests/functional/test_project_page.py
@@ -272,8 +272,8 @@ class TestProjectPage(SeleniumFunctionalTestCase):
272 logo_img = logo.find_element(By.TAG_NAME, 'img') 272 logo_img = logo.find_element(By.TAG_NAME, 'img')
273 self.assertTrue(logo_img.is_displayed(), 273 self.assertTrue(logo_img.is_displayed(),
274 'Logo of Yocto project not found') 274 'Logo of Yocto project not found')
275 self.assertTrue( 275 self.assertIn(
276 '/static/img/logo.png' in str(logo_img.get_attribute('src')), 276 '/static/img/logo.png', str(logo_img.get_attribute('src')),
277 'Logo of Yocto project not found' 277 'Logo of Yocto project not found'
278 ) 278 )
279 # "Toaster"+" Information icon", clickable 279 # "Toaster"+" Information icon", clickable
@@ -282,34 +282,34 @@ class TestProjectPage(SeleniumFunctionalTestCase):
282 "//div[@class='toaster-navbar-brand']//a[@class='brand']", 282 "//div[@class='toaster-navbar-brand']//a[@class='brand']",
283 ) 283 )
284 self.assertTrue(toaster.is_displayed(), 'Toaster not found') 284 self.assertTrue(toaster.is_displayed(), 'Toaster not found')
285 self.assertTrue(toaster.text == 'Toaster') 285 self.assertEqual(toaster.text, 'Toaster')
286 info_sign = self.find('.glyphicon-info-sign') 286 info_sign = self.find('.glyphicon-info-sign')
287 self.assertTrue(info_sign.is_displayed()) 287 self.assertTrue(info_sign.is_displayed())
288 288
289 # "Server Icon" + "All builds" 289 # "Server Icon" + "All builds"
290 all_builds = self.find('#navbar-all-builds') 290 all_builds = self.find('#navbar-all-builds')
291 all_builds_link = all_builds.find_element(By.TAG_NAME, 'a') 291 all_builds_link = all_builds.find_element(By.TAG_NAME, 'a')
292 self.assertTrue("All builds" in all_builds_link.text) 292 self.assertIn("All builds", all_builds_link.text)
293 self.assertTrue( 293 self.assertIn(
294 '/toastergui/builds/' in str(all_builds_link.get_attribute('href')) 294 '/toastergui/builds/', str(all_builds_link.get_attribute('href'))
295 ) 295 )
296 server_icon = all_builds.find_element(By.TAG_NAME, 'i') 296 server_icon = all_builds.find_element(By.TAG_NAME, 'i')
297 self.assertTrue( 297 self.assertEqual(
298 server_icon.get_attribute('class') == 'glyphicon glyphicon-tasks' 298 server_icon.get_attribute('class'), 'glyphicon glyphicon-tasks'
299 ) 299 )
300 self.assertTrue(server_icon.is_displayed()) 300 self.assertTrue(server_icon.is_displayed())
301 301
302 # "Directory Icon" + "All projects" 302 # "Directory Icon" + "All projects"
303 all_projects = self.find('#navbar-all-projects') 303 all_projects = self.find('#navbar-all-projects')
304 all_projects_link = all_projects.find_element(By.TAG_NAME, 'a') 304 all_projects_link = all_projects.find_element(By.TAG_NAME, 'a')
305 self.assertTrue("All projects" in all_projects_link.text) 305 self.assertIn("All projects", all_projects_link.text)
306 self.assertTrue( 306 self.assertIn(
307 '/toastergui/projects/' in str(all_projects_link.get_attribute( 307 '/toastergui/projects/', str(all_projects_link.get_attribute(
308 'href')) 308 'href'))
309 ) 309 )
310 dir_icon = all_projects.find_element(By.TAG_NAME, 'i') 310 dir_icon = all_projects.find_element(By.TAG_NAME, 'i')
311 self.assertTrue( 311 self.assertEqual(
312 dir_icon.get_attribute('class') == 'icon-folder-open' 312 dir_icon.get_attribute('class'), 'icon-folder-open'
313 ) 313 )
314 self.assertTrue(dir_icon.is_displayed()) 314 self.assertTrue(dir_icon.is_displayed())
315 315
@@ -317,23 +317,23 @@ class TestProjectPage(SeleniumFunctionalTestCase):
317 toaster_docs_link = self.find('#navbar-docs') 317 toaster_docs_link = self.find('#navbar-docs')
318 toaster_docs_link_link = toaster_docs_link.find_element(By.TAG_NAME, 318 toaster_docs_link_link = toaster_docs_link.find_element(By.TAG_NAME,
319 'a') 319 'a')
320 self.assertTrue("Documentation" in toaster_docs_link_link.text) 320 self.assertIn("Documentation", toaster_docs_link_link.text)
321 self.assertTrue( 321 self.assertEqual(
322 toaster_docs_link_link.get_attribute('href') == 'http://docs.yoctoproject.org/toaster-manual/index.html#toaster-user-manual' 322 toaster_docs_link_link.get_attribute('href'), 'http://docs.yoctoproject.org/toaster-manual/index.html#toaster-user-manual'
323 ) 323 )
324 book_icon = toaster_docs_link.find_element(By.TAG_NAME, 'i') 324 book_icon = toaster_docs_link.find_element(By.TAG_NAME, 'i')
325 self.assertTrue( 325 self.assertEqual(
326 book_icon.get_attribute('class') == 'glyphicon glyphicon-book' 326 book_icon.get_attribute('class'), 'glyphicon glyphicon-book'
327 ) 327 )
328 self.assertTrue(book_icon.is_displayed()) 328 self.assertTrue(book_icon.is_displayed())
329 329
330 # AT RIGHT -> button "New project" 330 # AT RIGHT -> button "New project"
331 new_project_button = self.find('#new-project-button') 331 new_project_button = self.find('#new-project-button')
332 self.assertTrue(new_project_button.is_displayed()) 332 self.assertTrue(new_project_button.is_displayed())
333 self.assertTrue(new_project_button.text == 'New project') 333 self.assertEqual(new_project_button.text, 'New project')
334 new_project_button.click() 334 new_project_button.click()
335 self.assertTrue( 335 self.assertIn(
336 '/toastergui/newproject/' in str(self.driver.current_url) 336 '/toastergui/newproject/', str(self.driver.current_url)
337 ) 337 )
338 338
339 def test_edit_project_name(self): 339 def test_edit_project_name(self):
@@ -358,8 +358,8 @@ class TestProjectPage(SeleniumFunctionalTestCase):
358 358
359 # check project name is changed 359 # check project name is changed
360 self.wait_until_visible('#project-name-container') 360 self.wait_until_visible('#project-name-container')
361 self.assertTrue( 361 self.assertIn(
362 'New Name' in str(self.find('#project-name-container').text) 362 'New Name', str(self.find('#project-name-container').text)
363 ) 363 )
364 364
365 def test_project_page_tabs(self): 365 def test_project_page_tabs(self):
@@ -376,10 +376,10 @@ class TestProjectPage(SeleniumFunctionalTestCase):
376 # check "configuration" tab 376 # check "configuration" tab
377 self.wait_until_visible('#topbar-configuration-tab') 377 self.wait_until_visible('#topbar-configuration-tab')
378 config_tab = self.find('#topbar-configuration-tab') 378 config_tab = self.find('#topbar-configuration-tab')
379 self.assertTrue(config_tab.get_attribute('class') == 'active') 379 self.assertEqual(config_tab.get_attribute('class'), 'active')
380 self.assertTrue('Configuration' in str(config_tab.text)) 380 self.assertIn('Configuration', str(config_tab.text))
381 self.assertTrue( 381 self.assertIn(
382 f"/toastergui/project/{TestProjectPage.project_id}" in str(self.driver.current_url) 382 f"/toastergui/project/{TestProjectPage.project_id}", str(self.driver.current_url)
383 ) 383 )
384 384
385 def get_tabs(): 385 def get_tabs():
@@ -392,9 +392,9 @@ class TestProjectPage(SeleniumFunctionalTestCase):
392 def check_tab_link(tab_index, tab_name, url): 392 def check_tab_link(tab_index, tab_name, url):
393 tab = get_tabs()[tab_index] 393 tab = get_tabs()[tab_index]
394 tab_link = tab.find_element(By.TAG_NAME, 'a') 394 tab_link = tab.find_element(By.TAG_NAME, 'a')
395 self.assertTrue(url in tab_link.get_attribute('href')) 395 self.assertIn(url, tab_link.get_attribute('href'))
396 self.assertTrue(tab_name in tab_link.text) 396 self.assertIn(tab_name, tab_link.text)
397 self.assertTrue(tab.get_attribute('class') == 'active') 397 self.assertEqual(tab.get_attribute('class'), 'active')
398 398
399 # check "Builds" tab 399 # check "Builds" tab
400 builds_tab = get_tabs()[1] 400 builds_tab = get_tabs()[1]
@@ -433,8 +433,8 @@ class TestProjectPage(SeleniumFunctionalTestCase):
433 '//div[@id="latest-builds"]', 433 '//div[@id="latest-builds"]',
434 ) 434 )
435 last_build = lastest_builds[0] 435 last_build = lastest_builds[0]
436 self.assertTrue( 436 self.assertIn(
437 'core-image-minimal' in str(last_build.text) 437 'core-image-minimal', str(last_build.text)
438 ) 438 )
439 439
440 def test_softwareRecipe_page(self): 440 def test_softwareRecipe_page(self):
@@ -446,7 +446,7 @@ class TestProjectPage(SeleniumFunctionalTestCase):
446 """ 446 """
447 self._navigate_to_config_nav('softwarerecipestable', 4) 447 self._navigate_to_config_nav('softwarerecipestable', 4)
448 # check title "Compatible software recipes" is displayed 448 # check title "Compatible software recipes" is displayed
449 self.assertTrue("Compatible software recipes" in self.get_page_source()) 449 self.assertIn("Compatible software recipes", self.get_page_source())
450 # Test search input 450 # Test search input
451 self._mixin_test_table_search_input( 451 self._mixin_test_table_search_input(
452 input_selector='search-input-softwarerecipestable', 452 input_selector='search-input-softwarerecipestable',
@@ -510,7 +510,7 @@ class TestProjectPage(SeleniumFunctionalTestCase):
510 """ 510 """
511 self._navigate_to_config_nav('machinestable', 5) 511 self._navigate_to_config_nav('machinestable', 5)
512 # check title "Compatible software recipes" is displayed 512 # check title "Compatible software recipes" is displayed
513 self.assertTrue("Compatible machines" in self.get_page_source()) 513 self.assertIn("Compatible machines", self.get_page_source())
514 # Test search input 514 # Test search input
515 self._mixin_test_table_search_input( 515 self._mixin_test_table_search_input(
516 input_selector='search-input-machinestable', 516 input_selector='search-input-machinestable',
@@ -528,8 +528,8 @@ class TestProjectPage(SeleniumFunctionalTestCase):
528 select_btn.send_keys(Keys.RETURN) 528 select_btn.send_keys(Keys.RETURN)
529 self.wait_until_visible('#config-nav') 529 self.wait_until_visible('#config-nav')
530 project_machine_name = self.find('#project-machine-name') 530 project_machine_name = self.find('#project-machine-name')
531 self.assertTrue( 531 self.assertIn(
532 'qemux86-64' in project_machine_name.text 532 'qemux86-64', project_machine_name.text
533 ) 533 )
534 # check "Add layer" button works 534 # check "Add layer" button works
535 self._navigate_to_config_nav('machinestable', 5) 535 self._navigate_to_config_nav('machinestable', 5)
@@ -547,8 +547,8 @@ class TestProjectPage(SeleniumFunctionalTestCase):
547 add_btn.click() 547 add_btn.click()
548 self.wait_until_visible('#change-notification') 548 self.wait_until_visible('#change-notification')
549 change_notification = self.find('#change-notification') 549 change_notification = self.find('#change-notification')
550 self.assertTrue( 550 self.assertIn(
551 f'You have added 1 layer to your project' in str(change_notification.text) 551 f'You have added 1 layer to your project', str(change_notification.text)
552 ) 552 )
553 # check Machine table feature(show/hide column, pagination) 553 # check Machine table feature(show/hide column, pagination)
554 self._navigate_to_config_nav('machinestable', 5) 554 self._navigate_to_config_nav('machinestable', 5)
@@ -580,7 +580,7 @@ class TestProjectPage(SeleniumFunctionalTestCase):
580 """ 580 """
581 self._navigate_to_config_nav('layerstable', 6) 581 self._navigate_to_config_nav('layerstable', 6)
582 # check title "Compatible layers" is displayed 582 # check title "Compatible layers" is displayed
583 self.assertTrue("Compatible layers" in self.get_page_source()) 583 self.assertIn("Compatible layers", self.get_page_source())
584 # Test search input 584 # Test search input
585 input_text='meta-tanowrt' 585 input_text='meta-tanowrt'
586 self._mixin_test_table_search_input( 586 self._mixin_test_table_search_input(
@@ -609,8 +609,8 @@ class TestProjectPage(SeleniumFunctionalTestCase):
609 add_layers_btn.click() 609 add_layers_btn.click()
610 self.wait_until_visible('#change-notification') 610 self.wait_until_visible('#change-notification')
611 change_notification = self.find('#change-notification') 611 change_notification = self.find('#change-notification')
612 self.assertTrue( 612 self.assertIn(
613 f'You have added {len(list_dependencies)+1} layers to your project: {input_text} and its dependencies' in str(change_notification.text) 613 f'You have added {len(list_dependencies)+1} layers to your project: {input_text} and its dependencies', str(change_notification.text)
614 ) 614 )
615 # check "Remove layer" button works 615 # check "Remove layer" button works
616 self.wait_until_visible('#layerstable tbody tr', poll=3) 616 self.wait_until_visible('#layerstable tbody tr', poll=3)
@@ -623,8 +623,8 @@ class TestProjectPage(SeleniumFunctionalTestCase):
623 remove_btn.click() 623 remove_btn.click()
624 self.wait_until_visible('#change-notification', poll=2) 624 self.wait_until_visible('#change-notification', poll=2)
625 change_notification = self.find('#change-notification') 625 change_notification = self.find('#change-notification')
626 self.assertTrue( 626 self.assertIn(
627 f'You have removed 1 layer from your project: {input_text}' in str(change_notification.text) 627 f'You have removed 1 layer from your project: {input_text}', str(change_notification.text)
628 ) 628 )
629 # check layers table feature(show/hide column, pagination) 629 # check layers table feature(show/hide column, pagination)
630 self._navigate_to_config_nav('layerstable', 6) 630 self._navigate_to_config_nav('layerstable', 6)
@@ -656,7 +656,7 @@ class TestProjectPage(SeleniumFunctionalTestCase):
656 """ 656 """
657 self._navigate_to_config_nav('distrostable', 7) 657 self._navigate_to_config_nav('distrostable', 7)
658 # check title "Compatible distros" is displayed 658 # check title "Compatible distros" is displayed
659 self.assertTrue("Compatible Distros" in self.get_page_source()) 659 self.assertIn("Compatible Distros", self.get_page_source())
660 # Test search input 660 # Test search input
661 input_text='poky-altcfg' 661 input_text='poky-altcfg'
662 self._mixin_test_table_search_input( 662 self._mixin_test_table_search_input(
@@ -675,8 +675,8 @@ class TestProjectPage(SeleniumFunctionalTestCase):
675 add_btn.click() 675 add_btn.click()
676 self.wait_until_visible('#change-notification', poll=2) 676 self.wait_until_visible('#change-notification', poll=2)
677 change_notification = self.find('#change-notification') 677 change_notification = self.find('#change-notification')
678 self.assertTrue( 678 self.assertIn(
679 f'You have changed the distro to: {input_text}' in str(change_notification.text) 679 f'You have changed the distro to: {input_text}', str(change_notification.text)
680 ) 680 )
681 # check distro table feature(show/hide column, pagination) 681 # check distro table feature(show/hide column, pagination)
682 self._navigate_to_config_nav('distrostable', 7) 682 self._navigate_to_config_nav('distrostable', 7)
@@ -736,24 +736,24 @@ class TestProjectPage(SeleniumFunctionalTestCase):
736 self.assertEqual(len(tabs), 3) 736 self.assertEqual(len(tabs), 3)
737 # Check first tab 737 # Check first tab
738 tabs[0].click() 738 tabs[0].click()
739 self.assertTrue( 739 self.assertIn(
740 'active' in str(self.find('#information').get_attribute('class')) 740 'active', str(self.find('#information').get_attribute('class'))
741 ) 741 )
742 # Check second tab (recipes) 742 # Check second tab (recipes)
743 # Ensure page is scrolled to the top 743 # Ensure page is scrolled to the top
744 self.driver.find_element(By.XPATH, '//body').send_keys(Keys.CONTROL + Keys.HOME) 744 self.driver.find_element(By.XPATH, '//body').send_keys(Keys.CONTROL + Keys.HOME)
745 self.wait_until_visible('.nav-tabs') 745 self.wait_until_visible('.nav-tabs')
746 tabs[1].click() 746 tabs[1].click()
747 self.assertTrue( 747 self.assertIn(
748 'active' in str(self.find('#recipes').get_attribute('class')) 748 'active', str(self.find('#recipes').get_attribute('class'))
749 ) 749 )
750 # Check third tab (machines) 750 # Check third tab (machines)
751 # Ensure page is scrolled to the top 751 # Ensure page is scrolled to the top
752 self.driver.find_element(By.XPATH, '//body').send_keys(Keys.CONTROL + Keys.HOME) 752 self.driver.find_element(By.XPATH, '//body').send_keys(Keys.CONTROL + Keys.HOME)
753 self.wait_until_visible('.nav-tabs') 753 self.wait_until_visible('.nav-tabs')
754 tabs[2].click() 754 tabs[2].click()
755 self.assertTrue( 755 self.assertIn(
756 'active' in str(self.find('#machines').get_attribute('class')) 756 'active', str(self.find('#machines').get_attribute('class'))
757 ) 757 )
758 # Check left section is displayed 758 # Check left section is displayed
759 section = self.find('.well') 759 section = self.find('.well')
@@ -762,9 +762,9 @@ class TestProjectPage(SeleniumFunctionalTestCase):
762 section.find_element(By.XPATH, '//h2[1]').is_displayed() 762 section.find_element(By.XPATH, '//h2[1]').is_displayed()
763 ) 763 )
764 # Check layer summary 764 # Check layer summary
765 self.assertTrue("Summary" in section.text) 765 self.assertIn("Summary", section.text)
766 # Check layer description 766 # Check layer description
767 self.assertTrue("Description" in section.text) 767 self.assertIn("Description", section.text)
768 768
769 def test_single_recipe_page(self): 769 def test_single_recipe_page(self):
770 """ Test recipe page 770 """ Test recipe page
@@ -794,11 +794,11 @@ class TestProjectPage(SeleniumFunctionalTestCase):
794 section.find_element(By.XPATH, '//h2[1]').is_displayed() 794 section.find_element(By.XPATH, '//h2[1]').is_displayed()
795 ) 795 )
796 # Check recipe sections details info are displayed 796 # Check recipe sections details info are displayed
797 self.assertTrue("Summary" in section.text) 797 self.assertIn("Summary", section.text)
798 self.assertTrue("Description" in section.text) 798 self.assertIn("Description", section.text)
799 self.assertTrue("Version" in section.text) 799 self.assertIn("Version", section.text)
800 self.assertTrue("Section" in section.text) 800 self.assertIn("Section", section.text)
801 self.assertTrue("License" in section.text) 801 self.assertIn("License", section.text)
802 self.assertTrue("Approx. packages included" in section.text) 802 self.assertIn("Approx. packages included", section.text)
803 self.assertTrue("Approx. package size" in section.text) 803 self.assertIn("Approx. package size", section.text)
804 self.assertTrue("Recipe file" in section.text) 804 self.assertIn("Recipe file", section.text)
diff --git a/bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py b/bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py
index eb905ddf3f..5da9706b29 100644
--- a/bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py
+++ b/bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py
@@ -88,8 +88,8 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
88 '//div[@id="latest-builds"]/div', 88 '//div[@id="latest-builds"]/div',
89 ) 89 )
90 last_build = lastest_builds[0] 90 last_build = lastest_builds[0]
91 self.assertTrue( 91 self.assertIn(
92 'foo' in str(last_build.text) 92 'foo', str(last_build.text)
93 ) 93 )
94 last_build = lastest_builds[0] 94 last_build = lastest_builds[0]
95 try: 95 try:
@@ -138,24 +138,24 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
138 138
139 def check_config_nav_item(index, item_name, url): 139 def check_config_nav_item(index, item_name, url):
140 item = _get_config_nav_item(index) 140 item = _get_config_nav_item(index)
141 self.assertTrue(item_name in item.text) 141 self.assertIn(item_name, item.text)
142 self.assertTrue(item.get_attribute('class') == 'active') 142 self.assertEqual(item.get_attribute('class'), 'active')
143 self.assertTrue(url in self.driver.current_url) 143 self.assertIn(url, self.driver.current_url)
144 144
145 # check if the menu contains the right elements 145 # check if the menu contains the right elements
146 # COMPATIBLE METADATA 146 # COMPATIBLE METADATA
147 compatible_metadata = _get_config_nav_item(1) 147 compatible_metadata = _get_config_nav_item(1)
148 self.assertTrue( 148 self.assertIn(
149 "compatible metadata" in compatible_metadata.text.lower() 149 "compatible metadata", compatible_metadata.text.lower()
150 ) 150 )
151 # EXTRA CONFIGURATION 151 # EXTRA CONFIGURATION
152 extra_configuration = _get_config_nav_item(8) 152 extra_configuration = _get_config_nav_item(8)
153 self.assertTrue( 153 self.assertIn(
154 "extra configuration" in extra_configuration.text.lower() 154 "extra configuration", extra_configuration.text.lower()
155 ) 155 )
156 # Actions 156 # Actions
157 actions = _get_config_nav_item(10) 157 actions = _get_config_nav_item(10)
158 self.assertTrue("actions" in str(actions.text).lower()) 158 self.assertIn("actions", str(actions.text).lower())
159 159
160 conf_nav_list = [ 160 conf_nav_list = [
161 # config 161 # config
@@ -313,7 +313,7 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
313 def check_machine_distro(self, item_name, new_item_name, block_id): 313 def check_machine_distro(self, item_name, new_item_name, block_id):
314 block = self.find(f'#{block_id}') 314 block = self.find(f'#{block_id}')
315 title = block.find_element(By.TAG_NAME, 'h3') 315 title = block.find_element(By.TAG_NAME, 'h3')
316 self.assertTrue(item_name.capitalize() in title.text) 316 self.assertIn(item_name.capitalize(), title.text)
317 edit_btn = self.find(f'#change-{item_name}-toggle') 317 edit_btn = self.find(f'#change-{item_name}-toggle')
318 edit_btn.click() 318 edit_btn.click()
319 self.wait_until_visible(f'#{item_name}-change-input') 319 self.wait_until_visible(f'#{item_name}-change-input')
@@ -324,11 +324,11 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
324 change_btn.click() 324 change_btn.click()
325 self.wait_until_visible(f'#project-{item_name}-name') 325 self.wait_until_visible(f'#project-{item_name}-name')
326 project_name = self.find(f'#project-{item_name}-name') 326 project_name = self.find(f'#project-{item_name}-name')
327 self.assertTrue(new_item_name in project_name.text) 327 self.assertIn(new_item_name, project_name.text)
328 # check change notificaiton is displayed 328 # check change notificaiton is displayed
329 change_notification = self.find('#change-notification') 329 change_notification = self.find('#change-notification')
330 self.assertTrue( 330 self.assertIn(
331 f'You have changed the {item_name} to: {new_item_name}' in change_notification.text 331 f'You have changed the {item_name} to: {new_item_name}', change_notification.text
332 ) 332 )
333 333
334 # Machine 334 # Machine
@@ -338,13 +338,13 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
338 338
339 # Project release 339 # Project release
340 title = project_release.find_element(By.TAG_NAME, 'h3') 340 title = project_release.find_element(By.TAG_NAME, 'h3')
341 self.assertTrue("Project release" in title.text) 341 self.assertIn("Project release", title.text)
342 self.assertTrue( 342 self.assertIn(
343 "Yocto Project master" in self.find('#project-release-title').text 343 "Yocto Project master", self.find('#project-release-title').text
344 ) 344 )
345 # Layers 345 # Layers
346 title = layers.find_element(By.TAG_NAME, 'h3') 346 title = layers.find_element(By.TAG_NAME, 'h3')
347 self.assertTrue("Layers" in title.text) 347 self.assertIn("Layers", title.text)
348 # check at least three layers are displayed 348 # check at least three layers are displayed
349 # openembedded-core 349 # openembedded-core
350 # meta-poky 350 # meta-poky
@@ -372,7 +372,7 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
372 self.wait_until_visible('#layers-in-project-list') 372 self.wait_until_visible('#layers-in-project-list')
373 # check layer is added 373 # check layer is added
374 layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') 374 layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li')
375 self.assertTrue(len(layers_list_items) == 4) 375 self.assertEqual(len(layers_list_items), 4)
376 376
377 def test_most_build_recipes(self): 377 def test_most_build_recipes(self):
378 """ Test most build recipes block contains""" 378 """ Test most build recipes block contains"""
@@ -418,14 +418,14 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
418 most_built_recipes = self.driver.find_element( 418 most_built_recipes = self.driver.find_element(
419 By.XPATH, '//*[@id="project-page"]/div[1]/div[3]') 419 By.XPATH, '//*[@id="project-page"]/div[1]/div[3]')
420 title = most_built_recipes.find_element(By.TAG_NAME, 'h3') 420 title = most_built_recipes.find_element(By.TAG_NAME, 'h3')
421 self.assertTrue("Most built recipes" in title.text) 421 self.assertIn("Most built recipes", title.text)
422 # check can select a recipe and build it 422 # check can select a recipe and build it
423 self.wait_until_visible('#freq-build-list', poll=3) 423 self.wait_until_visible('#freq-build-list', poll=3)
424 recipe_list = self.find('#freq-build-list') 424 recipe_list = self.find('#freq-build-list')
425 recipe_list_items = recipe_list.find_elements(By.TAG_NAME, 'li') 425 recipe_list_items = recipe_list.find_elements(By.TAG_NAME, 'li')
426 self.assertTrue( 426 self.assertTrue(
427 len(recipe_list_items) > 0, 427 len(recipe_list_items) > 0,
428 msg="Any recipes found in the most built recipes list", 428 msg="No recipes found in the most built recipes list",
429 ) 429 )
430 rebuild_from_most_build_recipes(recipe_list_items) 430 rebuild_from_most_build_recipes(recipe_list_items)
431 TestProjectConfigTab.project_id = None # reset project id 431 TestProjectConfigTab.project_id = None # reset project id
@@ -466,8 +466,8 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
466 layers = block_l.find_element(By.ID, 'layer-container') 466 layers = block_l.find_element(By.ID, 'layer-container')
467 layers_list = layers.find_element(By.ID, 'layers-in-project-list') 467 layers_list = layers.find_element(By.ID, 'layers-in-project-list')
468 layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') 468 layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li')
469 self.assertTrue( 469 self.assertIn(
470 'meta-fake' in str(layers_list_items[-1].text) 470 'meta-fake', str(layers_list_items[-1].text)
471 ) 471 )
472 472
473 def test_project_page_custom_image_no_image(self): 473 def test_project_page_custom_image_no_image(self):
@@ -482,8 +482,8 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
482 self.wait_until_visible('#empty-state-customimagestable') 482 self.wait_until_visible('#empty-state-customimagestable')
483 483
484 # Check message when no custom image 484 # Check message when no custom image
485 self.assertTrue( 485 self.assertIn(
486 "You have not created any custom images yet." in str( 486 "You have not created any custom images yet.", str(
487 self.find('#empty-state-customimagestable').text 487 self.find('#empty-state-customimagestable').text
488 ) 488 )
489 ) 489 )
@@ -491,13 +491,13 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase):
491 link_create_custom_image = div_empty_msg.find_element( 491 link_create_custom_image = div_empty_msg.find_element(
492 By.TAG_NAME, 'a') 492 By.TAG_NAME, 'a')
493 self.assertTrue(TestProjectConfigTab.project_id is not None) 493 self.assertTrue(TestProjectConfigTab.project_id is not None)
494 self.assertTrue( 494 self.assertIn(
495 f"/toastergui/project/{TestProjectConfigTab.project_id}/newcustomimage" in str( 495 f"/toastergui/project/{TestProjectConfigTab.project_id}/newcustomimage", str(
496 link_create_custom_image.get_attribute('href') 496 link_create_custom_image.get_attribute('href')
497 ) 497 )
498 ) 498 )
499 self.assertTrue( 499 self.assertIn(
500 "Create your first custom image" in str( 500 "Create your first custom image", str(
501 link_create_custom_image.text 501 link_create_custom_image.text
502 ) 502 )
503 ) 503 )