Skip to content

Commit 357b70f

Browse files
committed
Added steps 12 & 13 to Compartment 3 (will need to be refined when previous steps are finished)
1 parent 44dd07d commit 357b70f

File tree

1 file changed

+48
-26
lines changed

1 file changed

+48
-26
lines changed

tests/Smokescreen/test_compartment_3.py

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
from datetime import datetime
33

44
from my_pages import *
5-
from utils import oracle, fit_kit_logged
5+
from utils import fit_kit_logged
6+
from utils.batch_processing import batch_processing
67
from utils.fit_kit_generation import create_fit_id_df
78
from utils.fit_kit_logged import process_kit_data, update_kit_service_management_entity
89
from utils.oracle import OracleDB
910
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
1011

12+
1113
@pytest.mark.wip2
1214
def test_compartment_3(page: Page) -> None:
1315
UserTools.user_login(page, "Hub Manager State Registered")
1416

15-
# Add results to the test records in the KIT_QUEUE table (i.e. mimic receiving results from the middleware)
17+
# (STEP 1 & 2) Add results to the test records in the KIT_QUEUE table (i.e. mimic receiving results from the middleware)
1618
# and get device IDs and their flags
1719
device_ids = process_kit_data()
1820
# (STEP - 4) Run two stored procedures to process any kit queue records at status BCSS_READY
@@ -44,29 +46,49 @@ def test_compartment_3(page: Page) -> None:
4446
logging.error(f"Verification failed for NHS number {nhs_number} with status {expected_status}: {str(e)}")
4547
raise
4648

49+
# (STEP - 5) Check the results of the processed FIT kits have correctly updated the status of the associated subjects
50+
# Navigate to log devices page
51+
MainMenu(page).go_to_fit_test_kits_page()
52+
FITTestKits(page).go_to_log_devices_page()
53+
54+
# Get a fit device id
55+
subjectdf = create_fit_id_df()
56+
57+
# Log fit device
58+
for subject in range(4):
59+
fit_device_id = subjectdf["fit_device_id"].iloc[subject]
60+
LogDevices(page).fill_fit_device_id_field(fit_device_id)
61+
sample_date = datetime.now().strftime("%#d %b %Y")
62+
LogDevices(page).fill_sample_date_field(sample_date)
63+
LogDevices(page).verify_successfully_logged_device_text()
64+
65+
# Check statuses of 'normal' FIT kit subjects has moved to S2
66+
nhs_no = subjectdf["subject_nhs_number"].iloc[0]
67+
verify_subject_event_status_by_nhs_no(page, nhs_no, "S2 - Normal")
68+
69+
# Check status of 'abnormal' FIT kit subjects has moved to A8
70+
nhs_no = subjectdf["subject_nhs_number"].iloc[0]
71+
verify_subject_event_status_by_nhs_no(page, nhs_no, "A8 - Abnormal")
72+
73+
# (Step 12) - Process S2 batch
74+
# Run batch processing function on S2 batch
75+
batch_processing(page, "S2", "Normal", "S2 - Normal")
76+
nhs_number_df = batch_processing(page, "S2", "Normal", "S2 - Normal")
77+
for index, row in nhs_number_df.iterrows():
78+
OracleDB().exec_bcss_timed_events(row["subject_nhs_number"])
79+
80+
# Verify Status of subject is updated to S158
81+
nhs_no = subjectdf["subject_nhs_number"].iloc[0]
82+
verify_subject_event_status_by_nhs_no(page, nhs_no, "S158")
83+
84+
# (Step 13) - Process S158 batch
85+
# Run batch processing function on S158 batch
86+
batch_processing(page, "S158", "Normal result letter sent to subject", "S158 - Normal result letter sent to subject")
87+
nhs_number_df = batch_processing(page, "S158", "Normal result letter sent to subject", "S158 - Normal result letter sent to subject")
88+
for index, row in nhs_number_df.iterrows():
89+
OracleDB().exec_bcss_timed_events(row["subject_nhs_number"])
4790

91+
# Verify Status of subject is updated to S159
92+
nhs_no = subjectdf["subject_nhs_number"].iloc[0]
93+
verify_subject_event_status_by_nhs_no(page, nhs_no, "S159 - Normal result letter sent to GP")
4894

49-
#
50-
# # (STEP - 5) Check the results of the processed FIT kits have correctly updated the status of the associated subjects
51-
# # Navigate to log devices page
52-
# MainMenu(page).go_to_fit_test_kits_page()
53-
# FITTestKits(page).go_to_log_devices_page()
54-
#
55-
# # Get a fit device id
56-
# subjectdf = create_fit_id_df()
57-
#
58-
# # Log fit device
59-
# for subject in range(4):
60-
# fit_device_id = subjectdf["fit_device_id"].iloc[subject]
61-
# LogDevices(page).fill_fit_device_id_field(fit_device_id)
62-
# sample_date = datetime.now().strftime("%#d %b %Y")
63-
# LogDevices(page).fill_sample_date_field(sample_date)
64-
# LogDevices(page).verify_successfully_logged_device_text()
65-
#
66-
# # Check statuses of 'normal' FIT kit subjects has moved to S2
67-
# nhs_no = subjectdf["subject_nhs_number"].iloc[0]
68-
# verify_subject_event_status_by_nhs_no(page, nhs_no, "S2 - Normal")
69-
#
70-
# # Check status of 'abnormal' FIT kit subjects has moved to A8
71-
# nhs_no = subjectdf["subject_nhs_number"].iloc[0]
72-
# verify_subject_event_status_by_nhs_no(page, nhs_no, "A8 - Abnormal")

0 commit comments

Comments
 (0)