From 4e841ad3f7e54be91a2fd32399cbb718e20d5d0f Mon Sep 17 00:00:00 2001 From: Crypto Man Date: Sun, 1 Feb 2026 19:14:15 +0300 Subject: [PATCH] refactor: convert TC_01.002.05 to POM with DashboardLocators --- locators/dashboard_locators.py | 7 +++++ ...older_has_distinct_icon_on_dashboard_ya.py | 31 ------------------- ...older_has_distinct_icon_on_dashboard_ya.py | 21 +++++++++++++ 3 files changed, 28 insertions(+), 31 deletions(-) create mode 100644 locators/dashboard_locators.py delete mode 100644 tests/folder_project/test_folder_has_distinct_icon_on_dashboard_ya.py create mode 100644 tests/new_item/test_folder_has_distinct_icon_on_dashboard_ya.py diff --git a/locators/dashboard_locators.py b/locators/dashboard_locators.py new file mode 100644 index 00000000..bc3e7a41 --- /dev/null +++ b/locators/dashboard_locators.py @@ -0,0 +1,7 @@ +from locators.base_locators import BaseLocators + + +class DashboardLocators(BaseLocators): + @staticmethod + def folder_with_icon(folder_name): + return f"tr:has-text('{folder_name}') [class*='folder']" \ No newline at end of file diff --git a/tests/folder_project/test_folder_has_distinct_icon_on_dashboard_ya.py b/tests/folder_project/test_folder_has_distinct_icon_on_dashboard_ya.py deleted file mode 100644 index ed09ccb8..00000000 --- a/tests/folder_project/test_folder_has_distinct_icon_on_dashboard_ya.py +++ /dev/null @@ -1,31 +0,0 @@ -from playwright.sync_api import expect - -def test_tc_01_002_05(page): - page.goto("/") - - new_item_btn_loc = "a[href='/view/all/newJob']" - page.locator(new_item_btn_loc).click() - - item_name_field = "#name" - page.locator(item_name_field).fill("Autotests") - - folder_loc = "li.com_cloudbees_hudson_plugins_folder_Folder" - page.locator(folder_loc).click() - - ok_btn_loc = "button[id='ok-button']" - page.locator(ok_btn_loc).click() - - logo_jenkins_loc = "#jenkins-head-icon" - page.locator(logo_jenkins_loc).click() - - # Test - folder_icon = page.locator(".symbol-folder-outline") - expect(folder_icon.first).to_be_visible() - - icon_class = folder_icon.first.get_attribute("class") - assert "folder" in icon_class.lower(), f"Expected folder icon class, got: {icon_class}" - - - - - diff --git a/tests/new_item/test_folder_has_distinct_icon_on_dashboard_ya.py b/tests/new_item/test_folder_has_distinct_icon_on_dashboard_ya.py new file mode 100644 index 00000000..8e096a63 --- /dev/null +++ b/tests/new_item/test_folder_has_distinct_icon_on_dashboard_ya.py @@ -0,0 +1,21 @@ +import allure +from pages.base_page import BasePage +from utils.generators.project_generator import ProjectGenerator +from locators.dashboard_locators import DashboardLocators + + +@allure.title("TC_01.002.05 | New Item > Folder > Verify folder has a distinct icon on the dashboard") +def test_tc_01_002_05_folder_has_distinct_icon(page, create_job, open_page): + + folder_name = ProjectGenerator.generate_folder_name() + create_job(folder_name, job_type="folder") + base_page = open_page(BasePage, "/") + + locator = DashboardLocators.folder_with_icon(folder_name) + assert base_page.page.locator(locator).is_visible() + + + + + +