55from utils .oracle .subject_creation_util import CreateSubjectSteps
66from utils .user_tools import UserTools
77from utils .subject_assertion import subject_assertion
8+ from utils .call_and_recall_utils import CallAndRecallUtils
9+ from utils import screening_subject_page_searcher
810from pages .base_page import BasePage
11+ from pages .screening_subject_search .subject_screening_summary_page import (
12+ SubjectScreeningSummaryPage ,
13+ )
14+
915
1016@pytest .mark .wip
1117@pytest .mark .fobt_regression_tests
@@ -31,6 +37,7 @@ def test_scenario_2(page: Page) -> None:
3137 > Process S158 letter batch > S159 (1.3) > C203 (1.13)
3238 > Check recall [SSCL4a]
3339 """
40+ summary_page = SubjectScreeningSummaryPage (page )
3441 logging .info ("[TEST START] Regression - fobt normal kit reading" )
3542
3643 # Given I log in to BCSS "England" as user role "Hub Manager"
@@ -53,7 +60,7 @@ def test_scenario_2(page: Page) -> None:
5360 pytest .fail ("Failed to create subject: NHS number not returned." )
5461
5562 # Then Comment: NHS number
56- logging .info (f"Created subject's NHS number: { nhs_no } " )
63+ logging .info (f"[SUBJECT CREATED] Created subject's NHS number: { nhs_no } " )
5764
5865 # And my subject has been updated as follows:
5966 # Subject age 66
@@ -67,10 +74,20 @@ def test_scenario_2(page: Page) -> None:
6774 "screening status" : "Inactive" ,
6875 },
6976 )
70- logging .info ("Updated subject details checked in the DB" )
77+ logging .info ("[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB" )
78+
79+ # Navigate to subject profile in UI
80+ screening_subject_page_searcher .search_subject_by_nhs_number (page , nhs_no )
81+ logging .info ("[SUBJECT VIEW] Subject loaded in UI" )
7182
83+ # Assert subject details in the UI
84+ summary_page .assert_subject_age (66 )
85+ summary_page .assert_screening_status ("Inactive" )
86+ logging .info ("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI" )
7287
7388 # When I run the FOBT failsafe trawl for my subject
89+ CallAndRecallUtils ().run_failsafe (nhs_no )
90+ logging .info ("[FAILSAFE TRAWL RUN]FOBT failsafe trawl run for subject" )
7491
7592 # Then my subject has been updated as follows:
7693 # Subject has episodes No
@@ -94,6 +111,15 @@ def test_scenario_2(page: Page) -> None:
94111 "Screening Status Reason" : "Failsafe Trawl" ,
95112 },
96113 )
114+ logging .info ("[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB" )
115+
116+ # Navigate to subject profile in UI
117+ screening_subject_page_searcher .search_subject_by_nhs_number (page , nhs_no )
118+ logging .info ("[SUBJECT VIEW] Subject loaded in UI" )
119+
120+ # Assert subject details in the UI
121+ summary_page .assert_screening_status ("Call" )
122+ logging .info ("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI" )
97123
98124 # When I invite my subject for FOBT screening
99125
@@ -110,6 +136,9 @@ def test_scenario_2(page: Page) -> None:
110136 },
111137 )
112138 # Then there is a "S1" letter batch for my subject with the exact title "Pre-invitation (FIT)"
139+ logging .info (
140+ "[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB & letter batch exists"
141+ )
113142
114143 # When I process the open "S1" letter batch for my subject
115144
@@ -121,6 +150,15 @@ def test_scenario_2(page: Page) -> None:
121150 "latest event status" : "S9 Pre-invitation Sent" ,
122151 },
123152 )
153+ logging .info ("[ASSERTIONS COMPLETE]Updated subject status checked in the DB" )
154+
155+ # Navigate to subject profile in UI
156+ screening_subject_page_searcher .search_subject_by_nhs_number (page , nhs_no )
157+ logging .info ("[SUBJECT VIEW] Subject loaded in UI" )
158+
159+ # Assert subject details in the UI
160+ summary_page .assert_latest_event_status ("S9 Pre-invitation Sent" )
161+ logging .info ("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI" )
124162
125163 # When I run Timed Events for my subject
126164 # Then there is a "S9" letter batch for my subject with the exact title "Invitation & Test Kit (FIT)"
@@ -145,6 +183,15 @@ def test_scenario_2(page: Page) -> None:
145183 "latest event status" : "S43 Kit Returned and Logged (Initial Test)" ,
146184 },
147185 )
186+ # Navigate to subject profile in UI
187+ screening_subject_page_searcher .search_subject_by_nhs_number (page , nhs_no )
188+ logging .info ("[SUBJECT VIEW] Subject loaded in UI" )
189+
190+ # Assert subject details in the UI
191+ summary_page .assert_latest_event_status (
192+ "S43 Kit Returned and Logged (Initial Test)"
193+ )
194+ logging .info ("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI" )
148195
149196 # When I read my subject's latest logged FIT kit as "NORMAL"
150197
@@ -156,6 +203,15 @@ def test_scenario_2(page: Page) -> None:
156203 "latest event status" : "S2 Normal" ,
157204 },
158205 )
206+ logging .info ("[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB" )
207+
208+ # Navigate to subject profile in UI
209+ screening_subject_page_searcher .search_subject_by_nhs_number (page , nhs_no )
210+ logging .info ("[SUBJECT VIEW] Subject loaded in UI" )
211+
212+ # Assert subject details in the UI
213+ summary_page .assert_latest_event_status ("S2 Normal" )
214+ logging .info ("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI" )
159215 # And there is a "S2" letter batch for my subject with the exact title "Subject Result (Normal)"
160216
161217 # When I process the open "S2" letter batch for my subject
@@ -168,6 +224,15 @@ def test_scenario_2(page: Page) -> None:
168224 "latest event status" : "S158 Subject Discharge Sent (Normal)" ,
169225 },
170226 )
227+ logging .info ("[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB" )
228+
229+ # Navigate to subject profile in UI
230+ screening_subject_page_searcher .search_subject_by_nhs_number (page , nhs_no )
231+ logging .info ("[SUBJECT VIEW] Subject loaded in UI" )
232+
233+ # Assert subject details in the UI
234+ summary_page .assert_latest_event_status ("S158 Subject Discharge Sent (Normal)" )
235+ logging .info ("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI" )
171236 # And there is a "S158" letter batch for my subject with the exact title "GP Result (Normal)"
172237
173238 # When I process the open "S158" letter batch for my subject
@@ -231,3 +296,12 @@ def test_scenario_2(page: Page) -> None:
231296 "surveillance due date reason" : "Unchanged" ,
232297 },
233298 )
299+ logging .info ("[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB" )
300+
301+ # Navigate to subject profile in UI
302+ screening_subject_page_searcher .search_subject_by_nhs_number (page , nhs_no )
303+ logging .info ("[SUBJECT VIEW] Subject loaded in UI" )
304+
305+ # Assert subject details in the UI
306+ summary_page .assert_latest_event_status ("S159 GP Discharge Sent (Normal)" )
307+ logging .info ("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI" )
0 commit comments