Skip to content

Commit 7cceee5

Browse files
committed
wip
1 parent 9e95654 commit 7cceee5

File tree

1 file changed

+68
-5
lines changed

1 file changed

+68
-5
lines changed

tests/regression/subject/manual_cease/test_manual_ui_unceasing_checks_existing_kit_present.py

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,51 @@
1-
# @BCSSAdditionalTests
2-
# Feature: Manual UI Unceasing Checks - Existing Kit Present
3-
4-
# A manually ceased subject with unlogged kits can be unceased as part of the late response "log an existing kit" process.
5-
1+
import pytest
2+
from playwright.sync_api import Page
3+
from utils.user_tools import UserTools
4+
from classes.user import User
5+
from classes.subject import Subject
6+
from pages.base_page import BasePage
7+
from pages.screening_subject_search.subject_demographic_page import (
8+
SubjectDemographicPage,
9+
)
10+
from pages.logout.log_out_page import LogoutPage
11+
from utils.screening_subject_page_searcher import (
12+
search_subject_demographics_by_nhs_number,
13+
)
14+
from utils.oracle.oracle import OracleDB
15+
from utils.oracle.oracle_specific_functions import (
16+
check_if_subject_has_temporary_address,
17+
)
18+
from utils.oracle.subject_selection_query_builder import SubjectSelectionQueryBuilder
19+
import logging
20+
from faker import Faker
21+
from datetime import datetime, timedelta
622

723
# Further Reading
824
# --------
925
# The references used within this feature are outlined in detail in the following directory:
1026
# Q:\DEV\Services\BCSS\System Specification\Screening Subject
1127
# The spreadsheet itself is called: Screening Subject Data Items (Use the latest version)
1228

29+
# @BCSSAdditionalTests
30+
# Feature: Manual UI Unceasing Checks - Existing Kit Present
31+
32+
# A manually ceased subject with unlogged kits can be unceased as part of the late response "log an existing kit" process.
33+
1334
# Background: I log in as a hub manager for BCSS England for all tests
1435
# Given I log in to BCSS "England" as user role "Hub Manager"
36+
@pytest.fixture(scope="function", autouse=True)
37+
def before_each(page: Page) -> str:
38+
"""
39+
Before every test is executed, this fixture:
40+
- Logs into BCSS as a Screening Centre Manager at BCS001
41+
- Navigates to the screening subject search page
42+
"""
43+
nhs_no = obtain_test_data_nhs_no()
44+
logging.info(f"Selected NHS Number: {nhs_no}")
45+
UserTools.user_login(page, "Screening Centre Manager at BCS001")
46+
BasePage(page).go_to_screening_subject_search_page()
47+
search_subject_demographics_by_nhs_number(page, nhs_no)
48+
return nhs_no
1549

1650

1751
# Scenario: Subject is within eligible age range, is next due to be screened in the past and has an outstanding kit > SSUN9.8 Opt-in log a kit
@@ -157,3 +191,32 @@
157191
# | 55 |
158192
# | 53 |
159193
# | 51 |
194+
195+
196+
def obtain_test_data_nhs_no() -> str:
197+
"""
198+
Obtain a test subject's NHS number that matches the following criteria:
199+
| Subject age | <= 80 |
200+
| Subject has temporary address | No |
201+
202+
This is obtained using the Subject Selection Query Builder.
203+
204+
Returns:
205+
str: The NHS number of the subject that matches the criteria.
206+
"""
207+
criteria = {
208+
"subject age": "<= 80",
209+
"subject has temporary address": "no",
210+
}
211+
user = User()
212+
subject = Subject()
213+
214+
builder = SubjectSelectionQueryBuilder()
215+
216+
query, bind_vars = builder.build_subject_selection_query(
217+
criteria=criteria, user=user, subject=subject, subjects_to_retrieve=1
218+
)
219+
220+
df = OracleDB().execute_query(query, bind_vars)
221+
nhs_no = df.iloc[0]["subject_nhs_number"]
222+
return nhs_no

0 commit comments

Comments
 (0)