Skip to content

Commit ed0bf2c

Browse files
authored
Added docstrings and renamed POM files and Classes to include 'Page' (#47)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description Docstrings added to classes and methods/functions POM files renamed to include 'Page' Page Classes refactored to include 'Page' <!-- Describe your changes in detail. --> ## Context Following the implementation of our new Contribution Guidance, this ticket covers updating our existing code to be compliant with our new guidance. <!-- Why is this change required? What problem does it solve? --> ## 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) - [x] 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) - [x] I have followed the code style of the project - [ ] I have added tests to cover my changes (where appropriate) - [x] 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 ffae33e commit ed0bf2c

File tree

82 files changed

+789
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+789
-356
lines changed

pages/base_page.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44

55
class BasePage:
6+
"""Base Page locators and methods for interacting with the page."""
7+
68
def __init__(self, page: Page):
79
self.page = page
810
# Homepage/Navigation Bar links
@@ -51,42 +53,54 @@ def __init__(self, page: Page):
5153
self.main_menu__header = self.page.locator("#ntshPageTitle")
5254

5355
def click_main_menu_link(self) -> None:
56+
"""Click the Base Page 'Main Menu' link if it is visible."""
5457
if self.main_menu_link.is_visible():
5558
self.click(self.main_menu_link)
5659

5760
def click_log_out_link(self) -> None:
61+
"""Click the Base Page 'Log-out' link."""
5862
self.click(self.log_out_link)
5963

6064
def click_sub_menu_link(self) -> None:
65+
"""Click the Base Page 'Show Sub-menu' link."""
6166
self.click(self.sub_menu_link)
6267

6368
def click_hide_sub_menu_link(self) -> None:
69+
"""Click the Base Page 'Hide Sub-menu' link."""
6470
self.click(self.hide_sub_menu_link)
6571

6672
def click_select_org_link(self) -> None:
73+
"""Click the Base Page 'Select Org' link."""
6774
self.click(self.select_org_link)
6875

6976
def click_back_button(self) -> None:
77+
"""Click the Base Page 'Back' button."""
7078
self.click(self.back_button)
7179

7280
def click_release_notes_link(self) -> None:
81+
"""Click the Base Page 'Release Notes' link."""
7382
self.click(self.release_notes_link)
7483

7584
def click_refresh_alerts_link(self) -> None:
85+
"""Click the Base Page 'Refresh alerts' link."""
7686
self.click(self.refresh_alerts_link)
7787

7888
def click_user_guide_link(self) -> None:
89+
"""Click the Base Page 'User guide' link."""
7990
self.click(self.user_guide_link)
8091

8192
def click_help_link(self) -> None:
93+
"""Click the Base Page 'Help' link."""
8294
self.click(self.help_link)
8395

8496
def bowel_cancer_screening_system_header_is_displayed(self) -> None:
97+
"""Asserts that the Bowel Cancer Screening System header is displayed."""
8598
expect(self.bowel_cancer_screening_system_header).to_contain_text(
8699
"Bowel Cancer Screening System"
87100
)
88101

89102
def main_menu_header_is_displayed(self) -> None:
103+
"""Asserts that the Main Menu header is displayed."""
90104
expect(self.main_menu__header).to_contain_text("Main Menu")
91105

92106
def bowel_cancer_screening_page_title_contains_text(self, text: str) -> None:
@@ -106,39 +120,51 @@ def bowel_cancer_screening_page_title_contains_text(self, text: str) -> None:
106120
expect(self.bowel_cancer_screening_ntsh_page_title).to_contain_text(text)
107121

108122
def go_to_contacts_list_page(self) -> None:
123+
"""Click the Base Page 'Contacts List' link."""
109124
self.click(self.contacts_list_page)
110125

111126
def go_to_bowel_scope_page(self) -> None:
127+
"""Click the Base Page 'Bowel Scope' link."""
112128
self.click(self.bowel_scope_page)
113129

114130
def go_to_call_and_recall_page(self) -> None:
131+
"""Click the Base Page 'Call and Recall' link."""
115132
self.click(self.call_and_recall_page)
116133

117134
def go_to_communications_production_page(self) -> None:
135+
"""Click the Base Page 'Communications Production' link."""
118136
self.click(self.communications_production_page)
119137

120138
def go_to_download_page(self) -> None:
139+
"""Click the Base Page 'Download' link."""
121140
self.click(self.download_page)
122141

123142
def go_to_fit_test_kits_page(self) -> None:
143+
"""Click the Base Page 'FIT Test Kits' link."""
124144
self.click(self.fit_test_kits_page)
125145

126146
def go_to_gfobt_test_kits_page(self) -> None:
147+
"""Click the Base Page 'gFOBT Test Kits' link."""
127148
self.click(self.gfobt_test_kits_page)
128149

129150
def go_to_lynch_surveillance_page(self) -> None:
151+
"""Click the Base Page 'Lynch Surveillance' link."""
130152
self.click(self.lynch_surveillance_page)
131153

132154
def go_to_organisations_page(self) -> None:
155+
"""Click the Base Page 'Organisations' link."""
133156
self.click(self.organisations_page)
134157

135158
def go_to_reports_page(self) -> None:
159+
"""Click the Base Page 'Reports' link."""
136160
self.click(self.reports_page)
137161

138162
def go_to_screening_practitioner_appointments_page(self) -> None:
163+
"""Click the Base Page 'Screening Practitioner Appointments' link."""
139164
self.click(self.screening_practitioner_appointments_page)
140165

141166
def go_to_screening_subject_search_page(self) -> None:
167+
"""Click the Base Page 'Screening Subject Search' link."""
142168
self.click(self.screening_subject_search_page)
143169

144170
def click(self, locator: Locator) -> None:

pages/bowel_scope/bowel_scope_appointments_page.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
from pages.base_page import BasePage
33

44

5-
class BowelScopeAppointments(BasePage):
5+
class BowelScopeAppointmentsPage(BasePage):
6+
"""Bowel Scope Appointments page locators, and methods to interact with the page"""
7+
68
def __init__(self, page: Page):
79
super().__init__(page)
810
self.page = page
911
# Bowel Scope Appointments - page locators
1012
self.page_title = self.page.locator("#ntshPageTitle")
1113

1214
def verify_page_title(self) -> None:
15+
"""Verifies the page title of the Bowel Scope Appointments page"""
1316
expect(self.page_title).to_contain_text("Appointment Calendar")
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
from playwright.sync_api import Page, expect, Locator
1+
from playwright.sync_api import Page
22
from pages.base_page import BasePage
33

44

5-
class BowelScope(BasePage):
5+
class BowelScopePage(BasePage):
6+
"""Bowel Scope page locators, and methods to interact with the page"""
7+
68
def __init__(self, page: Page):
79
super().__init__(page)
810
self.page = page
@@ -12,4 +14,5 @@ def __init__(self, page: Page):
1214
)
1315

