Skip to content

Commit 5522696

Browse files
committed
wip
1 parent b40014e commit 5522696

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

tests/regression/regression_tests/fobt_regression_tests/test_scenario_2.py

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33
import datetime
44
from playwright.sync_api import Page
5+
from pages.communication_production.batch_list_page import ActiveBatchListPage
56
from utils.oracle.subject_creation_util import CreateSubjectSteps
67
from utils.user_tools import UserTools
78
from utils.subject_assertion import subject_assertion
@@ -12,6 +13,9 @@
1213
from pages.screening_subject_search.subject_screening_summary_page import (
1314
SubjectScreeningSummaryPage,
1415
)
16+
from pages.communication_production.communications_production_page import (
17+
CommunicationsProductionPage,
18+
)
1519

1620

1721
# Helper function to navigate to subject profile
@@ -29,6 +33,18 @@ def navigate_to_subject_profile(page, nhs_no: str) -> None:
2933
logging.info("[SUBJECT VIEW] Subject loaded in UI")
3034

3135

36+
def navigate_to_active_batch_list(page: Page) -> None:
37+
"""
38+
Navigates to the active batch list page in the UI.
39+
40+
Args:
41+
page (Page): The Playwright page object.
42+
"""
43+
BasePage(page).click_main_menu_link()
44+
BasePage(page).go_to_communications_production_page()
45+
CommunicationsProductionPage(page).go_to_active_batch_list_page()
46+
47+
3248
@pytest.mark.wip
3349
@pytest.mark.fobt_regression_tests
3450
def test_scenario_2(page: Page) -> None:
@@ -40,7 +56,6 @@ def test_scenario_2(page: Page) -> None:
4056
This scenario tests the basic scenario where a subject returns their initial test kit which gives a normal result.
4157
4258
Scenario summary:
43-
4459
> Create a new subject in the FOBT age range > Inactive
4560
> Run the FOBT failsafe trawl > Call
4661
> Run the database transition to invite them for FOBT screening > S1(1.1)
@@ -101,7 +116,7 @@ def test_scenario_2(page: Page) -> None:
101116

102117
# When I run the FOBT failsafe trawl for my subject
103118
CallAndRecallUtils().run_failsafe(nhs_no)
104-
logging.info("[FAILSAFE TRAWL RUN]FOBT failsafe trawl run for subject")
119+
logging.info(f"[FAILSAFE TRAWL RUN]FOBT failsafe trawl run for subject {nhs_no}")
105120

106121
# Then my subject has been updated as follows:
107122
today = datetime.datetime.now().strftime("%d/%m/%Y")
@@ -139,14 +154,12 @@ def test_scenario_2(page: Page) -> None:
139154
"latest episode type": "FOBT",
140155
},
141156
)
142-
logging.info(
143-
"[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB"
144-
)
157+
logging.info("[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB")
158+
145159
# Then there is a "S1" letter batch for my subject with the exact title "Pre-invitation (FIT)"
146-
LetterBatchUtils().assert_letter_batch_exists(nhs_no, "S1", "Pre-invitation (FIT)")
147-
logging.info(
148-
"[ASSERTIONS COMPLETE]S1 Letter batch exists"
149-
)
160+
navigate_to_active_batch_list(page)
161+
ActiveBatchListPage(page).is_batch_present("S1 - Pre-invitation (FIT)")
162+
logging.info("[ASSERTIONS COMPLETE]S1 Letter batch exists")
150163

151164
# When I process the open "S1" letter batch for my subject
152165
# Then my subject has been updated as follows:
@@ -162,10 +175,15 @@ def test_scenario_2(page: Page) -> None:
162175
summary_page.assert_latest_event_status("S9 Pre-invitation Sent")
163176
logging.info("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI")
164177

165-
# When I run Timed Events for my subject
178+
# TODO: When I run Timed Events for my subject
179+
166180
# Then there is a "S9" letter batch for my subject with the exact title "Invitation & Test Kit (FIT)"
181+
navigate_to_active_batch_list(page)
182+
ActiveBatchListPage(page).is_batch_present("S9 - Invitation & Test Kit (FIT)")
183+
logging.info("[ASSERTIONS COMPLETE]S9 Letter batch exists")
184+
185+
# TODO: When I process the open "S9" letter batch for my subject
167186

