Test layer page
    - Check if title is displayed
    - Check add/remove layer button works
    - Check tabs(layers, recipes, machines) are displayed
    - Check left section is displayed
        - Check layer name
        - Check layer summary
        - Check layer description

Signed-off-by: Alassane Yattara <[email protected]>
---
 .../tests/functional/test_project_page.py     | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/lib/toaster/tests/functional/test_project_page.py 
b/lib/toaster/tests/functional/test_project_page.py
index 70829509..771a8484 100644
--- a/lib/toaster/tests/functional/test_project_page.py
+++ b/lib/toaster/tests/functional/test_project_page.py
@@ -695,3 +695,64 @@ class TestProjectPage(SeleniumFunctionalTestCase):
             table_selector='distrostable',
             to_skip=[150]
         )
+
+    def test_single_layer_page(self):
+        """ Test layer page
+            - Check if title is displayed
+            - Check add/remove layer button works
+            - Check tabs(layers, recipes, machines) are displayed
+            - Check left section is displayed
+                - Check layer name
+                - Check layer summary
+                - Check layer description
+        """
+        url = reverse("layerdetails", args=(1, 8))
+        self.get(url)
+        self.wait_until_visible('.page-header')
+        # check title is displayed
+        self.assertTrue(self.find('.page-header h1').is_displayed())
+
+        # check add layer button works
+        remove_layer_btn = self.find('#add-remove-layer-btn')
+        remove_layer_btn.click()
+        self.wait_until_visible('#change-notification', poll=2)
+        change_notification = self.find('#change-notification')
+        self.assertTrue(
+            f'You have removed 1 layer from your project' in 
str(change_notification.text)
+        )
+        # check add layer button works, 18 is the random layer id
+        add_layer_btn = self.find('#add-remove-layer-btn')
+        add_layer_btn.click()
+        self.wait_until_visible('#change-notification')
+        change_notification = self.find('#change-notification')
+        self.assertTrue(
+            f'You have added 1 layer to your project' in 
str(change_notification.text)
+        )
+        # check tabs(layers, recipes, machines) are displayed
+        tabs = self.find_all('.nav-tabs li')
+        self.assertEqual(len(tabs), 3)
+        # Check first tab
+        tabs[0].click()
+        self.assertTrue(
+            'active' in str(self.find('#information').get_attribute('class'))
+        )
+        # Check second tab
+        tabs[1].click()
+        self.assertTrue(
+            'active' in str(self.find('#recipes').get_attribute('class'))
+        )
+        # Check third tab
+        tabs[2].click()
+        self.assertTrue(
+            'active' in str(self.find('#machines').get_attribute('class'))
+        )
+        # Check left section is displayed
+        section = self.find('.well')
+        # Check layer name
+        self.assertTrue(
+            section.find_element(By.XPATH, '//h2[1]').is_displayed()
+        )
+        # Check layer summary
+        self.assertTrue("Summary" in section.text)
+        # Check layer description
+        self.assertTrue("Description" in section.text)
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6032): https://lists.yoctoproject.org/g/toaster/message/6032
Mute This Topic: https://lists.yoctoproject.org/mt/102882950/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/toaster/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to