Skip to content

Commit c51c018

Browse files
Added POM for appointment detail page (#36)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> Added a new POM for the appointment detail page and replaced hard coded locators in compartment 5. ## Context <!-- Why is this change required? What problem does it solve? --> New POM that can be used across multiple tests without reusing locators ## 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 c38edc6 commit c51c018

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from playwright.sync_api import Page, expect
2+
from pages.base_page import BasePage
3+
4+
5+
class AppointmentDetail(BasePage):
6+
def __init__(self, page: Page):
7+
super().__init__(page)
8+
self.page = page
9+
# Appointment Detail - page filters
10+
self.attendance_radio = self.page.get_by_role("radio", name="Attendance")
11+
self.attendented_check_box = self.page.locator("#UI_ATTENDED")
12+
self.calendar_button = self.page.get_by_role("button", name="Calendar")
13+
self.save_button = self.page.get_by_role("button", name="Save").click()
14+
15+
def check_attendance_radio(self) -> None:
16+
self.attendance_radio.check()
17+
18+
def check_attendented_check_box(self) -> None:
19+
self.attendented_check_box.check()
20+
21+
def click_calendar_button(self) -> None:
22+
self.click(self.calendar_button)
23+
24+
def click_save_button(self) -> None:
25+
self.click(self.save_button)
26+
27+
def verify_text_visible(self, text: str) -> None:
28+
expect(self.page.get_by_text(text)).to_be_visible()

tests/smokescreen/test_compartment_5.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from pages.screening_practitioner_appointments.screening_practitioner_day_view import (
1515
ScreeningPractitionerDayView,
1616
)
17+
from pages.screening_subject_search.appointment_detail_page import AppointmentDetail
1718
from utils.user_tools import UserTools
1819
from utils.load_properties_file import PropertiesFile
1920
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
@@ -65,12 +66,12 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
6566
ScreeningPractitionerDayView(page).click_patient_link("STARLESS BLUSH")
6667

6768
# Select Attendance radio button, tick Attended checkbox, set Attended Date to yesterday's (system) date and then press Save
68-
page.get_by_role("radio", name="Attendance").check()
69-
page.locator("#UI_ATTENDED").check()
70-
page.get_by_role("button", name="Calendar").click()
69+
AppointmentDetail(page).check_attendance_radio()
70+
AppointmentDetail(page).check_attendented_check_box()
71+
AppointmentDetail(page).click_calendar_button()
7172
CalendarPicker(page).v1_calender_picker(datetime.today() - timedelta(1))
72-
page.get_by_role("button", name="Save").click()
73-
expect(page.get_by_text("Record updated")).to_be_visible()
73+
AppointmentDetail(page).click_save_button()
74+
AppointmentDetail(page).verify_text_visible("Record updated")
7475

7576
# Repeat for x Abnormal patients
7677

0 commit comments

Comments
 (0)