168-
# When I process the open "S9" letter batch for my subject
169187
# Then my subject has been updated as follows:
170188
batch_processing(
171189
page,
@@ -176,7 +194,7 @@ def test_scenario_2(page: Page) -> None:
176194
)
177195
logging.info("[DB ASSERTIONS COMPLETE]Updated subject status checked in the DB")
178196

179-
# When I log my subject's latest unlogged FIT kit
197+
# TODO: When I log my subject's latest unlogged FIT kit
180198

181199
# Then my subject has been updated as follows:
182200
subject_assertion(
@@ -185,6 +203,8 @@ def test_scenario_2(page: Page) -> None:
185203
"latest event status": "S43 Kit Returned and Logged (Initial Test)",
186204
},
187205
)
206+
logging.info("[DB ASSERTIONS COMPLETE]Updated subject status checked in the DB")
207+
188208
# Navigate to subject profile in UI
189209
navigate_to_subject_profile(page, nhs_no)
190210

@@ -194,7 +214,7 @@ def test_scenario_2(page: Page) -> None:
194214
)
195215
logging.info("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI")
196216

197-
# When I read my subject's latest logged FIT kit as "NORMAL"
217+
# TODO: When I read my subject's latest logged FIT kit as "NORMAL"
198218

199219
# Then my subject has been updated as follows:
200220
subject_assertion(
@@ -203,37 +223,47 @@ def test_scenario_2(page: Page) -> None:
203223
"latest event status": "S2 Normal",
204224
},
205225
)
206-
logging.info("[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB")
226+
logging.info("[DB ASSERTIONS COMPLETE]Updated subject status checked in the DB")
207227

208228
# Navigate to subject profile in UI
209229
navigate_to_subject_profile(page, nhs_no)
210230

211231
# Assert subject details in the UI
212232
summary_page.assert_latest_event_status("S2 Normal")
213233
logging.info("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI")
214-
# And there is a "S2" letter batch for my subject with the exact title "Subject Result (Normal)"
215234

216-
# When I process the open "S2" letter batch for my subject
235+
# And there is a "S2" letter batch for my subject with the exact title "Subject Result (Normal)"
236+
navigate_to_active_batch_list(page)
237+
ActiveBatchListPage(page).is_batch_present("S2 - Subject Result (Normal)")
238+
logging.info("[ASSERTIONS COMPLETE]S2 Letter batch exists")
217239

240+
# TODO: When I process the open "S2" letter batch for my subject
218241
# Then my subject has been updated as follows:
219-
# Latest event status S158 Subject Discharge Sent (Normal)
220-
subject_assertion(
221-
nhs_no,
222-
{
223-
"latest event status": "S158 Subject Discharge Sent (Normal)",
224-
},
242+
batch_processing(
243+
page,
244+
"S2",
245+
"Subject Result (Normal)",
246+
"S158 Subject Discharge Sent (Normal)",
247+
True,
225248
)
226-
logging.info("[DB ASSERTIONS COMPLETE]Updated subject details checked in the DB")
249+
logging.info("[DB ASSERTIONS COMPLETE]Updated subject status checked in the DB")
227250

228251
# Navigate to subject profile in UI
229252
navigate_to_subject_profile(page, nhs_no)
230253

231254
# Assert subject details in the UI
232255
summary_page.assert_latest_event_status("S158 Subject Discharge Sent (Normal)")
233256
logging.info("[UI ASSERTIONS COMPLETE]Updated subject details checked in the UI")
234-
# And there is a "S158" letter batch for my subject with the exact title "GP Result (Normal)"
257+
# TODO: And there is a "S158" letter batch for my subject with the exact title "GP Result (Normal)"
235258

236259
# When I process the open "S158" letter batch for my subject
260+
batch_processing(
261+
page,
262+
"S158",
263+
"GP Result (Normal)",
264+
"S159 GP Discharge Sent (Normal)",
265+
True,
266+
)
237267

238268
# Then my subject has been updated as follows:
239269
subject_assertion(
@@ -252,7 +282,6 @@ def test_scenario_2(page: Page) -> None:
252282
"latest episode recall surveillance type": "Null",
253283
"latest episode status": "Closed",
254284
"latest episode status reason": "Episode Complete",
255-
"latest event status": "S159 GP Discharge Sent (Normal)",
256285
"lynch due date": "Null",
257286
"lynch due date date of change": "Null",
258287
"lynch due date reason": "Null",

0 commit comments

Comments
 (0)