88)
99from utils .batch_processing import batch_processing
1010from pages .logout .log_out_page import LogoutPage
11+ from pages .datasets .subject_datasets_page import SubjectDatasetsPage
1112
1213
1314@pytest .mark .vpn_required
@@ -27,16 +28,15 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
2728 UserTools .user_login (page , "Screening Centre Manager at BCS001" )
2829
2930 # This needs to be repeated for two subjects, one old and one not - High Risk Result
30- nhs_no = "9619187075"
31+ nhs_no = "9619187075" # Dummy NHS Number (will not work)
3132 verify_subject_event_status_by_nhs_no (
3233 page , nhs_no , "A323 - Post-investigation Appointment NOT Required"
3334 )
3435
3536 SubjectScreeningSummaryPage (page ).click_datasets_link ()
37+ SubjectDatasetsPage (page ).click_investigation_show_datasets ()
3638
37- page .locator ("div" ).filter (
38- has_text = "Investigation (1 Dataset) Show Dataset"
39- ).get_by_role ("link" ).click ()
39+ # The following code is on the investigation datasets page
4040 page .locator ("#UI_SITE_SELECT_LINK" ).click ()
4141 page .locator ("#UI_RESULTS_rljsjnkh" ).select_option ("35317" )
4242 page .locator ("#UI_SSP_PIO_SELECT_LINK" ).click ()
@@ -111,74 +111,75 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
111111 ).click ()
112112
113113 expect (page .get_by_text ("High-risk findings" )).to_be_visible ()
114- page .get_by_role ("link" , name = "Back" ).click ()
114+ BasePage (page ).click_back_button ()
115+
116+ # The following code is on the subject datasets page
115117 expect (page .get_by_text ("** Completed **" ).nth (1 )).to_be_visible ()
116- page . get_by_role ( "link" , name = "Back" ). click ()
118+ BasePage ( page ). click_back_button ()
117119
118- page .get_by_role ("button" , name = "Advance FOBT Screening Episode" ).click ()
120+ SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
121+ # The following code is on the advance fobt screening episode page
119122 page .get_by_role ("button" , name = "Enter Diagnostic Test Outcome" ).click ()
123+ # The following code is on the diagnostic test outcome page
120124 expect (page .get_by_role ("cell" , name = "High-risk findings" ).nth (1 )).to_be_visible ()
121125 page .get_by_label ("Outcome of Diagnostic Test" ).select_option ("20365" )
122126 page .get_by_role ("button" , name = "Save" ).click ()
123127
124128 # This is if the subject is too old
125- expect (
126- page .get_by_role (
127- "cell" ,
128- name = "A394 - Handover into Symptomatic Care for Surveillance - Patient Age" ,
129- exact = True ,
130- )
131- ).to_be_visible ()
132- page .get_by_role ("button" , name = "Advance FOBT Screening Episode" ).click ()
129+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
130+ "A394 - Handover into Symptomatic Care for Surveillance - Patient Age"
131+ )
132+ SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
133+
134+ # The following code is on the advance fobt screening episode page
133135 page .get_by_role ("button" , name = "Handover into Symptomatic Care" ).click ()
136+
137+ # The following code is on the handover into symptomatic care page
134138 page .get_by_label ("Referral" ).select_option ("20445" )
135139 page .get_by_role ("button" , name = "Calendar" ).click ()
136- page .get_by_role ("cell" , name = "9" , exact = True ).click ()
140+ page .get_by_role (
141+ "cell" , name = "9" , exact = True
142+ ).click () # Todays date (v1 calendar picker)
137143 page .locator ("#UI_NS_CONSULTANT_PIO_SELECT_LINK" ).click ()
138144 page .locator ("#UI_RESULTS_usgwmbob" ).select_option ("201" )
139145 page .locator ("#UI_NS_PRACTITIONER_PIO_SELECT_LINK" ).click ()
140146 page .get_by_role ("textbox" , name = "Notes" ).click ()
141147 page .get_by_role ("textbox" , name = "Notes" ).fill ("Test Automation" )
142- page .once ("dialog" , lambda dialog : dialog .dismiss ())
148+ page .once ("dialog" , lambda dialog : dialog .accept ())
143149 page .get_by_role ("button" , name = "Save" ).click ()
144- expect (
145- page .get_by_role (
146- "cell" , name = "A385 - Handover into Symptomatic Care" , exact = True
147- )
148- ).to_be_visible ()
150+
151+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
152+ "A385 - Handover into Symptomatic Care"
153+ )
149154
150155 # This is if the subject is not too old
151- expect (
152- page .get_by_role (
153- "cell" ,
154- name = "A318 - Post-investigation Appointment NOT Required - Result Letter Created" ,
155- exact = True ,
156- )
157- ).to_be_visible ()
158- page .get_by_role ("button" , name = "Advance FOBT Screening Episode" ).click ()
156+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
157+ "A318 - Post-investigation Appointment NOT Required - Result Letter Created"
158+ )
159+ SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
160+
161+ # The following code is on the advance fobt screening episode page
159162 page .get_by_role ("button" , name = "Record Diagnosis Date" ).click ()
163+
164+ # The following code is on the record diagnosis date page
160165 page .locator ("#diagnosisDate" ).click ()
161- page .locator ("#diagnosisDate" ).fill ("09 May 2025" )
166+ page .locator ("#diagnosisDate" ).fill ("09 May 2025" ) # Todays date
162167 page .get_by_role ("button" , name = "Save" ).click ()
163- expect (
164- page .get_by_role (
165- "cell" ,
166- name = "A318 - Post-investigation Appointment NOT Required - Result Letter Created" ,
167- exact = True ,
168- )
169- ).to_be_visible () #
168+
169+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
170+ "A318 - Post-investigation Appointment NOT Required - Result Letter Created"
171+ )
170172
171173 # This needs to be repeated for two subjects, one old and one not - LBPCP Result
172- nhs_no = "9619187075"
174+ nhs_no = "9619187075" # Dummy NHS Number (will not work)
173175 verify_subject_event_status_by_nhs_no (
174176 page , nhs_no , "A323 - Post-investigation Appointment NOT Required"
175177 )
176178
177179 SubjectScreeningSummaryPage (page ).click_datasets_link ()
180+ SubjectDatasetsPage (page ).click_investigation_show_datasets ()
178181
179- page .locator ("div" ).filter (
180- has_text = "Investigation (1 Dataset) Show Dataset"
181- ).get_by_role ("link" ).click ()
182+ # The following code is on the investigation datasets page
182183 page .locator ("#UI_SITE_SELECT_LINK" ).click ()
183184 page .locator ("#UI_RESULTS_cwfoncwk" ).select_option ("35317" )
184185 page .locator ("#UI_SSP_PIO_SELECT_LINK" ).click ()
@@ -239,70 +240,77 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
239240 ).click ()
240241
241242 expect (page .get_by_text ("LNPCP" )).to_be_visible ()
242- page .get_by_role ("link" , name = "Back" ).click ()
243+ BasePage (page ).click_back_button ()
244+
245+ # The following code is on the subject datasets page
243246 expect (page .get_by_text ("** Completed **" ).nth (1 )).to_be_visible ()
244- page .get_by_role ("link" , name = "Back" ).click ()
245- page .get_by_role ("button" , name = "Advance FOBT Screening Episode" ).click ()
247+ BasePage (page ).click_back_button ()
248+
249+ SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
250+
251+ # The following code is on the advance fobt screening episode page
246252 page .get_by_role ("button" , name = "Enter Diagnostic Test Outcome" ).click ()
253+
254+ # The following code is on the diagnostic test outcome page
247255 expect (page .get_by_role ("cell" , name = "LNPCP" ).nth (1 )).to_be_visible ()
248256 page .get_by_label ("Outcome of Diagnostic Test" ).select_option ("20365" )
249257 page .get_by_role ("button" , name = "Save" ).click ()
250258
251259 # If the subject is too old
252- expect (
253- page .get_by_role (
254- "cell" ,
255- name = "A394 - Handover into Symptomatic Care for Surveillance - Patient Age" ,
256- exact = True ,
257- )
258- ).to_be_visible ()
259- page .get_by_role ("button" , name = "Advance FOBT Screening Episode" ).click ()
260+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
261+ "A394 - Handover into Symptomatic Care for Surveillance - Patient Age"
262+ )
263+ SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
264+
265+ # The following code is on the advance fobt screening episode page
260266 page .get_by_role ("button" , name = "Handover into Symptomatic Care" ).click ()
267+
268+ # The following code is on the handover into symptomatic care page
261269 page .get_by_label ("Referral" ).select_option ("20445" )
262270 page .get_by_role ("button" , name = "Calendar" ).click ()
263- page .get_by_role ("cell" , name = "9" , exact = True ).click ()
271+ page .get_by_role (
272+ "cell" , name = "9" , exact = True
273+ ).click () # Todays date (v1 calendar picker)
264274 page .locator ("#UI_NS_CONSULTANT_PIO_SELECT_LINK" ).click ()
265275 page .locator ("#UI_RESULTS_ktdtoepq" ).select_option ("201" )
266276 page .locator ("#UI_NS_PRACTITIONER_PIO_SELECT_LINK" ).click ()
267277 page .get_by_role ("textbox" , name = "Notes" ).click ()
268278 page .get_by_role ("textbox" , name = "Notes" ).fill ("Test Automation" )
269- page .once ("dialog" , lambda dialog : dialog .dismiss ())
279+ page .once ("dialog" , lambda dialog : dialog .accept ())
270280 page .get_by_role ("button" , name = "Save" ).click ()
271- expect (
272- page .get_by_role (
273- "cell" , name = "A385 - Handover into Symptomatic Care" , exact = True
274- )
275- ).to_be_visible ()
281+
282+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
283+ "A385 - Handover into Symptomatic Care"
284+ )
276285
277286 # If the subject is not too old
278- expect (
279- page .get_by_role (
280- "cell" ,
281- name = "A318 - Post-investigation Appointment NOT Required - Result Letter Created" ,
282- exact = True ,
283- )
284- ).to_be_visible ()
285- page .get_by_role ("button" , name = "Advance FOBT Screening Episode" ).click ()
287+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
288+ "A318 - Post-investigation Appointment NOT Required - Result Letter Created"
289+ )
290+ SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
291+
292+ # The following code is on the advance fobt screening episode page
286293 page .get_by_role ("button" , name = "Record Diagnosis Date" ).click ()
294+
295+ # The following code is on the record diagnosis date page
287296 page .locator ("#diagnosisDate" ).click ()
288- page .locator ("#diagnosisDate" ).fill ("09 May 2025" )
297+ page .locator ("#diagnosisDate" ).fill ("09 May 2025" ) # Todays date
289298 page .get_by_role ("button" , name = "Save" ).click ()
290- expect (
291- page .get_by_role (
292- "cell" ,
293- name = "A318 - Post-investigation Appointment NOT Required - Result Letter Created" ,
294- exact = True ,
295- )
296- ).to_be_visible ()
299+
300+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
301+ "A318 - Post-investigation Appointment NOT Required - Result Letter Created"
302+ )
297303
298304 # This needs to be repeated for 1 subject, age does not matter - Normal Result
299- nhs_no = "9619187075"
305+ nhs_no = "9619187075" # Dummy NHS Number (will not work)
300306 verify_subject_event_status_by_nhs_no (
301307 page , nhs_no , "A323 - Post-investigation Appointment NOT Required"
302308 )
303309
304310 SubjectScreeningSummaryPage (page ).click_datasets_link ()
311+ SubjectDatasetsPage (page ).click_investigation_show_datasets ()
305312
313+ # The following code is on the investigation datasets page
306314 page .locator ("#UI_SITE_SELECT_LINK" ).click ()
307315 page .locator ("#UI_RESULTS_mjbnjlos" ).select_option ("35317" )
308316 page .locator ("#UI_SSP_PIO_SELECT_LINK" ).click ()
@@ -352,28 +360,36 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
352360 "button" , name = "Save Dataset"
353361 ).click ()
354362 expect (page .get_by_text ("Normal (No Abnormalities" )).to_be_visible ()
355- page .get_by_role ("link" , name = "Back" ).click ()
363+ BasePage (page ).click_back_button ()
364+
365+ # The following code is on the subject datasets page
356366 expect (page .get_by_text ("** Completed **" ).nth (1 )).to_be_visible ()
357- page .get_by_role ("link" , name = "Back" ).click ()
358- page .get_by_role ("button" , name = "Advance FOBT Screening Episode" ).click ()
367+ BasePage (page ).click_back_button ()
368+
369+ SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
370+
371+ # The following code is on the advance fobt screening episode page
359372 page .get_by_role ("button" , name = "Enter Diagnostic Test Outcome" ).click ()
373+
374+ # The following code is on the diagnostic test outcome page
360375 expect (
361376 page .get_by_role ("cell" , name = "Normal (No Abnormalities" ).nth (1 )
362377 ).to_be_visible ()
363378 page .get_by_label ("Outcome of Diagnostic Test" ).select_option ("" )
364379 page .get_by_label ("Outcome of Diagnostic Test" ).select_option ("20360" )
365380 page .get_by_role ("button" , name = "Save" ).click ()
366- expect (
367- page .get_by_role (
368- "cell" ,
369- name = "A318 - Post-investigation Appointment NOT Required - Result Letter Created" ,
370- exact = True ,
371- )
372- ).to_be_visible ()
373- page .get_by_role ("button" , name = "Advance FOBT Screening Episode" ).click ()
381+
382+ SubjectScreeningSummaryPage (page ).verify_latest_event_status_value (
383+ "A318 - Post-investigation Appointment NOT Required - Result Letter Created"
384+ )
385+ SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
386+
387+ # The following code is on the advance fobt screening episode page
374388 page .get_by_role ("button" , name = "Record Diagnosis Date" ).click ()
389+
390+ # The following code is on the record diagnosis date page
375391 page .locator ("#diagnosisDate" ).click ()
376- page .locator ("#diagnosisDate" ).fill ("09 May 2025" )
392+ page .locator ("#diagnosisDate" ).fill ("09 May 2025" ) # Todays date
377393 page .get_by_role ("button" , name = "Save" ).click ()
378394
379395 # Modification needs to be done to accept this list. it should check if any of the values in this list are present. Something like the following:
@@ -386,6 +402,7 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
386402 # return locator
387403
388404 batch_processing (
405+ page ,
389406 "A318" ,
390407 "Result Letters - No Post-investigation Appointment" ,
391408 [
@@ -396,12 +413,14 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
396413 )
397414
398415 batch_processing (
416+ page ,
399417 "A385" ,
400418 "Handover into Symptomatic Care Adenoma Surveillance, Age - GP Letter" ,
401419 "A382 - Handover into Symptomatic Care - GP Letter Printed" ,
402420 )
403421
404422 batch_processing (
423+ page ,
405424 "A382" ,
406425 "Handover into Symptomatic Care Adenoma Surveillance - Patient Letter" ,
407426 "P202 - Waiting Completion of Outstanding Events" ,
0 commit comments