Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion locators/base_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class BaseLocators:
NEW_ITEM_BUTTON = "a[href='/view/all/newJob']"
OK_BUTTON = "button#ok-button"
SAVE_BUTTON = "button[name='Submit']"
NAME_OF_CREATED_PROJECT = lambda job_name: f"td a[href='job/{job_name}/']"
NAME_OF_CREATED_PROJECT = lambda job_name: f"td a[href='job/{job_name}/']"

class BaseConfigurationPageLocators:
TEXTAREA_DESCRIPTION = "//div[normalize-space()='Description']/following-sibling::div[1]//textarea"
Expand All @@ -12,3 +12,10 @@ class BaseConfigurationPageLocators:
TOGGLE_LABEL = "label[for='enable-disable-project']"
DISABLED_MESSAGE_TEXT = "This project is currently disabled"
DISABLED_MESSAGE_TEXT_LOC = "form#enable-project"

# Side menu
HEALTH_METRICS = "button[data-section-id='health-metrics']"
HEALTH_METRICS_DROPDOWN_BUTTON_LOC = "button[class*='advancedButton']"
ADD_METRIC_BUTTON_LOC = "button[class*='hetero-list-add']"
DROPDOWN_TEXT_LOC = "//button[@class = 'jenkins-dropdown__item ']"

13 changes: 12 additions & 1 deletion pages/base_configuration_page.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import allure
from playwright.sync_api import expect

from data.data import BaseConfigurationPageData
from pages.base_page import BasePage
Expand Down Expand Up @@ -42,4 +43,14 @@ def assert_disable_text(self, actual_text):
self.assertion.assert_text(
expected_text=self.data.DISABLED_MESSAGE_TEXT,
actual_text=actual_text
)
)

def expect_locator_enabled(self, loc):
with allure.step("Expect locator is enabled"):
expect(self.page.locator(loc)).to_be_enabled()

def get_inner_text(self, loc):
with allure.step(f"Inner text"):
text = self.page.locator(loc).all_inner_texts()

return text
58 changes: 0 additions & 58 deletions tests/folder_project/conftest.py

This file was deleted.

42 changes: 34 additions & 8 deletions tests/folder_project/test_accessibility_folders_health_metric.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
import allure

from data.endpoints import Endpoints
from data.enums import ItemType
from pages.base_configuration_page import BaseConfigurationPage
from locators.base_locators import BaseLocators
from utils.generators.project_generator import ProjectGenerator

def test_05_002_01(page, new_folder):
folder_name = new_folder
configure_loc = "svg[class='icon-gear icon-md']"
health_metric_button_loc = "button[data-section-id='health-metrics']"

page.goto(f"/job/{folder_name}/")
page.click(configure_loc)
button_hm = page.locator(health_metric_button_loc)
assert button_hm.is_enabled(), "Кнопка недоступна"
@allure.epic("Folder")
@allure.feature("Essential features in folder")
class TestAccessibilityFoldersHealthMetrics:
generator = ProjectGenerator()
endpoints = Endpoints()
locators = BaseLocators()
item_type = ItemType

@allure.story("Health metrics")
def test_click_health_metrics_05_002_01(self, create_job, open_page):
folder_job = create_job(self.generator.generate_folder_name(), self.item_type.FOLDER)
configuration_page = open_page(BaseConfigurationPage,
self.endpoints.JOB_CONFIGURE_URL(folder_job))
button_hm = self.locators.BaseConfigurationPageLocators.HEALTH_METRICS
configuration_page.click(button_hm)
configuration_page.expect_locator_enabled(button_hm)

@allure.story("Health metrics")
def test_click_health_metrics_tc_05_002_02(self, create_job, open_page):
folder_job = create_job(self.generator.generate_folder_name(), self.item_type.FOLDER)
configuration_page = open_page(BaseConfigurationPage,
self.endpoints.JOB_CONFIGURE_URL(folder_job))
configuration_page.click(self.locators.BaseConfigurationPageLocators.HEALTH_METRICS)
configuration_page.click(self.locators.BaseConfigurationPageLocators.HEALTH_METRICS_DROPDOWN_BUTTON_LOC)
configuration_page.click(self.locators.BaseConfigurationPageLocators.ADD_METRIC_BUTTON_LOC)
inner_text = configuration_page.get_inner_text(self.locators.BaseConfigurationPageLocators.DROPDOWN_TEXT_LOC)

assert inner_text == ['Child item with the given name', 'Child item with worst health']
18 changes: 0 additions & 18 deletions tests/folder_project/test_button_add_healt_metric.py

This file was deleted.

16 changes: 0 additions & 16 deletions tests/folder_project/test_configuration_dublicat_ns.py

This file was deleted.