diff mbox series

[4/7] Toaster: Write UI TestCase -> Test project page tab "New custom image"

Message ID 20231121135131.107330-4-alassane.yattara@savoirfairelinux.com
State New
Headers show
Series [1/7] Toaster: Write UI TestCase -> Test project config tab navigation: | expand

Commit Message

Alassane Yattara Nov. 21, 2023, 1:51 p.m. UTC
Test project page tab "New custom image" when no custom image

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 .../test_project_page_tab_config.py           | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
diff mbox series

Patch

diff --git a/lib/toaster/tests/functional/test_project_page_tab_config.py b/lib/toaster/tests/functional/test_project_page_tab_config.py
index 14a859a1..c6d952fd 100644
--- a/lib/toaster/tests/functional/test_project_page_tab_config.py
+++ b/lib/toaster/tests/functional/test_project_page_tab_config.py
@@ -349,3 +349,34 @@  class TestProjectConfigTab(SeleniumFunctionalTestCase):
         self.assertTrue(
             'meta-fake' in str(layers_list_items[-1].text)
         )
+
+    def test_project_page_custom_image_no_image(self):
+        """ Test project page tab "New custom image" when no custom image """
+        # navigate to the project page
+        url = reverse("project", args=(1,))
+        self.get(url)
+
+        # navigate to "Custom image" tab
+        custom_image_section = self._get_config_nav_item(2)
+        custom_image_section.click()
+        self.wait_until_visible('#empty-state-customimagestable')
+
+        # Check message when no custom image
+        self.assertTrue(
+            "You have not created any custom images yet." in str(
+                self.find('#empty-state-customimagestable').text
+            )
+        )
+        div_empty_msg = self.find('#empty-state-customimagestable')
+        link_create_custom_image = div_empty_msg.find_element(
+            By.TAG_NAME, 'a')
+        self.assertTrue(
+            f"/toastergui/project/1/newcustomimage" in str(
+                link_create_custom_image.get_attribute('href')
+            )
+        )
+        self.assertTrue(
+            "Create your first custom image" in str(
+                link_create_custom_image.text
+            )
+        )