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

Alassane Yattara <[email protected]> Tue, 21 Nov 2023 14:50:40 +0100
Newsgroups org.yoctoproject.lists.toaster
Message-ID <[email protected]>
Test project page tab "New custom image" when no custom image

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

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
+            )
+        )
-- 
2.34.1