Skip to content

Commit ffae33e

Browse files
vidhya-chandra1Andyg79mepr1
authored
Compartment 5- POM for 'Contact with Patient' page ## Description <!-- Created a New POM File Name - contact_with_patient_page.py & invoked this POM in test_compartment_5.py --> ## Context <!-- Removed the Hard coded locator value from the compartment file & moved it to the newly created 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 - [X] 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. --------- Co-authored-by: AndyG <[email protected]> Co-authored-by: Megha Prasannan <[email protected]>
1 parent acd42e4 commit ffae33e

File tree

3 files changed

+89
-45
lines changed

3 files changed

+89
-45
lines changed

pages/datasets/colonoscopy_dataset_page.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ def select_asa_grade_option(self, option: str) -> None:
3838
"""
3939
This method is designed to select a specific grade option from the colonoscopy dataset page, ASA Grade dropdown menu.
4040
Args:
41-
option (str): The ASA grade option to be selected. This should be a string that matches one of the available options in the dropdown menu.
42-
Valid options are: "FIT", "RELEVANT_DISEASE", "UNABLE_TO_ASSESS", RESTRICTIVE_DISEASE, "LIFE_THREATENING_DISEASE", "MORIBUND", "NOT_APPLICABLE", or "NOT_KNOWN".
41+
option (str): The ASA grade option to be selected. This should be a string that matches one of the available options in the dropdown menu.
42+
Valid options are: "FIT", "RELEVANT_DISEASE", "UNABLE_TO_ASSESS", RESTRICTIVE_DISEASE, "LIFE_THREATENING_DISEASE", "MORIBUND", "NOT_APPLICABLE", or "NOT_KNOWN".
4343
Returns:
44-
None
44+
None
4545
"""
4646
self.select_asa_grade_dropdown.select_option(option)
4747

4848
def select_fit_for_colonoscopy_option(self, option: str) -> None:
4949
"""
5050
This method is designed to select a specific option from the colonoscopy dataset page, Fit for Colonoscopy (SSP) dropdown menu.
5151
Args:
52-
option (str): The option to be selected. This should be a string that matches one of the available options in the dropdown menu.
53-
Valid options are: "YES", "NO", or "UNABLE_TO_ASSESS".
52+
option (str): The option to be selected. This should be a string that matches one of the available options in the dropdown menu.
53+
Valid options are: "YES", "NO", or "UNABLE_TO_ASSESS".
5454
Returns:
55-
None
55+
None
5656
"""
5757
self.select_fit_for_colonoscopy_dropdown.select_option(option)
5858

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from playwright.sync_api import Page
2+
from pages.base_page import BasePage
3+
4+
5+
class ContactWithPatientPage(BasePage):
6+
"""
7+
ContactWithPatientPage class for interacting with 'Contact With Patient' page elements.
8+
"""
9+
10+
def __init__(self, page: Page):
11+
super().__init__(page)
12+
self.page = page
13+
14+
# Contact With Patient - Page Locators
15+
self.contact_direction_dropdown = self.page.locator("#UI_DIRECTION")
16+
self.contact_made_between_patient_and_dropdown = self.page.locator(
17+
"#UI_CALLER_ID"
18+
)
19+
self.calendar_button = self.page.get_by_role("button", name="Calendar")
20+
self.start_time_field = self.page.locator("#UI_START_TIME")
21+
self.end_time_field = self.page.locator("#UI_END_TIME")
22+
self.discussion_record_text_field = self.page.locator("#UI_COMMENT_ID")
23+
self.outcome_dropdown = self.page.locator("#UI_OUTCOME")
24+
self.save_button = self.page.get_by_role("button", name="Save")
25+
26+
def select_direction_dropdown_option(self, direction: str) -> None:
27+
self.contact_direction_dropdown.select_option(label=direction)
28+
29+
def select_caller_id_dropdown_index_option(self, index_value: int) -> None:
30+
self.contact_made_between_patient_and_dropdown.select_option(index=index_value)
31+
32+
def click_calendar_button(self) -> None:
33+
self.click(self.calendar_button)
34+
35+
def enter_start_time(self, start_time: str) -> None:
36+
self.start_time_field.fill(start_time)
37+
38+
def enter_end_time(self, end_time: str) -> None:
39+
self.end_time_field.fill(end_time)
40+
41+
def enter_discussion_record_text(self, value: str) -> None:
42+
self.discussion_record_text_field.fill(value)
43+
44+
def select_outcome_dropdown_option(self, outcome: str) -> None:
45+
self.outcome_dropdown.select_option(label=outcome)
46+
47+
def click_save_button(self) -> None:
48+
self.click(self.save_button)

