Skip to content

Commit 98c6bf0

Browse files
Added POM for appointment calendar page (#38)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> Added a new POM for the appointment calendar page and removed hard coded locators in compartment 5 ## Context <!-- Why is this change required? What problem does it solve? --> Allows for reuse of the POM across multiple tests and removed hard coded locators in these tests ## 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) - [ ] 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 9b38f44 commit 98c6bf0

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from playwright.sync_api import Page, expect
2+
from pages.base_page import BasePage
3+
4+
5+
class AppointmentCalendar(BasePage):
6+
def __init__(self, page: Page):
7+
super().__init__(page)
8+
self.page = page
9+
# Appointment Calendar - page filters
10+
self.appointment_type_drowdown = self.page.locator("#UI_APPOINTMENT_TYPE")
11+
self.screening_centre_dropdown = self.page.locator("#UI_SCREENING_CENTRE")
12+
self.site_dropdown = self.page.locator("#UI_SITE")
13+
self.view_appointments_on_this_day_button = self.page.get_by_role(
14+
"button", name="View appointments on this day"
15+
)
16+
17+
def select_appointment_type_dropdown(self, type: str) -> None:
18+
self.appointment_type_drowdown.select_option(label=type)
19+
20+
def select_screening_centre_dropdown(self, screening_centre: str) -> None:
21+
self.screening_centre_dropdown.select_option(label=screening_centre)
22+
23+
def select_site_dropdown(self, site: str) -> None:
24+
self.site_dropdown.select_option(label=site)
25+
26+
def click_view_appointments_on_this_day_button(self) -> None:
27+
self.click(self.view_appointments_on_this_day_button)

tests/smokescreen/bcss_smokescreen_tests.properties

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
c4_eng_site_name2=The Royal Hospital (Wolverhampton)
3333
c4_eng_practitioner_name=Astonish, Ethanol
3434

35+
# ----------------------------------
36+
# compartment 5
37+
# ----------------------------------
38+
c5_eng_appointment_type=Colonoscopy Assessment
39+
c5_eng_screening_centre=BCS001 - Wolverhampton Bowel Cancer Screening Centre
40+
c5_eng_site=(all)
41+
3542
# ----------------------------------
3643
# compartment 6
3744
# ----------------------------------
@@ -78,7 +85,7 @@
7885
# ----------------------------------
7986
# compartment 5
8087
# ----------------------------------
81-
# c5_eng_number_of_screening_appts_to_attend=6
88+
# c5_eng_number_of_screening_appts_to_attend=5
8289

8390
# ----------------------------------
8491
# compartment 6

tests/smokescreen/test_compartment_5.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
from pages.screening_practitioner_appointments.appointment_detail_page import (
1818
AppointmentDetail,
1919
)
20+
from pages.screening_practitioner_appointments.appointment_calendar_page import (
21+
AppointmentCalendar,
22+
)
2023
from utils.user_tools import UserTools
2124
from utils.load_properties_file import PropertiesFile
2225
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
@@ -53,13 +56,17 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
5356
ScreeningPractitionerAppointmentsPage(page).go_to_view_appointments_page()
5457

5558
# Select the Appointment Type, Site, Screening Practitioner and required date of the appointment and click 'View appointments on this day' button
56-
page.locator("#UI_APPOINTMENT_TYPE").select_option(label="Colonoscopy Assessment")
57-
page.locator("#UI_SCREENING_CENTRE").select_option(
58-
label="BCS001 - Wolverhampton Bowel Cancer Screening Centre"
59+
AppointmentCalendar(page).select_appointment_type_dropdown(
60+
smokescreen_properties["c5_eng_appointment_type"]
61+
)
62+
AppointmentCalendar(page).select_screening_centre_dropdown(
63+
smokescreen_properties["c5_eng_screening_centre"]
64+
)
65+
AppointmentCalendar(page).select_site_dropdown(
66+
smokescreen_properties["c5_eng_site"]
5967
)
60-
page.locator("#UI_SITE").select_option(label="The Royal Hospital (Wolverhampton)")
6168

62-
page.get_by_role("button", name="View appointments on this day").click()
69+
AppointmentCalendar(page).click_view_appointments_on_this_day_button()
6370
ScreeningPractitionerDayView(page).click_calendar_button()
6471
date_from_util = datetime(2025, 4, 29)
6572
CalendarPicker(page).v1_calender_picker(date_from_util)

0 commit comments

Comments
 (0)