Skip to content

Commit 23ba447

Browse files
authored
Feature/bcss 21322 fobtregressiontests scenario 19 (#153)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description Adding scenario 19 from FOBTRegressionTests feature file ## Context Adding scenario 19 from FOBTRegressionTests feature file ## 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 5a7af62 commit 23ba447

File tree

3 files changed

+91
-2
lines changed

3 files changed

+91
-2
lines changed

classes/screening/has_gp_practice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def by_description(cls, description: str):
3333
Optional[HasGPPractice]: The matching enum member, or None if not found.
3434
"""
3535
for member in cls:
36-
if member.value == description:
36+
if member.value.lower() == description:
3737
return member
3838
return None
3939

tests/regression/regression_tests/fobt_regression_tests/test_scenario_17.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
from pages.organisations.organisations_page import OrganisationSwitchPage
8181

8282

83-
@pytest.mark.wip
8483
@pytest.mark.usefixtures("setup_org_and_appointments")
8584
@pytest.mark.vpn_required
8685
@pytest.mark.regression
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
from datetime import datetime
2+
import pytest
3+
import logging
4+
from playwright.sync_api import Page
5+
from classes.subject.subject import Subject
6+
from classes.user.user import User
7+
from pages.logout.log_out_page import LogoutPage
8+
from utils.fit_kit import FitKitGeneration, FitKitLogged
9+
from utils.oracle.subject_selection_query_builder import SubjectSelectionQueryBuilder
10+
from utils.subject_assertion import subject_assertion
11+
from utils.user_tools import UserTools
12+
from utils.oracle.oracle import OracleDB
13+
14+
15+
@pytest.mark.vpn_required
16+
@pytest.mark.regression
17+
@pytest.mark.fobt_regression_tests
18+
def test_scenario_19(page: Page) -> None:
19+
"""
20+
Scenario: 19: Late response receive a kit
21+
22+
This scenario tests that a new "late response" episode will be created for a subject who returns a kit following a non-response episode that started more than 6 months ago - provided they are registered with an active GP practice.
23+
24+
"""
25+
# Given I log in to BCSS "England" as user role "Hub Manager"
26+
user_role = UserTools.user_login(
27+
page, "Hub Manager at BCS01", return_role_type=True
28+
)
29+
if user_role is None:
30+
raise ValueError("This user cannot be assigned to a UserRoleType")
31+
32+
# And there is a subject who meets the following criteria:
33+
criteria = {
34+
"latest event status": "S44 GP Discharge for Non-response Sent (Initial Test)",
35+
"latest episode kit class": "FIT",
36+
"latest episode started": "More than 6 months ago",
37+
"latest episode status": "Closed",
38+
"latest episode type": "FOBT",
39+
"latest episode sub-type": "Routine",
40+
"has gp practice": "Yes - active",
41+
"subject has unprocessed sspi updates": "No",
42+
"subject has user dob updates": "No",
43+
"subject age": "Between 60 and 72",
44+
"subject has unlogged kits": "Yes",
45+
"subject hub code": "User's hub",
46+
}
47+
48+
user = User().from_user_role_type(user_role)
49+
50+
query, bind_vars = SubjectSelectionQueryBuilder().build_subject_selection_query(
51+
criteria=criteria,
52+
user=user,
53+
subject=Subject(),
54+
subjects_to_retrieve=1,
55+
)
56+
57+
nhs_no_df = OracleDB().execute_query(query=query, parameters=bind_vars)
58+
nhs_no = nhs_no_df["subject_nhs_number"].iloc[0]
59+
60+
# Then Comment: NHS number
61+
logging.info(f"[SUBJECT RETRIEVAL] Retrieved subject's NHS number: {nhs_no}")
62+
63+
# When I log my subject's latest unlogged FIT kit
64+
fit_kit = FitKitGeneration().get_fit_kit_for_subject_sql(nhs_no, False, False)
65+
FitKitLogged().log_fit_kits(
66+
page=page,
67+
sample_date=datetime.now(),
68+
fit_kit=fit_kit,
69+
)
70+
71+
# Then my subject has been updated as follows:
72+
criteria = {
73+
"latest episode includes event code": "E59 Initiate Opt-in/Self-referral",
74+
"latest episode started": "Today",
75+
"latest episode status": "Open",
76+
"latest episode type": "FOBT",
77+
"latest episode sub-type": "Late Responder",
78+
"latest episode includes event status": "S195 Receipt of Self-referral kit",
79+
"latest event status": "S43 Kit Returned and Logged (Initial Test)",
80+
"screening due date": "Today",
81+
"screening due date date of change": "Today",
82+
"screening due date reason": "Late Response",
83+
"screening status": "Self-referral",
84+
"screening status date of change": "Today",
85+
"screening status reason": "Late Response",
86+
}
87+
subject_assertion(nhs_no, criteria)
88+
89+
# Finally I log out of BCSS
90+
LogoutPage(page).log_out()

0 commit comments

Comments
 (0)