Skip to content

Commit a453f22

Browse files
Feature/bcss 22018 surveillanceregressiontests scenario 6 (#159)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> Migrating scenario 6 of SurveillanceRegressionTests from selenium to playwright. ## Context <!-- Why is this change required? What problem does it solve? --> Migrating scenario 6 of SurveillanceRegressionTests from selenium to playwright. ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [x] Refactoring (non-breaking change) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I am familiar with the [contributing guidelines](https://github.com/nhs-england-tools/playwright-python-blueprint/blob/main/CONTRIBUTING.md) - [x] I have followed the code style of the project - [x] I have added tests to cover my changes (where appropriate) - [x] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.
1 parent 845a1b4 commit a453f22

File tree

3 files changed

+245
-1
lines changed

3 files changed

+245
-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"
@@ -60,6 +66,14 @@ def click_discharge_from_screening_and_surveillance_patient_choice_button(
6066
"""Click on the 'Discharge from Screening and Surveillance - Patient Choice' button."""
6167
self.click(self.discharge_from_screening_and_surveillance_patient_choice_button)
6268

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

0 commit comments

Comments
 (0)