1416
def go_to_view_bowel_scope_appointments_page(self) -> None:
17+
"""Clicks the link to navigate to the Bowel Scope Appointments page"""
1518
self.click(self.view_bowel_scope_appointments_page)

pages/call_and_recall/age_extension_rollout_plans_page.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
from pages.base_page import BasePage
33

44

5-
class AgeExtensionRolloutPlans(BasePage):
5+
class AgeExtensionRolloutPlansPage(BasePage):
6+
"""Age Extension Rollout Plans page locators, and methods to interact with the page"""
7+
68
def __init__(self, page: Page):
79
super().__init__(page)
810
self.page = page
911
# Age Extension Rollout Plans - page locators
1012
self.age_extension_rollout_plans_title = self.page.locator("#page-title")
1113

1214
def verify_age_extension_rollout_plans_title(self) -> None:
15+
"""Verifies the page title of the Age Extension Rollout Plans page"""
1316
expect(self.age_extension_rollout_plans_title).to_contain_text(
1417
"Age Extension Rollout Plans"
1518
)

pages/call_and_recall/call_and_recall_page.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
from pages.base_page import BasePage
33

44

5-
class CallAndRecall(BasePage):
5+
class CallAndRecallPage(BasePage):
6+
"""Call and Recall page locators, and methods to interact with the page"""
7+
68
def __init__(self, page: Page):
79
super().__init__(page)
810
self.page = page
@@ -24,16 +26,21 @@ def __init__(self, page: Page):
2426
)
2527

2628
def go_to_planning_and_monitoring_page(self) -> None:
29+
"""Clicks the link to navigate to the Planning and Monitoring page"""
2730
self.click(self.planning_and_monitoring_page)
2831

2932
def go_to_generate_invitations_page(self) -> None:
33+
"""Clicks the link to navigate to the Generate Invitations page"""
3034
self.click(self.generate_invitations_page)
3135

3236
def go_to_invitation_generation_progress_page(self) -> None:
37+
"""Clicks the link to navigate to the Invitation Generation Progress page"""
3338
self.click(self.invitation_generation_progress_page)
3439

3540
def go_to_non_invitation_days_page(self) -> None:
41+
"""Clicks the link to navigate to the Non Invitation Days page"""
3642
self.click(self.non_invitation_days_page)
3743

3844
def go_to_age_extension_rollout_plans_page(self) -> None:
45+
"""Clicks the link to navigate to the Age Extension Rollout Plans page"""
3946
self.click(self.age_extension_rollout_plans_page)

