1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

bitbake: toaster/tests/functional: Fix later details page test issues

Consistently use meta-poky as the test target, instead of a magic number
ID which can vary.

Fix incorrect comments.

Also ensure the viewport is scrolled to the top when changing tabs.
This breaks if other layers are selected like openembedded-core due
to the number of recipes.

(Bitbake rev: 0bcb7b4a8d8e89647aa6179cc61e5eb55d433585)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2024-10-04 15:42:15 +01:00
parent b425ab56d3
commit d5c5076889
@@ -699,7 +699,7 @@ class TestProjectPage(SeleniumFunctionalTestCase):
) )
def test_single_layer_page(self): def test_single_layer_page(self):
""" Test layer page """ Test layer details page using meta-poky as an example (assumes is added to start with)
- Check if title is displayed - Check if title is displayed
- Check add/remove layer button works - Check add/remove layer button works
- Check tabs(layers, recipes, machines) are displayed - Check tabs(layers, recipes, machines) are displayed
@@ -708,13 +708,14 @@ class TestProjectPage(SeleniumFunctionalTestCase):
- Check layer summary - Check layer summary
- Check layer description - Check layer description
""" """
url = reverse("layerdetails", args=(TestProjectPage.project_id, 7)) self._navigate_to_config_nav('layerstable', 6)
self.get(url) layer_link = self.driver.find_element(By.XPATH, '//tr/td[@class="layer__name"]/a[contains(text(),"meta-poky")]')
layer_link.click()
self.wait_until_visible('.page-header') self.wait_until_visible('.page-header')
# check title is displayed # check title is displayed
self.assertTrue(self.find('.page-header h1').is_displayed()) self.assertTrue(self.find('.page-header h1').is_displayed())
# check add layer button works # check remove layer button works
remove_layer_btn = self.find('#add-remove-layer-btn') remove_layer_btn = self.find('#add-remove-layer-btn')
remove_layer_btn.click() remove_layer_btn.click()
self.wait_until_visible('#change-notification', poll=2) self.wait_until_visible('#change-notification', poll=2)
@@ -722,7 +723,7 @@ class TestProjectPage(SeleniumFunctionalTestCase):
self.assertIn( self.assertIn(
f'You have removed 1 layer from your project', str(change_notification.text) f'You have removed 1 layer from your project', str(change_notification.text)
) )
# check add layer button works, 18 is the random layer id # check add layer button works
add_layer_btn = self.find('#add-remove-layer-btn') add_layer_btn = self.find('#add-remove-layer-btn')
add_layer_btn.click() add_layer_btn.click()
self.wait_until_visible('#change-notification') self.wait_until_visible('#change-notification')
@@ -738,12 +739,18 @@ class TestProjectPage(SeleniumFunctionalTestCase):
self.assertTrue( self.assertTrue(
'active' in str(self.find('#information').get_attribute('class')) 'active' in str(self.find('#information').get_attribute('class'))
) )
# Check second tab # Check second tab (recipes)
# Ensure page is scrolled to the top
self.driver.find_element(By.XPATH, '//body').send_keys(Keys.CONTROL + Keys.HOME)
self.wait_until_visible('.nav-tabs')
tabs[1].click() tabs[1].click()
self.assertTrue( self.assertTrue(
'active' in str(self.find('#recipes').get_attribute('class')) 'active' in str(self.find('#recipes').get_attribute('class'))
) )
# Check third tab # Check third tab (machines)
# Ensure page is scrolled to the top
self.driver.find_element(By.XPATH, '//body').send_keys(Keys.CONTROL + Keys.HOME)
self.wait_until_visible('.nav-tabs')
tabs[2].click() tabs[2].click()
self.assertTrue( self.assertTrue(
'active' in str(self.find('#machines').get_attribute('class')) 'active' in str(self.find('#machines').get_attribute('class'))