Skip to content

Commit 8323eeb

Browse files
committed
wip
1 parent 56246b4 commit 8323eeb

File tree

2 files changed

+229
-0
lines changed

2 files changed

+229
-0
lines changed

tests/regression/regression_tests/fobt_regression_tests/scenario_2.py

Whitespace-only changes.
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
import pytest
2+
import logging
3+
import datetime
4+
from playwright.sync_api import Page
5+
from utils.oracle.subject_creation_util import CreateSubjectSteps
6+
from utils.user_tools import UserTools
7+
from utils.subject_assertion import subject_assertion
8+
from pages.base_page import BasePage
9+
10+
@pytest.mark.fobt_regression_tests
11+
def test_scenario_2(page: Page) -> None:
12+
"""
13+
Scenario: 2: Normal kit reading
14+
15+
S1-S9-S10-S43-S2-S158-S159-C203 [SSCL4a]
16+
17+
This scenario tests the basic scenario where a subject returns their initial test kit which gives a normal result.
18+
19+
Scenario summary:
20+
21+
> Create a new subject in the FOBT age range > Inactive
22+
> Run the FOBT failsafe trawl > Call
23+
> Run the database transition to invite them for FOBT screening > S1(1.1)
24+
> Process S1 letter batch > S9 (1.1)
25+
> Run timed events > creates S9 letter (1.1)
26+
> Process S9 letter batch > S10 (1.1)
27+
> Log kit > S43 (1.2)
28+
> Read kit with NORMAL result > S2 (1.3)
29+
> Process S2 letter batch > S158 (1.3)
30+
> Process S158 letter batch > S159 (1.3) > C203 (1.13)
31+
> Check recall [SSCL4a]
32+
"""
33+
34+
# Given I log in to BCSS "England" as user role "Hub Manager"
35+
UserTools.user_login(page, "Hub Manager State Registered at BCS01")
36+
37+
# Go to screening subject search page
38+
base_page = BasePage(page)
39+
base_page.click_main_menu_link()
40+
base_page.go_to_screening_subject_search_page()
41+
42+
# And I create a subject that meets the following criteria:
43+
# Age (y/d) 66/130
44+
# Active GP practice in hub/SC BCS01/BCS001
45+
requirements = {
46+
"age (y/d)": "66/130",
47+
"active gp practice in hub/sc": "BCS01/BCS001",
48+
}
49+
nhs_no = CreateSubjectSteps().create_custom_subject(requirements)
50+
if nhs_no is None:
51+
pytest.fail("Failed to create subject: NHS number not returned.")
52+
53+
# Then Comment: NHS number
54+
logging.info(f"Created subject's NHS number: {nhs_no}")
55+
56+
# And my subject has been updated as follows:
57+
# Subject age 66
58+
# Subject has episodes No
59+
# Screening status Inactive
60+
subject_assertion(
61+
nhs_no,
62+
{
63+
"age (y/d)": "66/130",
64+
"subject has episodes": "No",
65+
"screening status": "Inactive",
66+
},
67+
)
68+
69+
# When I run the FOBT failsafe trawl for my subject
70+
71+
# Then my subject has been updated as follows:
72+
# Subject has episodes No
73+
# Screening due date Last birthday
74+
# Screening due date date of change Today
75+
# Screening due date reason Failsafe Trawl
76+
# Screening status Call
77+
# Screening status date of change Today
78+
# Screening status reason Failsafe Trawl
79+
today = datetime.datetime.now().strftime("%d/%m/%Y")
80+
81+
subject_assertion(
82+
nhs_no,
83+
{
84+
"subject has episodes": "No",
85+
"Screening Due Date": "Last Birthday",
86+
"Screening due date date of change": today,
87+
"Screening Due Date Reason": "Failsafe Trawl",
88+
"screening status": "Call",
89+
"Screening Status Date of Change": today,
90+
"Screening Status Reason": "Failsafe Trawl",
91+
},
92+
)
93+
94+
# When I invite my subject for FOBT screening
95+
96+
# Then my subject has been updated as follows:
97+
# Latest event status S1 Selected for Screening
98+
# Latest episode kit class FIT
99+
# Latest episode type FOBT
100+
subject_assertion(
101+
nhs_no,
102+
{
103+
"latest event status": "S1 Selected for Screening",
104+
"latest episode kit class": "FIT",
105+
"latest episode type": "FOBT",
106+
},
107+
)
108+
# Then there is a "S1" letter batch for my subject with the exact title "Pre-invitation (FIT)"
109+
110+
# When I process the open "S1" letter batch for my subject
111+
112+
# Then my subject has been updated as follows:
113+
# Latest event status S9 Pre-invitation Sent
114+
subject_assertion(
115+
nhs_no,
116+
{
117+
"latest event status": "S9 Pre-invitation Sent",
118+
},
119+
)
120+
121+
# When I run Timed Events for my subject
122+
# Then there is a "S9" letter batch for my subject with the exact title "Invitation & Test Kit (FIT)"
123+
124+
# When I process the open "S9" letter batch for my subject
125+
126+
# Then my subject has been updated as follows:
127+
# Latest event status S10 Invitation & Test Kit Sent
128+
subject_assertion(
129+
nhs_no,
130+
{
131+
"latest event status": "S10 Invitation & Test Kit Sent",
132+
},
133+
)
134+
# When I log my subject's latest unlogged FIT kit
135+
136+
# Then my subject has been updated as follows:
137+
# Latest event status S43 Kit Returned and Logged (Initial Test)
138+
subject_assertion(
139+
nhs_no,
140+
{
141+
"latest event status": "S43 Kit Returned and Logged (Initial Test)",
142+
},
143+
)
144+
145+
# When I read my subject's latest logged FIT kit as "NORMAL"
146+
147+
# Then my subject has been updated as follows:
148+
# Latest event status S2 Normal
149+
subject_assertion(
150+
nhs_no,
151+
{
152+
"latest event status": "S2 Normal",
153+
},
154+
)
155+
# And there is a "S2" letter batch for my subject with the exact title "Subject Result (Normal)"
156+
157+
# When I process the open "S2" letter batch for my subject
158+
159+
# Then my subject has been updated as follows:
160+
# Latest event status S158 Subject Discharge Sent (Normal)
161+
subject_assertion(
162+
nhs_no,
163+
{
164+
"latest event status": "S158 Subject Discharge Sent (Normal)",
165+
},
166+
)
167+
# And there is a "S158" letter batch for my subject with the exact title "GP Result (Normal)"
168+
169+
# When I process the open "S158" letter batch for my subject
170+
171+
# Then my subject has been updated as follows:
172+
# Calculated screening due date 2 years from latest S158 event
173+
# Calculated Lynch due date Null
174+
# Calculated Surveillance due date Null
175+
# Ceased confirmation date Null
176+
# Ceased confirmation details Null
177+
# Ceased confirmation user ID Null
178+
# Clinical reason for cease Null
179+
# Latest episode accumulated result Definitive normal FOBt outcome
180+
# Latest episode recall calculation method Date of last patient letter
181+
# Latest episode recall episode type FOBT screening
182+
# Latest episode recall surveillance type Null
183+
# Latest episode status Closed
184+
# Latest episode status reason Episode Complete
185+
# Latest event status S159 GP Discharge Sent (Normal)
186+
# Lynch due date Null
187+
# Lynch due date date of change Null
188+
# Lynch due date reason Null
189+
# Screening status Recall
190+
# Screening status date of change
191+
# Not checking as status may or may not have changed
192+
# Screening status reason Recall
193+
# Screening due date Calculated screening due date
194+
# Screening due date date of change Today
195+
# Screening due date reason Recall
196+
# Surveillance due date Null
197+
# Surveillance due date date of change Unchanged
198+
# Surveillance due date reason Unchanged
199+
subject_assertion(
200+
nhs_no,
201+
{
202+
"calculated screening due date": "2 years from latest S158 event",
203+
"calculated lynch due date": None,
204+
"calculated surveillance due date": None,
205+
"ceased confirmation date": None,
206+
"ceased confirmation details": None,
207+
"ceased confirmation user ID": None,
208+
"clinical reason for cease": None,
209+
"latest episode accumulated result": "Definitive normal FOBt outcome",
210+
"latest episode recall calculation method": "Date of last patient letter",
211+
"latest episode recall episode type": "FOBT screening",
212+
"latest episode recall surveillance type": None,
213+
"latest episode status": "Closed",
214+
"latest episode status reason": "Episode Complete",
215+
"latest event status": "S159 GP Discharge Sent (Normal)",
216+
"lynch due date": None,
217+
"lynch due date date of change": None,
218+
"lynch due date reason": None,
219+
"screening status": "Recall",
220+
# Screening status date of change intentionally omitted
221+
"screening status reason": "Recall",
222+
"screening due date": "Calculated screening due date",
223+
"screening due date date of change": "Today",
224+
"screening due date reason": "Recall",
225+
"surveillance due date": None,
226+
"surveillance due date date of change": "Unchanged",
227+
"surveillance due date reason": "Unchanged",
228+
},
229+
)

0 commit comments

Comments
 (0)