Skip to content

Commit 0d689cd

Browse files
Feature/bcss 20549–remove redundant page title verification methods from poms (#79)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> Replaced in pom page title verification methods with the basepage method that does the same thing. ## Context <!-- Why is this change required? What problem does it solve? --> Removes repetition and improves code maintainability. ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [x] Refactoring (non-breaking change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I am familiar with the [contributing guidelines](https://github.com/nhs-england-tools/playwright-python-blueprint/blob/main/CONTRIBUTING.md) - [ ] I have followed the code style of the project - [ ] I have added tests to cover my changes (where appropriate) - [ ] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.
1 parent 01bd025 commit 0d689cd

32 files changed

+64
-110
lines changed

pages/bowel_scope/bowel_scope_appointments_page.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ class BowelScopeAppointmentsPage(BasePage):
88
def __init__(self, page: Page):
99
super().__init__(page)
1010
self.page = page
11-
# Bowel Scope Appointments - page locators
12-
self.page_title = self.page.locator("#ntshPageTitle")
11+
# Bowel Scope Appointments - page locators, methods
1312

1413
def verify_page_title(self) -> None:
1514
"""Verifies the page title of the Bowel Scope Appointments page"""
16-
expect(self.page_title).to_contain_text("Appointment Calendar")
15+
self.bowel_cancer_screening_page_title_contains_text(
16+
"Appointment Calendar"
17+
)

pages/call_and_recall/age_extension_rollout_plans_page.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ class AgeExtensionRolloutPlansPage(BasePage):
88
def __init__(self, page: Page):
99
super().__init__(page)
1010
self.page = page
11-
# Age Extension Rollout Plans - page locators
12-
self.age_extension_rollout_plans_title = self.page.locator("#page-title")
11+
# Age Extension Rollout Plans - page locators, methods
1312

1413
def verify_age_extension_rollout_plans_title(self) -> None:
1514
"""Verifies the page title of the Age Extension Rollout Plans page"""
16-
expect(self.age_extension_rollout_plans_title).to_contain_text(
15+
self.bowel_cancer_screening_page_title_contains_text(
1716
"Age Extension Rollout Plans"
1817
)

pages/call_and_recall/create_a_plan_page.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def __init__(self, page: Page):
2323
self.save_note_button = self.page.locator("#saveNote").get_by_role(
2424
"button", name="Save"
2525
)
26-
self.create_a_plan_title = self.page.locator("#page-title")
2726

2827
def click_set_all_button(self) -> None:
2928
"""Clicks the Set all button to set all values"""
@@ -59,4 +58,4 @@ def click_save_note_button(self) -> None:
5958

6059
def verify_create_a_plan_title(self) -> None:
6160
"""Verifies the Create a Plan page title"""
62-
expect(self.create_a_plan_title).to_contain_text("View a plan")
61+
self.bowel_cancer_screening_page_title_contains_text("View a plan")

pages/call_and_recall/generate_invitations_page.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def __init__(self, page: Page):
1818
self.refresh_button = self.page.get_by_role("button", name="Refresh")
1919
self.planned_invitations_total = self.page.locator("#col8_total")
2020
self.self_referrals_total = self.page.locator("#col9_total")
21-
self.generate_invitations_title = self.page.locator("#ntshPageTitle")
2221

2322
def click_generate_invitations_button(self) -> None:
2423
"""This function is used to click the Generate Invitations button."""
@@ -30,11 +29,11 @@ def click_refresh_button(self) -> None:
3029

3130
def verify_generate_invitations_title(self) -> None:
3231
"""This function is used to verify the Generate Invitations page title."""
33-
expect(self.generate_invitations_title).to_contain_text("Generate Invitations")
32+
self.bowel_cancer_screening_page_title_contains_text("Generate Invitations")
3433

3534
def verify_invitation_generation_progress_title(self) -> None:
3635
"""This function is used to verify the Invitation Generation Progress page title."""
37-
expect(self.generate_invitations_title).to_contain_text(
36+
self.bowel_cancer_screening_page_title_contains_text(
3837
"Invitation Generation Progress"
3938
)
4039

pages/call_and_recall/invitations_monitoring_page.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ class InvitationsMonitoringPage(BasePage):
88
def __init__(self, page: Page):
99
super().__init__(page)
1010
self.page = page
11-
self.invitations_monitoring_title = self.page.locator("#page-title")
1211

1312
def go_to_invitation_plan_page(self, sc_id) -> None:
1413
self.click(self.page.get_by_role("link", name=sc_id))
1514

1615
def verify_invitations_monitoring_title(self) -> None:
17-
expect(self.invitations_monitoring_title).to_contain_text(
16+
self.bowel_cancer_screening_page_title_contains_text(
1817
"Invitations Monitoring - Screening Centre"
1918
)

pages/call_and_recall/non_invitations_days_page.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ class NonInvitationDaysPage(BasePage):
88
def __init__(self, page: Page):
99
super().__init__(page)
1010
self.page = page
11-
# Non Invitation Days - page locators
12-
self.non_invitations_days_title = self.page.locator("#ntshPageTitle")
11+
# Non Invitation Days - page locators, methods
1312

1413
def verify_non_invitation_days_tile(self) -> None:
1514
"""Verifies the page title of the Non Invitation Days page"""
16-
expect(self.non_invitations_days_title).to_contain_text("Non-Invitation Days")
15+
self.bowel_cancer_screening_page_title_contains_text("Non-Invitation Days")

pages/communication_production/batch_list_page.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def __init__(self, page: Page):
2323
self.batch_successfully_archived_msg = self.page.locator(
2424
'text="Batch Successfully Archived and Printed"'
2525
)
26-
self.batch_list_page_title = self.page.locator("#page-title")
2726
self.deadline_calendar_picker = self.page.locator("i")
2827
self.deadline_date_filter = self.page.get_by_role("cell", name="").get_by_role(
2928
"textbox"
@@ -35,7 +34,7 @@ def __init__(self, page: Page):
3534

3635
def verify_batch_list_page_title(self, text) -> None:
3736
"""Verify the Batch List page title is displayed as expected"""
38-
expect(self.batch_list_page_title).to_contain_text(text)
37+
self.bowel_cancer_screening_page_title_contains_text(text)
3938

4039
def verify_table_data(self, value) -> None:
4140
"""Verify the table data is displayed as expected"""

pages/communication_production/electronic_communications_management_page.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ class ElectronicCommunicationManagementPage(BasePage):
88
def __init__(self, page: Page):
99
super().__init__(page)
1010
self.page = page
11-
# Electronic Communication Management - page locators
12-
self.electronic_communication_management_title = self.page.locator(
13-
"#page-title"
14-
)
11+
# Electronic Communication Management - page locators, methods
1512

1613
def verify_electronic_communication_management_title(self) -> None:
1714
"""Verify the Electronic Communication Management page title is displayed as expected"""
18-
expect(self.electronic_communication_management_title).to_contain_text(
15+
self.bowel_cancer_screening_page_title_contains_text(
1916
"Electronic Communication Management"
2017
)

pages/communication_production/letter_library_index_page.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ class LetterLibraryIndexPage(BasePage):
88
def __init__(self, page: Page):
99
super().__init__(page)
1010
self.page = page
11-
# Letter Library Index - page locators
12-
self.letter_library_index_title = self.page.locator("#ntshPageTitle")
11+
# Letter Library Index - page locators, methods
1312

1413
def verify_letter_library_index_title(self) -> None:
1514
"""Verify the Letter Library Index page title is displayed as expected"""
16-
expect(self.letter_library_index_title).to_contain_text("Letter Library Index")
15+
self.bowel_cancer_screening_page_title_contains_text("Letter Library Index")

pages/communication_production/letter_signatory_page.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ class LetterSignatoryPage(BasePage):
88
def __init__(self, page: Page):
99
super().__init__(page)
1010
self.page = page
11-
# Letter Signatory - page locators
12-
self.letter_signatory_title = self.page.locator("#ntshPageTitle")
11+
# Letter Signatory - page locators, methods
1312

1413
def verify_letter_signatory_title(self) -> None:
1514
"""Verify the Letter Signatory page title is displayed as expected"""
16-
expect(self.letter_signatory_title).to_contain_text("Letter Signatory")
15+
self.bowel_cancer_screening_page_title_contains_text(
16+
"Letter Signatory"
17+
)

0 commit comments

Comments
 (0)