3535 AppointmentAttendance ,
3636 book_post_investigation_appointment ,
3737)
38+ from utils .calendar_picker import CalendarPicker
3839from utils .generate_health_check_forms_util import GenerateHealthCheckFormsUtil
3940from utils .sspi_change_steps import SSPIChangeSteps
4041from utils .user_tools import UserTools
4142from utils .subject_assertion import subject_assertion
4243import logging
4344from utils .batch_processing import batch_processing
4445from pages .logout .log_out_page import LogoutPage
45- from datetime import datetime
46+ from datetime import datetime , timedelta
4647from classes .repositories .subject_repository import SubjectRepository
4748from utils .oracle .oracle_specific_functions .organisation_parameters import (
4849 set_org_parameter_value ,
@@ -92,58 +93,59 @@ def test_scenario_1(page: Page, general_properties: dict) -> None:
9293 > Process X382 letter batch > X79 > C203 (3.4)
9394 > Check recall [SSCL25a]
9495
95- # """
96+ """
9697 # Given I log in to BCSS "England" as user role "Screening Centre Manager at BCS001"
9798 user_role = UserTools .user_login (
9899 page , "Screening Centre Manager at BCS001" , return_role_type = True
99100 )
100- # if user_role is None:
101- # raise ValueError("User cannot be assigned to a UserRoleType")
102-
103- # # When I run surveillance invitations for 1 subject
104-
105- # nhs_no = GenerateHealthCheckFormsUtil(page).invite_surveillance_subjects_early(general_properties["eng_screening_centre_id"])
106- # # Then my subject has been updated as follows:
107-
108- # criteria = {
109- # "latest episode status": "Open",
110- # "latest episode type": "Surveillance",
111- # "latest event status": "X500 Selected For Surveillance",
112- # "responsible screening centre code": "User's screening centre",
113- # "subject has unprocessed sspi updates": "No",
114- # "subject has user dob updates": "No",
115- # }
116-
117- # subject_assertion(nhs_no, criteria,user_role)
118- # # And there is a "X500" letter batch for my subject with the exact title "Surveillance Selection"
119- # SubjectRepository().there_is_letter_batch_for_subject(
120- # nhs_no, "X500", "Surveillance Selection"
121- # )
122- # # Then Comment: NHS number logging.info(f"Surveillance Scenario NHS Number: {nhs_number}")
101+ if user_role is None :
102+ raise ValueError ("User cannot be assigned to a UserRoleType" )
103+
104+ # When I run surveillance invitations for 1 subject
105+
106+ nhs_no = GenerateHealthCheckFormsUtil (page ).invite_surveillance_subjects_early (
107+ general_properties ["eng_screening_centre_id" ]
108+ )
109+ # Then my subject has been updated as follows:
110+
111+ criteria = {
112+ "latest episode status" : "Open" ,
113+ "latest episode type" : "Surveillance" ,
114+ "latest event status" : "X500 Selected For Surveillance" ,
115+ "responsible screening centre code" : "User's screening centre" ,
116+ "subject has unprocessed sspi updates" : "No" ,
117+ "subject has user dob updates" : "No" ,
118+ }
119+
120+ subject_assertion (nhs_no , criteria , user_role )
121+ # And there is a "X500" letter batch for my subject with the exact title "Surveillance Selection"
122+ SubjectRepository ().there_is_letter_batch_for_subject (
123+ nhs_no , "X500" , "Surveillance Selection"
124+ )
125+ # Then Comment: NHS number logging.info(f"Surveillance Scenario NHS Number: {nhs_number}")
123126 # When I set the value of parameter 82 to "Y" for my organisation with immediate effect
124- # org_id = general_properties["eng_screening_centre_id"]
125- # set_org_parameter_value(82, "Y", org_id)
126- # # When I receive an SSPI update to change their date of birth to "72" years old
127- # SSPIChangeSteps().sspi_update_to_change_dob_received(nhs_no, 72)
128- # # Then my subject has been updated as follows:
129- # subject_assertion(nhs_no, {"subject age": "72"})
130- # # When I process the open "X500" letter batch for my subject
131- # batch_processing(
132- # page,
133- # batch_type="X500",
134- # batch_description="Surveillance Selection",
135- # )
136- # # Then my subject has been updated as follows:
137- # subject_assertion(
138- # nhs_no,
139- # {
140- # "latest event status": "X505 HealthCheck Form Printed",
141- # },
142- # )
143- # UserTools.user_login(
144- # page, "Screening Centre Manager at BCS001", return_role_type=True
145- # )
146- nhs_no = "9712072282"
127+ org_id = general_properties ["eng_screening_centre_id" ]
128+ set_org_parameter_value (82 , "Y" , org_id )
129+ # When I receive an SSPI update to change their date of birth to "72" years old
130+ SSPIChangeSteps ().sspi_update_to_change_dob_received (nhs_no , 72 )
131+ # Then my subject has been updated as follows:
132+ subject_assertion (nhs_no , {"subject age" : "72" })
133+ # When I process the open "X500" letter batch for my subject
134+ batch_processing (
135+ page ,
136+ batch_type = "X500" ,
137+ batch_description = "Surveillance Selection" ,
138+ )
139+ # Then my subject has been updated as follows:
140+ subject_assertion (
141+ nhs_no ,
142+ {
143+ "latest event status" : "X505 HealthCheck Form Printed" ,
144+ },
145+ )
146+ UserTools .user_login (
147+ page , "Screening Centre Manager at BCS001" , return_role_type = True
148+ )
147149 # When I view the subject
148150 screening_subject_page_searcher .navigate_to_subject_summary_page (page , nhs_no )
149151 # And I select the advance episode option for "Record Contact with Patient"
@@ -217,12 +219,7 @@ def test_scenario_1(page: Page, general_properties: dict) -> None:
217219 screening_subject_page_searcher .navigate_to_subject_summary_page (page , nhs_no )
218220
219221 # And I view the event history for the subject's latest episode
220- SubjectScreeningSummaryPage (page ).expand_episodes_list ()
221- SubjectScreeningSummaryPage (page ).click_first_surveillance_epsiode_link ()
222-
223222 # And I view the latest practitioner appointment in the subject's episode
224- EpisodeEventsAndNotesPage (page ).click_most_recent_view_appointment_link ()
225-
226223 # And the subject DNAs the practitioner appointment
227224 AppointmentAttendance (page ).mark_as_dna ("Patient did not attend" )
228225
@@ -326,7 +323,9 @@ def test_scenario_1(page: Page, general_properties: dict) -> None:
326323 # Then I "cannot" postpone the subject's surveillance episode
327324 SubjectScreeningSummaryPage (page ).can_postpone_surveillance_episode (False )
328325 # When I process the open "X390" letter batch for my subject
329- batch_processing (page , "X390" , "Discharge from Surveillance - Clinical Decision" )
326+ batch_processing (
327+ page , "X390" , "Discharge from surveillance - Clinical (letter to GP)"
328+ )
330329
331330 # Then my subject has been updated as follows:
332331 criteria = {
@@ -416,9 +415,15 @@ def test_scenario_1(page: Page, general_properties: dict) -> None:
416415 # And I choose to book a practitioner clinic for my subject
417416 SubjectScreeningSummaryPage (page = page ).click_book_practitioner_clinic_button ()
418417
419- # And I set the practitioner appointment date to "tomorrow"--recheck this, we dont have anything for tomorrow
418+ # And I set the practitioner appointment date to "tomorrow"
420419 # And I book the earliest available post investigation appointment on this date
421- book_post_investigation_appointment (page , "The Royal Hospital (Wolverhampton)" )
420+
421+ tomorrow = datetime .today () + timedelta (days = 1 )
422+ book_post_investigation_appointment (
423+ page ,
424+ "The Royal Hospital (Wolverhampton)" ,
425+ appointment_date = tomorrow ,
426+ )
422427
423428 # Then my subject has been updated as follows:
424429 subject_assertion (
@@ -441,7 +446,11 @@ def test_scenario_1(page: Page, general_properties: dict) -> None:
441446 EpisodeEventsAndNotesPage (page ).click_most_recent_view_appointment_link ()
442447
443448 # And the Screening Centre reschedules the surveillance practitioner appointment to "today"-recheck this
444- AppointmentDetailPage (page ).mark_appointment_as_attended (datetime .today ())
449+ AppointmentDetailPage (page ).click_reschedule_radio ()
450+ AppointmentDetailPage (page ).click_calendar_button ()
451+ CalendarPicker (page ).v2_calendar_picker (datetime .today ())
452+ book_post_investigation_appointment (page , "The Royal Hospital (Wolverhampton)" )
453+
445454 # Then my subject has been updated as follows:
446455 subject_assertion (
447456 nhs_no ,
0 commit comments