Skip to content

Commit 8f6c7e3

Browse files
authored
Added pom for Attend Diagnostic test (#40)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description Added POM for Attend Diagnostic test page and updated Compartment 5 tests accordingly ## Context We had some hard coded locators/values in our compartment 5 tests that have been refactored to use a POM ## 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 628e560 commit 8f6c7e3

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

pages/screening_practitioner_appointments/appointment_detail_page.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ def __init__(self, page: Page):
88
self.page = page
99
# Appointment Detail - page filters
1010
self.attendance_radio = self.page.get_by_role("radio", name="Attendance")
11-
self.attendented_check_box = self.page.locator("#UI_ATTENDED")
11+
self.attended_check_box = self.page.locator("#UI_ATTENDED")
1212
self.calendar_button = self.page.get_by_role("button", name="Calendar")
13-
self.save_button = self.page.get_by_role("button", name="Save").click()
13+
self.save_button = self.page.get_by_role("button", name="Save")
1414

1515
def check_attendance_radio(self) -> None:
1616
self.attendance_radio.check()
1717

18-
def check_attendented_check_box(self) -> None:
19-
self.attendented_check_box.check()
18+
def check_attended_check_box(self) -> None:
19+
self.attended_check_box.check()
2020

2121
def click_calendar_button(self) -> None:
2222
self.click(self.calendar_button)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from playwright.sync_api import Page
2+
from pages.base_page import BasePage
3+
4+
5+
class AttendDiagnosticTest(BasePage):
6+
def __init__(self, page: Page):
7+
super().__init__(page)
8+
self.page = page
9+
# Advance Diagnostic Test - page locators
10+
self.actual_type_of_test_dropdown = self.page.locator("#UI_CONFIRMED_TYPE_OF_TEST")
11+
self.calendar_button = self.page.get_by_role("button", name="Calendar")
12+
self.save_button =self.page.get_by_role("button", name="Save")
13+
14+
def select_actual_type_of_test_dropdown_option(self, text: str) -> None:
15+
self.actual_type_of_test_dropdown.select_option(label=text)
16+
17+
def click_calendar_button(self) -> None:
18+
self.click(self.calendar_button)
19+
20+
def click_save_button(self) -> None:
21+
self.click(self.save_button)

tests/smokescreen/test_compartment_5.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
from pages.screening_practitioner_appointments.appointment_calendar_page import (
2626
AppointmentCalendar,
2727
)
28+
from pages.screening_subject_search.attend_diagnostic_test_page import (
29+
AttendDiagnosticTest,
30+
)
2831
from utils.user_tools import UserTools
2932
from utils.load_properties_file import PropertiesFile
3033
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
@@ -81,7 +84,7 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
8184

8285
# Select Attendance radio button, tick Attended checkbox, set Attended Date to yesterday's (system) date and then press Save
8386
AppointmentDetail(page).check_attendance_radio()
84-
AppointmentDetail(page).check_attendented_check_box()
87+
AppointmentDetail(page).check_attended_check_box()
8588
AppointmentDetail(page).click_calendar_button()
8689
CalendarPicker(page).v1_calender_picker(datetime.today() - timedelta(1))
8790
AppointmentDetail(page).click_save_button()
@@ -145,10 +148,10 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
145148
AdvanceFOBTScreeningEpisode(page).click_attend_diagnostic_test_button()
146149

147150
# Select Colonoscopy from drop down list. Enter the actual appointment date as today's date and select 'Save'
148-
page.locator("#UI_CONFIRMED_TYPE_OF_TEST").select_option(label="Colonoscopy")
149-
page.get_by_role("button", name="Calendar").click()
151+
AttendDiagnosticTest.select_actual_type_of_test_dropdown_option("Colonoscopy")
152+
AttendDiagnosticTest.click_calendar_button()
150153
CalendarPicker(page).v1_calender_picker(datetime.today())
151-
page.get_by_role("button", name="Save").click()
154+
AttendDiagnosticTest.click_save_button()
152155
SubjectScreeningSummary(page).verify_latest_event_status_value(
153156
"A259 - Attended Diagnostic Test"
154157
)

0 commit comments

Comments
 (0)