Skip to content

Commit fb4dd3a

Browse files
committed
Addressing PR comments
1 parent 8f33282 commit fb4dd3a

File tree

2 files changed

+38
-24
lines changed

2 files changed

+38
-24
lines changed

pages/screening_subject_search/advance_fobt_screening_episode_page.py

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ def __init__(self, page: Page):
8383
self.redirect_to_reestablish_suitability_for_diagnostic_test_repatient_contact = self.page.get_by_role(
8484
"button", name="Redirect to re-establish"
8585
)
86+
# Contact recording locators
87+
self.contact_direction_dropdown = self.page.get_by_label("Contact Direction")
88+
self.contact_type_dropdown = self.page.get_by_label(
89+
"Contact made between patient"
90+
)
91+
self.call_date_input = self.page.locator("#UI_CALL_DATE")
92+
self.start_time_input = self.page.locator("#UI_START_TIME")
93+
self.end_time_input = self.page.locator("#UI_END_TIME")
94+
self.duration_input = self.page.locator("#UI_DURATION")
95+
self.note_input = self.page.get_by_text("(up to 500 char)")
96+
self.patient_contacted_dropdown = self.page.get_by_label("Patient Contacted")
97+
self.outcome_dropdown = self.page.get_by_label("Outcome")
98+
self.save_button = self.page.locator("input[name='UI_BUTTON_SAVE']")
99+
# CT Colonography invitation locators
100+
self.ct_colonography_appointment_date_input = self.page.locator(
101+
"#UI_APPT_DATE_38"
102+
)
103+
self.ct_colonography_test_type_dropdown = self.page.locator(
104+
"#UI_EXT_TEST_TYPE_38"
105+
)
106+
self.invite_for_diagnostic_test_button = self.page.get_by_role(
107+
"button", name="Invite for Diagnostic Test >>"
108+
)
86109

87110
def click_suitable_for_endoscopic_test_button(self) -> None:
88111
"""Click the 'Suitable for Endoscopic Test' button."""
@@ -207,19 +230,15 @@ def select_ct_colonography_and_invite(self) -> None:
207230

208231
# Step 1: Enter today's date
209232
today = date.today().strftime("%d/%m/%Y")
210-
self.page.locator("#UI_APPT_DATE_38").fill(today)
233+
self.ct_colonography_appointment_date_input.fill(today)
211234
logging.info(f"[ADVANCE EPISODE] Entered appointment date: {today}")
212235

213236
# Step 2: Select 'CT Colonography' from dropdown
214-
self.page.locator("#UI_EXT_TEST_TYPE_38").select_option(label="CT Colonography")
237+
self.ct_colonography_test_type_dropdown.select_option(label="CT Colonography")
215238
logging.info("[ADVANCE EPISODE] Selected test type: CT Colonography")
216239

217240
# Step 3: Click 'Invite for Diagnostic Test'
218-
invite_button = self.page.get_by_role(
219-
"button", name="Invite for Diagnostic Test >>"
220-
)
221-
self.safe_accept_dialog(invite_button)
222-
241+
self.safe_accept_dialog(self.invite_for_diagnostic_test_button)
223242
logging.info("[ADVANCE EPISODE] Invite for diagnostic test completed")
224243

225244
def record_contact_close_episode_no_contact(self) -> None:
@@ -241,40 +260,38 @@ def record_contact_close_episode_no_contact(self) -> None:
241260
)
242261

243262
# Step 1: Select direction and contact type
244-
self.page.get_by_label("Contact Direction").select_option("20159")
245-
self.page.get_by_label("Contact made between patient").select_option("1171")
263+
self.contact_direction_dropdown.select_option("20159")
264+
self.contact_type_dropdown.select_option("1171")
246265
logging.info("[CONTACT RECORD] Selected direction and contact type")
247266

248267
# Step 2: Pick calendar date using V1 calendar picker
249268
calendar_picker = CalendarPicker(self.page)
250269
today = datetime.today()
251-
calendar_picker.calendar_picker_ddmmyyyy(
252-
today, self.page.locator("#UI_CALL_DATE")
253-
)
270+
calendar_picker.calendar_picker_ddmmyyyy(today, self.call_date_input)
254271
logging.info(
255272
f"[CONTACT RECORD] Selected calendar date: {today.strftime('%d/%m/%Y')}"
256273
)
257274

258275
# Step 3: Enter time details
259-
self.page.locator("#UI_START_TIME").fill("08:00")
260-
self.page.locator("#UI_END_TIME").fill("08:10")
261-
self.page.locator("#UI_DURATION").fill("10")
276+
self.start_time_input.fill("08:00")
277+
self.end_time_input.fill("08:10")
278+
self.duration_input.fill("10")
262279
logging.info("[CONTACT RECORD] Entered time details: 08:00–08:10")
263280

264281
# Step 4: Enter note
265-
self.page.get_by_text("(up to 500 char)").fill("Automation test record")
282+
self.note_input.fill("Automation test record")
266283
logging.info("[CONTACT RECORD] Entered note: Automation test record")
267284

268285
# Step 5: Select 'Patient Contacted' as 'No'
269-
self.page.get_by_label("Patient Contacted").select_option("N")
286+
self.patient_contacted_dropdown.select_option("N")
270287
logging.info("[CONTACT RECORD] Selected 'Patient Contacted': No")
271288

272289
# Step 6: Select outcome
273-
self.page.get_by_label("Outcome").select_option("20202")
290+
self.outcome_dropdown.select_option("20202")
274291
logging.info("[CONTACT RECORD] Selected outcome: Close Episode - No Contact")
275292

276293
# Step 7: Click save
277-
self.page.locator("input[name='UI_BUTTON_SAVE']").click()
294+
self.click(self.save_button)
278295
logging.info("[CONTACT RECORD] Contact recording flow completed successfully")
279296

280297
def click_not_suitable_for_diagnostic_tests_button(self) -> None:

tests/regression/regression_tests/fobt_regression_tests/test_scenario_8.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import pytest
22
import logging
33
from playwright.sync_api import Page
4-
from pages.datasets.cancer_audit_datasets_page import (
5-
CancerRadiologyYesNoOptions,
6-
)
74
from pages.datasets.investigation_dataset_page import (
85
AdditionalBowelPrepAdministeredOptions,
6+
IVBuscopanAdministeredOptions,
97
TaggingAgentDrugAdministeredOptions,
108
YesNoOptions,
119
)
@@ -72,7 +70,6 @@
7270
)
7371

7472

75-
@pytest.mark.wip
7673
@pytest.mark.usefixtures("setup_org_and_appointments")
7774
@pytest.mark.vpn_required
7875
@pytest.mark.regression
@@ -542,7 +539,7 @@ def test_scenario_8(page: Page) -> None:
542539
# And I set the following fields and values within the Contrast, Tagging & Drug Information:
543540
# And I add the following Additional Bowel Preparation drugs and values within the Investigation Dataset for this subject:
544541
contrast_tagging_and_drug = {
545-
"iv buscopan administered": CancerRadiologyYesNoOptions.NO,
542+
"iv buscopan administered": IVBuscopanAdministeredOptions.NO,
546543
"contraindicated": YesNoOptions.NO,
547544
"iv contrast administered": IVContrastAdministeredOptions.NO,
548545
"tagging agent given": TaggingAgentDrugAdministeredOptions.YES,

0 commit comments

Comments
 (0)