Skip to content

Commit ca96b2b

Browse files
Completing scenario 6
1 parent 0ea0fd9 commit ca96b2b

File tree

3 files changed

+246
-1
lines changed

3 files changed

+246
-1
lines changed

pages/screening_subject_search/advance_surveillance_episode_page.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ def __init__(self, page: Page):
2727
name="Discharge from Screening and Surveillance - Patient Choice",
2828
)
2929
)
30+
self.discharge_from_screening_and_surveillance_no_patient_contact_button = (
31+
self.page.get_by_role(
32+
"button",
33+
name="Discharge from Screening and Surveillance - No Patient Contact",
34+
)
35+
)
3036

3137
self.book_surveillance_appointment_button = self.page.get_by_role(
3238
"button", name="Book Surveillance Appointment"
@@ -54,6 +60,14 @@ def click_discharge_from_screening_and_surveillance_patient_choice_button(
5460
"""Click on the 'Discharge from Screening and Surveillance - Patient Choice' button."""
5561
self.click(self.discharge_from_screening_and_surveillance_patient_choice_button)
5662

63+
def click_discharge_from_screening_and_surveillance_no_patient_contact_button(
64+
self,
65+
) -> None:
66+
"""Click on the 'Discharge from Screening and Surveillance - No Patient Contact' button."""
67+
self.click(
68+
self.discharge_from_screening_and_surveillance_no_patient_contact_button
69+
)
70+
5771
def click_book_surveillance_appointment_button(self) -> None:
5872
"""Click on the 'Book Surveillance Appointment' button."""
5973
self.safe_accept_dialog(self.book_surveillance_appointment_button)

tests/regression/regression_tests/surveillance_regression_tests/test_surveillance_scenario_1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
@pytest.mark.vpn_required
5454
@pytest.mark.regression
55-
@pytest.mark.survelliance_regression_tests
55+
@pytest.mark.surveillance_regression_tests
5656
def test_scenario_1(page: Page, general_properties: dict) -> None:
5757
"""
5858
Scenario: 1: Discharge for clinical decision (GP letter required)
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
import logging
2+
import pytest
3+
from playwright.sync_api import Page
4+
from pages.logout.log_out_page import LogoutPage
5+
from pages.screening_subject_search.advance_surveillance_episode_page import (
6+
AdvanceSurveillanceEpisodePage,
7+
)
8+
from pages.screening_subject_search.discharge_from_surveillance_page import (
9+
DischargeFromSurveillancePage,
10+
)
11+
from pages.screening_subject_search.subject_screening_summary_page import (
12+
SubjectScreeningSummaryPage,
13+
)
14+
from utils import screening_subject_page_searcher
15+
from utils.batch_processing import batch_processing
16+
from utils.generate_health_check_forms_util import GenerateHealthCheckFormsUtil
17+
from utils.oracle.oracle import OracleDB
18+
from utils.sspi_change_steps import SSPIChangeSteps
19+
from utils.subject_assertion import subject_assertion
20+
from utils.user_tools import UserTools
21+
22+
23+
@pytest.mark.wip
24+
@pytest.mark.vpn_required
25+
@pytest.mark.regression
26+
@pytest.mark.surveillance_regression_tests
27+
def test_scenario_4(page: Page, general_properties: dict) -> None:
28+
"""
29+
Scenario: 6: Discharge over-age patient for no contact
30+
31+
X500-X505-X510-X501-X381-X87-X77-C203 [SSCL25a]
32+
33+
This simple scenario takes a Surveillance episode from invitation through to closure on non-response. This gives an episode result of Surveillance non-participation (although which "flavour" is impossible to check as that depends on previous episode results).
34+
35+
Scenario summary:
36+
37+
> Run surveillance invitations for 1 subject > X500 (3.1)
38+
> SSPI update changes subject to over-age at recall
39+
> Process X500 letter batch > X505 (3.1)
40+
> Run timed events > creates X505 letter (3.1)
41+
> Process X505 letter batch > X510 (3.1)
42+
> Run timed events > X501 (3.1)
43+
> Record discharge from surveillance, no contact > X381 (3.4)
44+
> Process X381 letter batch > X87 (3.4)
45+
> Process X87 letter batch > X77 > C203 (3.4)
46+
> Check recall [SSCL25a]
47+
"""
48+
# Given I log in to BCSS "England" as user role "Screening Centre Manager"
49+
user_role = UserTools.user_login(
50+
page, "Screening Centre Manager at BCS001", return_role_type=True
51+
)
52+
if user_role is None:
53+
raise ValueError("User cannot be assigned to a UserRoleType")
54+
55+
# When I run surveillance invitations for 1 subject
56+
org_id = general_properties["eng_screening_centre_id"]
57+
nhs_no = GenerateHealthCheckFormsUtil(page).invite_surveillance_subjects_early(
58+
org_id
59+
)
60+
logging.info(f"[SUBJECT RETRIEVAL] Subject's NHS Number: {nhs_no}")
61+
62+
# Then my subject has been updated as follows:
63+
subject_assertion(
64+
nhs_no,
65+
{
66+
"latest episode status": "Open",
67+
"latest episode type": "Surveillance",
68+
"latest event status": "X500 Selected For Surveillance",
69+
"responsible screening centre code": "User's screening centre",
70+
"subject has unprocessed SSPI updates": "No",
71+
"subject has user DOB updates": "No",
72+
},
73+
user_role,
74+
)
75+
76+
# And I receive an SSPI update to change their date of birth to "75" years old
77+
SSPIChangeSteps().sspi_update_to_change_dob_received(nhs_no, 75)
78+
79+
# When I view the subject
80+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
81+
82+
# Then I "can" postpone the subject's surveillance episode
83+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode()
84+
85+
# And there is a "X500" letter batch for my subject with the exact title "Surveillance Selection"
86+
# When I process the open "X500" letter batch for my subject
87+
batch_processing(
88+
page,
89+
"X500",
90+
"Surveillance Selection",
91+
)
92+
93+
# Then my subject has been updated as follows:
94+
subject_assertion(nhs_no, {"latest event status": "X505 HealthCheck Form Printed"})
95+
96+
# When I view the subject
97+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
98+
99+
# Then I "can" postpone the subject's surveillance episode
100+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode()
101+
102+
# When I run Timed Events for my subject
103+
OracleDB().exec_bcss_timed_events(nhs_number=nhs_no)
104+
105+
# When I view the subject
106+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
107+
108+
# Then I "can" postpone the subject's surveillance episode
109+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode()
110+
111+
# Then there is a "X505" letter batch for my subject with the exact title "Surveillance Selection Reminder"
112+
# When I process the open "X505" letter batch for my subject
113+
batch_processing(
114+
page,
115+
"X505",
116+
"Surveillance Selection Reminder",
117+
)
118+
119+
# Then my subject has been updated as follows:
120+
subject_assertion(
121+
nhs_no, {"latest event status": "X510 Surveillance Reminder Printed"}
122+
)
123+
124+
# When I view the subject
125+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
126+
127+
# Then I "can" postpone the subject's surveillance episode
128+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode()
129+
130+
# When I run Timed Events for my subject
131+
OracleDB().exec_bcss_timed_events(nhs_number=nhs_no)
132+
133+
# Then my subject has been updated as follows:
134+
subject_assertion(
135+
nhs_no, {"latest event status": "X501 No Response to HealthCheck Form"}
136+
)
137+
138+
# When I view the subject
139+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
140+
141+
# Then I "can" postpone the subject's surveillance episode
142+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode()
143+
144+
# And I select the advance episode option for "Discharge from Screening and Surveillance - No Patient Contact"
145+
SubjectScreeningSummaryPage(page).click_advance_surveillance_episode_button()
146+
AdvanceSurveillanceEpisodePage(
147+
page
148+
).click_discharge_from_screening_and_surveillance_no_patient_contact_button()
149+
150+
# And I complete the Discharge from Surveillance form
151+
DischargeFromSurveillancePage(page).complete_discharge_from_surveillance_form(False)
152+
153+
# Then my subject has been updated as follows:
154+
subject_assertion(
155+
nhs_no,
156+
{
157+
"latest event status": "X381 Discharge from Screening and Surveillance - No Patient Contact"
158+
},
159+
)
160+
161+
# When I view the subject
162+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
163+
164+
# Then I "cannot" postpone the subject's surveillance episode
165+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode(False)
166+
167+
# And there is a "X381" letter batch for my subject with the exact title "Discharge from surveillance (no contact) & screening (age) - letter to patient"
168+
# When I process the open "X381" letter batch for my subject
169+
batch_processing(
170+
page,
171+
"X381",
172+
"Discharge from surveillance (no contact) & screening (age) - letter to patient",
173+
)
174+
175+
# Then my subject has been updated as follows:
176+
subject_assertion(
177+
nhs_no,
178+
{
179+
"latest event status": "X87 Discharged from Surveillance & Screening - Patient Letter Printed"
180+
},
181+
)
182+
183+
# When I view the subject
184+
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
185+
186+
# Then I "cannot" postpone the subject's surveillance episode
187+
SubjectScreeningSummaryPage(page).can_postpone_surveillance_episode(False)
188+
189+
# And there is a "X87" letter batch for my subject with the exact title "Discharge from surveillance (no contact) & screening (age) - letter to GP"
190+
# When I process the open "X87" letter batch for my subject
191+
batch_processing(
192+
page,
193+
"X87",
194+
"Discharge from surveillance (no contact) & screening (age) - letter to GP",
195+
)
196+
197+
# Then my subject has been updated as follows:
198+
subject_assertion(
199+
nhs_no,
200+
{
201+
"calculated fobt due date": "2 years from episode end",
202+
"calculated lynch due date": "Null",
203+
"calculated surveillance due date": "Null",
204+
"ceased confirmation date": "Today",
205+
"ceased confirmation details": "Notes for subject being discharged",
206+
"ceased confirmation user id": "User's ID",
207+
"clinical reason for cease": "Null",
208+
"latest episode accumulated result": "(Any) Surveillance non-participation",
209+
"latest episode recall calculation method": "Episode end date",
210+
"latest episode recall episode type": "FOBT Screening",
211+
"latest episode recall surveillance type": "Null",
212+
"latest episode status": "Closed",
213+
"latest episode status reason": "Discharge from Surveillance - Age",
214+
"latest event status": "X77 Discharged from Surveillance & Screening - GP Letter Printed",
215+
"lynch due date": "Null",
216+
"lynch due date date of change": "Unchanged",
217+
"lynch due date reason": "Unchanged",
218+
"screening due date": "Null",
219+
"screening due date date of change": "Unchanged",
220+
"screening due date reason": "Unchanged",
221+
"screening status": "Ceased",
222+
"screening status date of change": "Today",
223+
"screening status reason": "Outside Screening Population",
224+
"surveillance due date": "Null",
225+
"surveillance due date date of change": "Today",
226+
"surveillance due date reason": "Discharge from Surveillance - Age",
227+
},
228+
user_role,
229+
)
230+
231+
LogoutPage(page).log_out()

0 commit comments

Comments
 (0)