Skip to content

Commit 38b3b6c

Browse files
committed
Scenario 5
1 parent cee24b5 commit 38b3b6c

File tree

1 file changed

+227
-0
lines changed

1 file changed

+227
-0
lines changed
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
import pytest
2+
from playwright.sync_api import Page
3+
from pages.organisations.organisations_page import OrganisationSwitchPage
4+
from utils.user_tools import UserTools
5+
from utils.subject_assertion import subject_assertion
6+
import logging
7+
from utils.batch_processing import batch_processing
8+
from pages.logout.log_out_page import LogoutPage
9+
from utils.generate_health_check_forms_util import GenerateHealthCheckFormsUtil
10+
from utils import screening_subject_page_searcher
11+
from pages.screening_subject_search.subject_screening_summary_page import (
12+
SubjectScreeningSummaryPage,
13+
)
14+
from pages.screening_subject_search.advance_surveillance_episode_page import (
15+
AdvanceSurveillanceEpisodePage,
16+
)
17+
from pages.screening_subject_search.contact_with_patient_page import (
18+
ContactWithPatientPage,
19+
)
20+
from pages.screening_subject_search.discharge_from_surveillance_page import (
21+
DischargeFromSurveillancePage,
22+
)
23+
from utils.sspi_change_steps import SSPIChangeSteps
24+
25+
26+
@pytest.mark.vpn_required
27+
@pytest.mark.regression
28+
@pytest.mark.surveillance_regression_tests
29+
def test_scenario_3(page: Page, general_properties: dict) -> None:
30+
"""
31+
Discharge below/in-age patient for no contact
32+
33+
X500-X505-A99-A59-A259-A315-A361-A323-A317-A318-A380-X513-X398-X387-X377-C203 [SSCL27b] X900-X600-X615-X625-X398-X387-X377-C203 [SSCL27a]
34+
35+
This scenario tests closure of a Surveillance episode on discharge for no contact, for both an in-age and (following a reopen for patient decision) a below-age subject. It test two routes to this closure: one where contact is lost following a failed diagnostic test and referral for a second, and one following screening centre DNA of an assessment appointment.
36+
37+
Because we cannot know if we will be inviting a subject who has had previous FOBT episodes, or only a bowel scope episode, it is impossible to check if they will be set to Call or Recall; we can only check that they are not longer in Surveillance status.
38+
39+
40+
Scenario summary:
41+
42+
> Run surveillance invitations for 1 subject > X500 (3.1)
43+
> SSPI update changes subject to in-age at recall
44+
> Process X500 letter batch > X505 (3.1)
45+
> Complete the colonoscopy assessment dataset - fit for colonoscopy
46+
> Record patient contact – contacted, suitable for colonoscopy > A99 (3.1)
47+
> Invite for diagnostic test > A59 (2.1)
48+
> Attend diagnostic test > A259 (2.1)
49+
> Complete investigation dataset – no result (2.1)
50+
> Enter diagnostic test outcome – failed test, refer another > A315 (2.1)
51+
> Post-investigation appointment not required > A361 (2.1)
52+
> Record patient contact – post-investigation appointment not required > A323 (2.1) > A317 > A318 (2.5)
53+
> Process A318 letter batch > A380 (2.5)
54+
> Record patient contact – no contact, close on no contact > X513 (2.3)
55+
> Record discharge from surveillance > X398 (3.4)
56+
> Process X398 letter batch > X387 (3.4)
57+
> Process X387 letter batch > X377 > C203 (3.4)
58+
> Check recall [SSCL27b]
59+
> SSPI update changes subject to below-age at recall
60+
> Reopen episode due to subject or patient decision > X900 (3.1)
61+
> Invite for assessment appointment > X600 (3.1)
62+
> Book SSP appointment from report > X610 (3.3)
63+
> Process X610 letter batch > X615 (3.3)
64+
> Screening Centre DNA assessment appointment > X625 (3.3)
65+
> Record discharge from surveillance, no contact > X398 (3.4)
66+
> Process X398 letter batch > X387 (3.4)
67+
> Process X387 letter batch > X377 > C203 (3.4)
68+
> Check recall [SSCL27a]
69+
"""
70+
# Given I log in to BCSS "England" as user role "Specialist Screening Practitioner"
71+
user_role = UserTools.user_login(
72+
page, "Specialist Screening Practitioner at BCS009 & BCS001", True
73+
)
74+
75+
OrganisationSwitchPage(page).select_organisation_by_id("BCS001")
76+
OrganisationSwitchPage(page).click_continue()
77+
if user_role is None:
78+
raise ValueError("User role is none")
79+
80+
# When I run surveillance invitations for 1 subject
81+
org_id = general_properties["eng_screening_centre_id"]
82+
nhs_no = GenerateHealthCheckFormsUtil(page).invite_surveillance_subjects_early(
83+
org_id
84+
)
85+
logging.info(f"[SUBJECT RETRIEVAL] Subject's NHS Number: {nhs_no}")
86+
87+
# Then my subject has been updated as follows:
88+
subject_assertion(
89+
nhs_no,
90+
{
91+
"latest episode status": "Open",
92+
"latest episode type": "Surveillance",
93+
"latest event status": "X500 Selected For Surveillance",
94+
"responsible screening centre code": "User's screening centre",
95+
"subject has unprocessed SSPI updates": "No",
96+
"subject has user DOB updates": "No",
97+
},
98+
user_role,
99+
)
100+
101+
# When I receive an SSPI update to change their date of birth to "62" years old
102+
SSPIChangeSteps().sspi_update_to_change_dob_received(nhs_no, 62)
103+
104+
# Then my subject has been updated as follows:
105+
subject_assertion(nhs_no, {"subject age": "62"})
106+
107+
# And there is a "X500" letter batch for my subject with the exact title "Surveillance Selection"
108+
# When I process the open "X500" letter batch for my subject
109+
batch_processing(
110+
page,
111+
"X500",
112+
"Surveillance Selection",
113+
)
114+
115+
# Then my subject has been updated as follows:
116+
subject_assertion(nhs_no, {"latest event status": "X505 HealthCheck Form Printed"})
117+
118+
# When I view the subject
119+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
120+
# And I edit the Colonoscopy Assessment Dataset for this subject
121+
122+
# And I select the advance episode option for "Record Contact with Patient"
123+
SubjectScreeningSummaryPage(page).click_advance_surveillance_episode_button()
124+
AdvanceSurveillanceEpisodePage(page).click_record_contact_with_patient_button()
125+
126+
# And I record contact with the subject with outcome "Discharge from surveillance - patient choice"
127+
ContactWithPatientPage(page).record_contact(
128+
"Discharge from surveillance - patient choice"
129+
)
130+
131+
# Then my subject has been updated as follows:
132+
subject_assertion(
133+
nhs_no,
134+
{
135+
"latest event status": "X512 Patient Contact Resulted in Discharge from Surveillance"
136+
},
137+
)
138+
139+
# When I view the subject
140+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
141+
142+
# And I select the advance episode option for "Discharge from Surveillance - Patient Choice"
143+
SubjectScreeningSummaryPage(page).click_advance_surveillance_episode_button()
144+
AdvanceSurveillanceEpisodePage(
145+
page
146+
).click_discharge_from_surveillance_patient_choice_button()
147+
148+
# And I complete the Discharge from Surveillance form
149+
DischargeFromSurveillancePage(page).complete_discharge_from_surveillance_form(False)
150+
151+
# Then my subject has been updated as follows:
152+
subject_assertion(
153+
nhs_no,
154+
{"latest event status": "X392 Discharge from Surveillance - Patient Choice"},
155+
)
156+
157+
# When I view the subject
158+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
159+
160+
# Then I "cannot" postpone the subject's surveillance episode
161+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode(False)
162+
163+
# And there is a "X392" letter batch for my subject with the exact title "Discharge from surveillance - patient decision (letter to patient)"
164+
# When I process the open "X392" letter batch for my subject
165+
batch_processing(
166+
page,
167+
"X392",
168+
"Discharge from surveillance - patient decision (letter to patient)",
169+
)
170+
171+
# Then my subject has been updated as follows:
172+
subject_assertion(
173+
nhs_no,
174+
{
175+
"latest event status": "X386 Discharged from Surveillance - Patient Letter Printed"
176+
},
177+
)
178+
179+
# When I view the subject
180+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
181+
182+
# Then I "cannot" postpone the subject's surveillance episode
183+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode(False)
184+
185+
# And there is a "X386" letter batch for my subject with the exact title "Discharge from surveillance - patient decision (letter to GP)"
186+
# When I process the open "X386" letter batch for my subject
187+
batch_processing(
188+
page,
189+
"X386",
190+
"Discharge from surveillance - patient decision (letter to GP)",
191+
)
192+
193+
# Then my subject has been updated as follows:
194+
subject_assertion(
195+
nhs_no,
196+
{
197+
"calculated fobt due date": "2 years from episode end",
198+
"calculated lynch due date": "Null",
199+
"calculated surveillance due date": "Null",
200+
"ceased confirmation date": "Null",
201+
"ceased confirmation details": "Null",
202+
"ceased confirmation user id": "Null",
203+
"clinical reason for cease": "Null",
204+
"latest episode accumulated result": "(Any) Surveillance non-participation",
205+
"latest episode recall calculation method": "Episode end date",
206+
"latest episode recall episode type": "FOBT Screening",
207+
"latest episode recall surveillance type": "Null",
208+
"latest episode status": "Closed",
209+
"latest episode status reason": "Discharge from Surveillance - Patient Choice",
210+
"latest event status": "X376 Discharged from Surveillance - GP Letter Printed",
211+
"lynch due date": "Null",
212+
"lynch due date date of change": "Unchanged",
213+
"lynch due date reason": "Unchanged",
214+
"screening due date": "Calculated FOBT due date",
215+
"screening due date reason": "Discharge from Surveillance - Patient Choice",
216+
"screening due date date of change": "Today",
217+
"screening status": "NOT: Surveillance",
218+
"screening status date of change": "Today",
219+
"screening status reason": "Patient Choice",
220+
"surveillance due date": "Null",
221+
"surveillance due date date of change": "Today",
222+
"surveillance due date reason": "Discharge from Surveillance - Patient Choice",
223+
},
224+
user_role,
225+
)
226+
227+
LogoutPage(page).log_out()

0 commit comments

Comments
 (0)