pages/call_and_recall/create_a_plan_page.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
from pages.base_page import BasePage
33

44

5-
class CreateAPlan(BasePage):
5+
class CreateAPlanPage(BasePage):
6+
"""Create a Plan page locators and methods to interact with the page"""
7+
68
def __init__(self, page: Page):
79
super().__init__(page)
810
self.page = page
@@ -24,28 +26,37 @@ def __init__(self, page: Page):
2426
self.create_a_plan_title = self.page.locator("#page-title")
2527

2628
def click_set_all_button(self) -> None:
29+
"""Clicks the Set all button to set all values"""
2730
self.click(self.set_all_button)
2831

2932
def fill_daily_invitation_rate_field(self, value: str) -> None:
33+
"""Fills the daily invitation rate field with the given value"""
3034
self.daily_invitation_rate_field.fill(value)
3135

3236
def fill_weekly_invitation_rate_field(self, value) -> None:
37+
"""Fills the weekly invitation rate field with the given value"""
3338
self.weekly_invitation_rate_field.fill(value)
3439

3540
def click_update_button(self) -> None:
41+
"""Clicks the Update button to save any changes"""
3642
self.click(self.update_button)
3743

3844
def click_confirm_button(self) -> None:
45+
"""Clicks the Confirm button"""
3946
self.click(self.confirm_button)
4047

4148
def click_save_button(self) -> None:
49+
"""Clicks the Save button"""
4250
self.click(self.save_button)
4351

4452
def fill_note_field(self, value) -> None:
53+
"""Fills the note field with the given value"""
4554
self.note_field.fill(value)
4655

4756
def click_save_note_button(self) -> None:
57+
"""Clicks the Save note button"""
4858
self.click(self.save_note_button)
4959

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

pages/call_and_recall/generate_invitations_page.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import logging
55

66

7-
class GenerateInvitations(BasePage):
7+
class GenerateInvitationsPage(BasePage):
8+
"""Generate Invitations page locators, and methods to interact with the page"""
9+
810
def __init__(self, page: Page):
911
super().__init__(page)
1012
self.page = page
@@ -19,15 +21,19 @@ def __init__(self, page: Page):
1921
self.generate_invitations_title = self.page.locator("#ntshPageTitle")
2022

2123
def click_generate_invitations_button(self) -> None:
24+
"""This function is used to click the Generate Invitations button."""
2225
self.click(self.generate_invitations_button)
2326

2427
def click_refresh_button(self) -> None:
28+
"""This function is used to click the Refresh button."""
2529
self.click(self.refresh_button)
2630

2731
def verify_generate_invitations_title(self) -> None:
32+
"""This function is used to verify the Generate Invitations page title."""
2833
expect(self.generate_invitations_title).to_contain_text("Generate Invitations")
2934

3035
def verify_invitation_generation_progress_title(self) -> None:
36+
"""This function is used to verify the Invitation Generation Progress page title."""
3137
expect(self.generate_invitations_title).to_contain_text(
3238
"Invitation Generation Progress"
3339
)

pages/call_and_recall/invitations_monitoring_page.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
from pages.base_page import BasePage
33

44

5-
class InvitationsMonitoring(BasePage):
5+
class InvitationsMonitoringPage(BasePage):
6+
"""Invitations Monitoring page locators, and methods to interact with the page"""
7+
68
def __init__(self, page: Page):
79
super().__init__(page)
810
self.page = page

pages/call_and_recall/invitations_plans_page.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
from pages.base_page import BasePage
33

44

5-
class InvitationsPlans(BasePage):
5+
class InvitationsPlansPage(BasePage):
6+
"""Invitations Plans page locators, and methods to interact with the page"""
7+
68
def __init__(self, page: Page):
79
super().__init__(page)
810
self.page = page
@@ -16,7 +18,9 @@ def __init__(self, page: Page):
1618
)
1719

1820
def go_to_create_a_plan_page(self) -> None:
21+
"""Clicks the Create a Plan button to navigate to the Create a Plan page"""
1922
self.click(self.create_a_plan)
2023

2124
def go_to_first_available_plan(self) -> None:
25+
"""Clicks the first available plan to navigate to the Create a Plan page"""
2226
self.click(self.first_available_plan)

pages/call_and_recall/non_invitations_days_page.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
from pages.base_page import BasePage
33

44

5-
class NonInvitationDays(BasePage):
5+
class NonInvitationDaysPage(BasePage):
6+
"""Non Invitation Days page locators, and methods to interact with the page"""
7+
68
def __init__(self, page: Page):
79
super().__init__(page)
810
self.page = page
911
# Non Invitation Days - page locators
1012
self.non_invitations_days_title = self.page.locator("#ntshPageTitle")
1113

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

0 commit comments

Comments
 (0)