tests/smokescreen/test_compartment_5.py

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22
from playwright.sync_api import Page
33
from pages.logout.log_out_page import Logout
44
from pages.base_page import BasePage
5+
from pages.screening_practitioner_appointments.appointment_calendar_page import (
6+
AppointmentCalendar,
7+
)
8+
from pages.screening_practitioner_appointments.appointment_detail_page import (
9+
AppointmentDetail,
10+
)
511
from pages.screening_practitioner_appointments.screening_practitioner_appointments import (
612
ScreeningPractitionerAppointmentsPage,
713
)
14+
from pages.screening_practitioner_appointments.screening_practitioner_day_view import (
15+
ScreeningPractitionerDayView,
16+
)
817
from pages.datasets.subject_datasets_page import (
918
SubjectDatasetsPage,
1019
)
@@ -13,24 +22,20 @@
1322
FitForColonoscopySspOptions,
1423
AsaGradeOptions,
1524
)
16-
from pages.screening_subject_search.subject_screening_summary import (
17-
SubjectScreeningSummary,
18-
)
1925
from pages.screening_subject_search.advance_fobt_screening_episode_page import (
2026
AdvanceFOBTScreeningEpisode,
2127
)
22-
from pages.screening_practitioner_appointments.screening_practitioner_day_view import (
23-
ScreeningPractitionerDayView,
24-
)
25-
from pages.screening_practitioner_appointments.appointment_detail_page import (
26-
AppointmentDetail,
27-
)
28-
from pages.screening_practitioner_appointments.appointment_calendar_page import (
29-
AppointmentCalendar,
30-
)
3128
from pages.screening_subject_search.attend_diagnostic_test_page import (
3229
AttendDiagnosticTest,
3330
)
31+
from pages.screening_subject_search.subject_screening_summary import (
32+
SubjectScreeningSummary,
33+
)
34+
35+
from pages.screening_subject_search.contact_with_patient_page import (
36+
ContactWithPatientPage,
37+
)
38+
3439
from utils.user_tools import UserTools
3540
from utils.load_properties_file import PropertiesFile
3641
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
@@ -76,14 +81,16 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
7681
AppointmentCalendar(page).select_site_dropdown(
7782
smokescreen_properties["c5_eng_site"]
7883
)
84+
# page.get_by_role("link", name="Screening Practitioner").select_option("")
7985

8086
AppointmentCalendar(page).click_view_appointments_on_this_day_button()
8187
ScreeningPractitionerDayView(page).click_calendar_button()
82-
date_from_util = datetime(2025, 4, 30)
88+
date_from_util = datetime(2025, 5, 2)
8389
CalendarPicker(page).v1_calender_picker(date_from_util)
90+
# page.locator("#UI_PRACTITIONER_NDV").select_option("")
8491

8592
# Select subject from inital test data util
86-
ScreeningPractitionerDayView(page).click_patient_link("DIVIDEND MUZZLE")
93+
ScreeningPractitionerDayView(page).click_patient_link("REGALLY DRAGONISH")
8794

