Skip to content

Commit 2f78980

Browse files
committed
Addressed PR comments
1 parent fb4dd3a commit 2f78980

File tree

1 file changed

+43
-6
lines changed

1 file changed

+43
-6
lines changed

pages/screening_subject_search/advance_fobt_screening_episode_page.py

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44
import logging
55
from typing import List
66
from utils.calendar_picker import CalendarPicker
7+
from enum import Enum
8+
9+
10+
class ContactDirection(Enum):
11+
TO_PATIENT = "20159"
12+
FROM_PATIENT = "20160"
13+
14+
15+
class ContactMethod(Enum):
16+
IN_PERSON = "16028"
17+
TELEPHONE = "16029"
18+
VISIT = "16030"
19+
LETTER = "20012"
720

821

922
class AdvanceFOBTScreeningEpisodePage(BasePage):
@@ -85,9 +98,10 @@ def __init__(self, page: Page):
8598
)
8699
# Contact recording locators
87100
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"
101+
self.contact_made_between_dropdown = self.page.get_by_label(
102+
"Contact made between patient and"
90103
)
104+
self.contact_method_dropdown = self.page.get_by_label("Contact Method")
91105
self.call_date_input = self.page.locator("#UI_CALL_DATE")
92106
self.start_time_input = self.page.locator("#UI_START_TIME")
93107
self.end_time_input = self.page.locator("#UI_END_TIME")
@@ -259,10 +273,13 @@ def record_contact_close_episode_no_contact(self) -> None:
259273
"[CONTACT RECORD] Starting contact recording flow with outcome: Close Episode - No Contact"
260274
)
261275

262-
# Step 1: Select direction and contact type
263-
self.contact_direction_dropdown.select_option("20159")
264-
self.contact_type_dropdown.select_option("1171")
265-
logging.info("[CONTACT RECORD] Selected direction and contact type")
276+
# Step 1: Select direction and contact method and practitioner
277+
self.contact_direction_dropdown.select_option(ContactDirection.TO_PATIENT.value)
278+
self.contact_method_dropdown.select_option(ContactMethod.TELEPHONE.value)
279+
self.select_any_practitioner()
280+
logging.info(
281+
"[CONTACT RECORD] Selected direction, contact method, and practitioner"
282+
)
266283

267284
# Step 2: Pick calendar date using V1 calendar picker
268285
calendar_picker = CalendarPicker(self.page)
@@ -359,3 +376,23 @@ def click_redirect_to_reestablish_suitability_for_diagnostic_test_repatient_cont
359376
self.safe_accept_dialog(
360377
self.redirect_to_reestablish_suitability_for_diagnostic_test_repatient_contact
361378
)
379+
380+
def select_any_practitioner(self) -> None:
381+
"""
382+
Selects any practitioner from the 'Contact made between patient and' dropdown.
383+
Skips the empty default option and selects the first available practitioner.
384+
"""
385+
logging.info("[CONTACT RECORD] Selecting any practitioner from dropdown")
386+
387+
# Get all available options
388+
options = self.contact_made_between_dropdown.locator("option").all()
389+
for option in options:
390+
value = option.get_attribute("value")
391+
if value and value.strip():
392+
self.contact_made_between_dropdown.select_option(value)
393+
logging.info(
394+
f"[CONTACT RECORD] Selected practitioner with value: {value}"
395+
)
396+
return
397+
398+
logging.warning("[CONTACT RECORD] No valid practitioner found to select")

0 commit comments

Comments
 (0)