Skip to content

Commit 31a5544

Browse files
committed
Merge remote-tracking branch 'origin' into feature/BCSS-20418-pom-naming-and-method-docstring
# Conflicts: # tests/smokescreen/test_compartment_5.py
2 parents 0247b93 + ffae33e commit 31a5544

File tree

2 files changed

+78
-22
lines changed

2 files changed

+78
-22
lines changed
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: 30 additions & 22 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 LogoutPage
44
from pages.base_page import BasePage
5+
from pages.screening_practitioner_appointments.appointment_calendar_page import (
6+
AppointmentCalendarPage,
7+
)
8+
from pages.screening_practitioner_appointments.appointment_detail_page import (
9+
AppointmentDetailPage,
10+
)
511
from pages.screening_practitioner_appointments.screening_practitioner_appointments_page import (
612
ScreeningPractitionerAppointmentsPage,
713
)
14+
from pages.screening_practitioner_appointments.screening_practitioner_day_view_page import (
15+
ScreeningPractitionerDayViewPage,
16+
)
817
from pages.datasets.subject_datasets_page import (
918
SubjectDatasetsPage,
1019
)
@@ -31,6 +40,14 @@
3140
from pages.screening_subject_search.attend_diagnostic_test_page import (
3241
AttendDiagnosticTestPage,
3342
)
43+
from pages.screening_subject_search.subject_screening_summary_page import (
44+
SubjectScreeningSummaryPage,
45+
)
46+
47+
from pages.screening_subject_search.contact_with_patient_page import (
48+
ContactWithPatientPage,
49+
)
50+
3451
from utils.user_tools import UserTools
3552
from utils.load_properties_file import PropertiesFile
3653
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
@@ -76,11 +93,13 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
7693
AppointmentCalendarPage(page).select_site_dropdown(
7794
smokescreen_properties["c5_eng_site"]
7895
)
96+
# page.get_by_role("link", name="Screening Practitioner").select_option("")
7997

8098
AppointmentCalendarPage(page).click_view_appointments_on_this_day_button()
8199
ScreeningPractitionerDayViewPage(page).click_calendar_button()
82100
date_from_util = datetime(2025, 4, 30)
83101
CalendarPicker(page).v1_calender_picker(date_from_util)
102+
# page.locator("#UI_PRACTITIONER_NDV").select_option("")
84103

85104
# Select subject from inital test data util
86105
ScreeningPractitionerDayViewPage(page).click_patient_link("DIVIDEND MUZZLE")
@@ -96,7 +115,7 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
96115
# Repeat for x Abnormal patients
97116

98117
# Navigate to the 'Subject Screening Summary' screen for the 1st Abnormal patient
99-
nhs_no = "9852356488" # Test NHS NO for DIVIDEND MUZZLE
118+
nhs_no = "9645516129" # Test NHS NO for DIVIDEND MUZZLE
100119
verify_subject_event_status_by_nhs_no(
101120
page, nhs_no, "J10 - Attended Colonoscopy Assessment Appointment"
102121
)
@@ -180,31 +199,20 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
180199
page
181200
).click_record_other_post_investigation_contact_button()
182201

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

206214
verify_subject_event_status_by_nhs_no(
207-
page, nhs_no, "A361 - Other Post-investigation Contact Required"
215+
page, nhs_no, "A323 - Post-investigation Appointment NOT Required"
208216
)
209217

210218
# Repeat above for x subjects

0 commit comments

Comments
 (0)