@@ -45,6 +45,16 @@ def __init__(self, page: Page):
4545 self .record_contact_with_patient_button = self .page .get_by_role (
4646 "button" , name = "Record Contact with Patient"
4747 )
48+ self .amend_diagnosis_date_button = self .page .get_by_role (
49+ "button" , name = "Amend Diagnosis Date"
50+ )
51+ self .advance_checkbox_v2 = self .page .get_by_role ("checkbox" )
52+ self .subsequent_assessment_appointment_required_dropdown = (
53+ self .page .get_by_role ("combobox" )
54+ )
55+ self .subsequent_assessment_appointment_required_button = self .page .get_by_role (
56+ "button" , name = "Subsequent Assessment Appointment Required"
57+ )
4858 self .suitable_for_radiological_test_button = self .page .get_by_role (
4959 "button" , name = "Suitable for Radiological Test"
5060 )
@@ -58,6 +68,12 @@ def __init__(self, page: Page):
5868 "button" , name = "Waiting Decision to Proceed with Diagnostic Test"
5969 )
6070 )
71+ self .not_suitable_for_diagnostic_tests_button = self .page .get_by_role (
72+ "button" , name = "Not Suitable for Diagnostic Tests"
73+ )
74+ self .cancel_diagnostic_test_button = self .page .get_by_role (
75+ "button" , name = "Cancel Diagnostic Test"
76+ )
6177
6278 def click_suitable_for_endoscopic_test_button (self ) -> None :
6379 """Click the 'Suitable for Endoscopic Test' button."""
@@ -93,15 +109,21 @@ def get_latest_event_status_cell(self, latest_event_status: str) -> Locator:
93109
94110 def verify_latest_event_status_value (self , latest_event_status : str ) -> None :
95111 """Verify that the latest event status value is visible."""
96- logging .info (f"Verifying subject has the status: { latest_event_status } " )
112+ logging .info (
113+ f"[UI ASSERTION] Verifying subject has the status: { latest_event_status } "
114+ )
97115 latest_event_status_cell = self .get_latest_event_status_cell (
98116 latest_event_status
99117 )
100118 try :
101119 expect (latest_event_status_cell ).to_be_visible ()
102- logging .info (f"Subject has the status: { latest_event_status } " )
120+ logging .info (
121+ f"[UI ASSERTION COMPLETE] Subject has the status: { latest_event_status } "
122+ )
103123 except Exception :
104- pytest .fail (f"Subject does not have the status: { latest_event_status } " )
124+ raise AssertionError (
125+ f"[UI ASSERTION FAILED] Subject does not have the status: { latest_event_status } "
126+ )
105127
106128 def click_record_other_post_investigation_contact_button (self ) -> None :
107129 """Click the 'Record other post-investigation contact' button."""
@@ -127,6 +149,28 @@ def check_advance_checkbox(self) -> None:
127149 """Selects the 'Advance FOBT' checkbox"""
128150 self .advance_checkbox .check ()
129151
152+ def click_amend_diagnosis_date_button (self ) -> None :
153+ """Checks the 'Advance FOBT' checkbox and clicks the 'Amend Diagnosis Date' button."""
154+ self .advance_checkbox_v2 .check ()
155+ self .click (self .amend_diagnosis_date_button )
156+
157+ def click_and_select_subsequent_assessment_appointment_required (
158+ self , option : str
159+ ) -> None :
160+ """
161+ Click the 'Subsequent Assessment Appointment Required' button and select an option from the dropdown.
162+ Args:
163+ option (str): The option to select from the dropdown.
164+ Must be one of:
165+ - 'Previous attendance, further assessment required'
166+ - 'Interpreter requirement not identified'
167+ - 'SC interpreter DNA'
168+ """
169+ self .subsequent_assessment_appointment_required_dropdown .select_option (
170+ label = option
171+ )
172+ self .safe_accept_dialog (self .subsequent_assessment_appointment_required_button )
173+
130174 def click_suitable_for_radiological_test_button (self ) -> None :
131175 """Click the 'Suitable for Radiological Test' button."""
132176 self .safe_accept_dialog (self .suitable_for_radiological_test_button )
@@ -148,7 +192,9 @@ def select_ct_colonography_and_invite(self) -> None:
148192 Enters today's date, selects 'CT Colonography' as the diagnostic test type,
149193 and clicks the 'Invite for Diagnostic Test' button.
150194 """
151- logging .info ("[ADVANCE EPISODE] Selecting CT Colonography and inviting for diagnostic test" )
195+ logging .info (
196+ "[ADVANCE EPISODE] Selecting CT Colonography and inviting for diagnostic test"
197+ )
152198
153199 # Step 1: Enter today's date
154200 today = date .today ().strftime ("%d/%m/%Y" )
@@ -160,7 +206,9 @@ def select_ct_colonography_and_invite(self) -> None:
160206 logging .info ("[ADVANCE EPISODE] Selected test type: CT Colonography" )
161207
162208 # Step 3: Click 'Invite for Diagnostic Test'
163- invite_button = self .page .get_by_role ("button" , name = "Invite for Diagnostic Test >>" )
209+ invite_button = self .page .get_by_role (
210+ "button" , name = "Invite for Diagnostic Test >>"
211+ )
164212 self .safe_accept_dialog (invite_button )
165213
166214 logging .info ("[ADVANCE EPISODE] Invite for diagnostic test completed" )
@@ -177,7 +225,9 @@ def record_contact_close_episode_no_contact(self) -> None:
177225 - Selects the outcome 'Close Episode - No Contact'
178226 - Clicks the save button
179227 """
180- logging .info ("[CONTACT RECORD] Starting contact recording flow with outcome: Close Episode - No Contact" )
228+ logging .info (
229+ "[CONTACT RECORD] Starting contact recording flow with outcome: Close Episode - No Contact"
230+ )
181231
182232 # Step 1: Click 'Record Contact with Patient' button
183233 self .page .get_by_role ("button" , name = "Record Contact with Patient" ).click ()
@@ -191,16 +241,28 @@ def record_contact_close_episode_no_contact(self) -> None:
191241 self .page .locator ("#UI_START_TIME" ).fill ("09:00" )
192242 self .page .locator ("#UI_END_TIME" ).fill ("09:10" )
193243 self .page .locator ("#UI_DURATION" ).fill ("10" )
194- logging .info ("[CONTACT RECORD] Entered time details: 09:00–09:10, duration 10 mins" )
244+ logging .info (
245+ "[CONTACT RECORD] Entered time details: 09:00–09:10, duration 10 mins"
246+ )
195247
196248 # Step 4: Enter note
197249 self .page .locator ("#UI_COMMENT_ID" ).fill ("automation test note" )
198250 logging .info ("[CONTACT RECORD] Entered note: automation test note" )
199251
200252 # Step 5: Select outcome
201- self .page .locator ("#UI_OUTCOME" ).select_option (label = "Close Episode - No Contact" )
253+ self .page .locator ("#UI_OUTCOME" ).select_option (
254+ label = "Close Episode - No Contact"
255+ )
202256 logging .info ("[CONTACT RECORD] Selected outcome: Close Episode - No Contact" )
203257
204258 # Step 6: Click save
205259 self .page .locator ("input[name='UI_BUTTON_SAVE']" ).click ()
206260 logging .info ("[CONTACT RECORD] Contact recording flow completed successfully" )
261+
262+ def click_not_suitable_for_diagnostic_tests_button (self ) -> None :
263+ """Click the 'Not Suitable for Diagnostic Tests' button."""
264+ self .safe_accept_dialog (self .not_suitable_for_diagnostic_tests_button )
265+
266+ def click_cancel_diagnostic_test_button (self ) -> None :
267+ """Click the 'Cancel Diagnostic Test' button."""
268+ self .safe_accept_dialog (self .cancel_diagnostic_test_button )
0 commit comments