8895
# Select Attendance radio button, tick Attended checkbox, set Attended Date to yesterday's (system) date and then press Save
8996
AppointmentDetail(page).check_attendance_radio()
@@ -96,7 +103,7 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
96103
# Repeat for x Abnormal patients
97104

98105
# Navigate to the 'Subject Screening Summary' screen for the 1st Abnormal patient
99-
nhs_no = "9852356488" # Test NHS NO for DIVIDEND MUZZLE
106+
nhs_no = "9645516129" # Test NHS NO for DIVIDEND MUZZLE
100107
verify_subject_event_status_by_nhs_no(
101108
page, nhs_no, "J10 - Attended Colonoscopy Assessment Appointment"
102109
)
@@ -151,10 +158,10 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
151158
AdvanceFOBTScreeningEpisode(page).click_attend_diagnostic_test_button()
152159

153160
# Select Colonoscopy from drop down list. Enter the actual appointment date as today's date and select 'Save'
154-
AttendDiagnosticTest.select_actual_type_of_test_dropdown_option("Colonoscopy")
155-
AttendDiagnosticTest.click_calendar_button()
161+
AttendDiagnosticTest(page).select_actual_type_of_test_dropdown_option("Colonoscopy")
162+
AttendDiagnosticTest(page).click_calendar_button()
156163
CalendarPicker(page).v1_calender_picker(datetime.today())
157-
AttendDiagnosticTest.click_save_button()
164+
AttendDiagnosticTest(page).click_save_button()
158165
SubjectScreeningSummary(page).verify_latest_event_status_value(
159166
"A259 - Attended Diagnostic Test"
160167
)
@@ -178,31 +185,20 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
178185
page
179186
).click_record_other_post_investigation_contact_button()
180187

181-
# Complete 'Contact Direction', To patient
182-
# 'Contact made between patient and', Selects the top option in the dropdown
183-
# 'Date of Patient Contact', Today
184-
# 'Duration', 01:00
185-
# 'Start Time', 11:00
186-
# 'End Time', 12:00
187-
# 'Discussion Record' TEST AUTOMATION
188-
# select 'Outcome' - 'Post-investigation Appointment Not Required' and click 'Save'
189-
page.locator("#UI_DIRECTION").select_option(label="To patient")
190-
page.locator("#UI_CALLER_ID").select_option(index=0)
191-
page.get_by_role("button", name="Calendar").click()
188+
ContactWithPatientPage(page).select_direction_dropdown_option("To patient")
189+
ContactWithPatientPage(page).select_caller_id_dropdown_index_option(1)
190+
ContactWithPatientPage(page).click_calendar_button()
192191
CalendarPicker(page).v1_calender_picker(datetime.today())
193-
page.locator("#UI_START_TIME").click()
194-
page.locator("#UI_START_TIME").fill("11:00")
195-
page.locator("#UI_END_TIME").click()
196-
page.locator("#UI_END_TIME").fill("12:00")
197-
page.locator("#UI_COMMENT_ID").click()
198-
page.locator("#UI_COMMENT_ID").fill("Test Automation")
199-
page.locator("#UI_OUTCOME").select_option(
200-
label="Post-investigation Appointment Not Required"
192+
ContactWithPatientPage(page).enter_start_time("11:00")
193+
ContactWithPatientPage(page).enter_end_time("12:00")
194+
ContactWithPatientPage(page).enter_discussion_record_text("Test Automation")
195+
ContactWithPatientPage(page).select_outcome_dropdown_option(
196+
"Post-investigation Appointment Not Required"
201197
)
202-
page.get_by_role("button", name="Save").click()
198+
ContactWithPatientPage(page).click_save_button()
203199

204200
verify_subject_event_status_by_nhs_no(
205-
page, nhs_no, "A361 - Other Post-investigation Contact Required"
201+
page, nhs_no, "A323 - Post-investigation Appointment NOT Required"
206202
)
207203

208204
# Repeat above for x subjects

0 commit comments

Comments
 (0)