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
16 changes: 15 additions & 1 deletion data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,18 @@ class BaseConfigurationPageData:
class ManageJenkinsData:
STATUS_INFORMATION = ["System Information", "System Log", "Load Statistics", "About Jenkins"]

TOOLS_AND_ACTIONS = ["Reload Configuration from Disk", "Jenkins CLI", "Script Console", "Prepare for Shutdown"]
TOOLS_AND_ACTIONS = ["Reload Configuration from Disk", "Jenkins CLI", "Script Console", "Prepare for Shutdown"]


class ItemTypesData:
ITEM_TYPES = [
"Freestyle project",
"Pipeline",
"Multi-configuration project",
"Folder",
"Multibranch Pipeline",
"Organization Folder",
]

class NewItemPageData:
EMPTY_ITEM_NAME_VALIDATION_TEXT = "» This field cannot be empty, please enter a valid name"
3 changes: 2 additions & 1 deletion data/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ class Endpoints:
JOB_STATUS_PAGE_URL = lambda self, job_name: f"/job/{job_name}"
MANAGE_URL = "/manage"
SECURITY_REALM_URL = "/securityRealm/"
VIEW_ALL_PAGE_URL = "/view/all/"
VIEW_ALL_PAGE_URL = "/view/all/"
ALL_NEW_JOB_URL = "/view/all/newJob"
26 changes: 26 additions & 0 deletions tests/new_item/test_blank_item_name_field_validation_rf_tn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from playwright.sync_api import expect
from locators.base_locators import BaseLocators
from locators.new_item_locators import NewItemLocators
from data.endpoints import Endpoints
from conftest import open_page
from pages.base_page import BasePage
from data.data import NewItemPageData
from data.data import ItemTypesData
import pytest




class TestBlankFieldValidation:
locators = BaseLocators(), NewItemLocators()
endpoints = Endpoints()


@pytest.mark.parametrize("item_type", ItemTypesData.ITEM_TYPES)
def test_tc_01_001_04_blank_item_name_validation_1(self, open_page, page, item_type):
"""TC_01.001.04 | New Item > Create a new item > Validation error when "Enter an item name" field is blank"""

open_page(BasePage, self.endpoints.ALL_NEW_JOB_URL)
page.get_by_text(item_type, exact=True).click()
expect(page.get_by_text(NewItemPageData.EMPTY_ITEM_NAME_VALIDATION_TEXT, exact=True)).to_be_visible()
expect(page.locator(BaseLocators.OK_BUTTON)).to_be_disabled()