Skip to content

Commit daa838b

Browse files
Merge branch 'main' of github.com:NHSDigital/bcss-playwright into feature/BCSS-20327-compartment-5-utils
# Conflicts: # tests/smokescreen/test_compartment_5.py
2 parents 0e5843f + ffae33e commit daa838b

File tree

3 files changed

+80
-30
lines changed

3 files changed

+80
-30
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: 26 additions & 24 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
@@ -182,20 +187,17 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
182187
page
183188
).click_record_other_post_investigation_contact_button()
184189

185-
page.locator("#UI_DIRECTION").select_option(label="To patient")
186-
page.locator("#UI_CALLER_ID").select_option(index=1)
187-
page.get_by_role("button", name="Calendar").click()
190+
ContactWithPatientPage(page).select_direction_dropdown_option("To patient")
191+
ContactWithPatientPage(page).select_caller_id_dropdown_index_option(1)
192+
ContactWithPatientPage(page).click_calendar_button()
188193
CalendarPicker(page).v1_calender_picker(datetime.today())
189-
page.locator("#UI_START_TIME").click()
190-
page.locator("#UI_START_TIME").fill("11:00")
191-
page.locator("#UI_END_TIME").click()
192-
page.locator("#UI_END_TIME").fill("12:00")
193-
page.locator("#UI_COMMENT_ID").click()
194-
page.locator("#UI_COMMENT_ID").fill("Test Automation")
195-
page.locator("#UI_OUTCOME").select_option(
196-
label="Post-investigation Appointment Not Required"
194+
ContactWithPatientPage(page).enter_start_time("11:00")
195+
ContactWithPatientPage(page).enter_end_time("12:00")
196+
ContactWithPatientPage(page).enter_discussion_record_text("Test Automation")
197+
ContactWithPatientPage(page).select_outcome_dropdown_option(
198+
"Post-investigation Appointment Not Required"
197199
)
198-
page.get_by_role("button", name="Save").click()
200+
ContactWithPatientPage(page).click_save_button()
199201

200202
verify_subject_event_status_by_nhs_no(
201203
page, nhs_no, "A323 - Post-investigation Appointment NOT Required"

0 commit comments

Comments
 (0)