Skip to content

Commit 0ecd971

Browse files
committed
added CloseFobtScreeningEpisodePage POM
1 parent e0b8154 commit 0ecd971

File tree

3 files changed

+82
-56
lines changed

3 files changed

+82
-56
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from pages.base_page import BasePage
2+
from playwright.sync_api import Page
3+
4+
5+
class CloseFobtScreeningEpisodePage(BasePage):
6+
"""Close FOBT Screening Episode Page locators, and methods for interacting with the page."""
7+
8+
def __init__(self, page: Page):
9+
super().__init__(page)
10+
self.page = page
11+
self.close_fobt_screening_episode_button = self.page.get_by_role(
12+
"button", name="Close FOBT Screening Episode"
13+
)
14+
self.reason_dropdown = self.page.locator("#CLOSE_REASON")
15+
self.notes_textarea = self.page.locator("#UI_NOTES_TEXT")
16+
self.final_close_button = self.page.locator("#UI_BUTTON_CLOSE")
17+
18+
def close_fobt_screening_episode(self, reason_text: str) -> None:
19+
"""
20+
Complete the process of closing a FOBT screening episode.
21+
Args:
22+
reason_text (str): The visible text of the reason to select from the dropdown.
23+
"""
24+
# Step 1: Trigger the dialog and accept it
25+
self.safe_accept_dialog(self.close_fobt_screening_episode_button)
26+
27+
# Step 2: Select reason from dropdown
28+
self.reason_dropdown.select_option(label=reason_text)
29+
30+
# Step 3: Enter note
31+
self.notes_textarea.fill("automation test note")
32+
33+
# Step 4: Click final 'Close Episode' button
34+
self.safe_accept_dialog(self.final_close_button)

pages/screening_subject_search/subject_screening_summary_page.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, page: Page):
4444
self.update_subject_data = self.page.get_by_role(
4545
"button", name="Update Subject Data"
4646
)
47-
self.close_fobt_screening_episode = self.page.get_by_role(
47+
self.close_fobt_screening_episode_button = self.page.get_by_role(
4848
"button", name="Close FOBT Screening Episode"
4949
)
5050
self.a_page_to_advance_the_episode = self.page.get_by_text(
@@ -189,7 +189,7 @@ def click_update_subject_data(self) -> None:
189189

190190
def click_close_fobt_screening_episode(self) -> None:
191191
"""Click on the 'Close FOBT Screening Episode' button."""
192-
self.click(self.close_fobt_screening_episode)
192+
self.click(self.close_fobt_screening_episode_button)
193193

194194
def go_to_a_page_to_advance_the_episode(self) -> None:
195195
"""Click on the link to go to a page to advance the episode."""
@@ -381,7 +381,9 @@ def assert_screening_status(self, expected_status: str) -> None:
381381
assert (
382382
actual_status.lower() == expected_status.lower()
383383
), f"[SCREENING STATUS MISMATCH] Expected '{expected_status}', but found '{actual_status}' in UI."
384-
logging.info("[UI ASSERTIONS COMPLETE] Subject screening status checked in the UI")
384+
logging.info(
385+
"[UI ASSERTIONS COMPLETE] Subject screening status checked in the UI"
386+
)
385387

386388
def assert_latest_event_status(self, expected_status: str) -> None:
387389
"""
@@ -397,7 +399,9 @@ def assert_latest_event_status(self, expected_status: str) -> None:
397399
assert (
398400
actual_status == expected_status
399401
), f"[LATEST EVENT STATUS MISMATCH] Expected '{expected_status}', but found '{actual_status}' in UI."
400-
logging.info("[UI ASSERTIONS COMPLETE] Subject latest event status checked in the UI")
402+
logging.info(
403+
"[UI ASSERTIONS COMPLETE] Subject latest event status checked in the UI"
404+
)
401405

402406
def click_reopen_fobt_screening_episode_button(self) -> None:
403407
"""Click on the 'Reopen FOBT Screening Episode' button"""

tests/regression/regression_tests/fobt_regression_tests/test_scenario_4.py

Lines changed: 40 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
)
1717
from pages.communication_production.batch_list_page import BatchListPage
1818
from pages.logout.log_out_page import LogoutPage
19+
from pages.screening_subject_search.close_fobt_screening_episode_page import (
20+
CloseFobtScreeningEpisodePage,
21+
)
1922

2023

2124
@pytest.mark.wip
@@ -131,22 +134,14 @@ def test_scenario_4(page: Page) -> None:
131134
)
132135

133136
# Then there is a "S1" letter batch for my subject with the exact title "Pre-invitation (FIT)"
134-
batch_processing(
135-
page,
136-
"S1",
137-
"Pre-invitation (FIT)",
138-
"S9 - Pre-invitation Sent",
139-
True,
140-
)
141-
142137
# When I process the open "S1" letter batch for my subject
143138
# Then my subject has been updated as follows:
144139
batch_processing(
145140
page,
146141
"S1",
147142
"Pre-invitation (FIT)",
148143
"S9 - Pre-invitation Sent",
149-
False,
144+
True,
150145
)
151146

152147
# When I view the subject
@@ -157,22 +152,14 @@ def test_scenario_4(page: Page) -> None:
157152

158153
# When I run Timed Events for my subject
159154
# Then there is a "S9" letter batch for my subject with the exact title "Invitation & Test Kit (FIT)"
160-
batch_processing(
161-
page,
162-
"S9",
163-
"Invitation & Test Kit (FIT)",
164-
"S10 - Invitation & Test Kit Sent",
165-
True,
166-
)
167-
168155
# When I process the open "S9" letter batch for my subject
169156
# # Then my subject has been updated as follows:
170157
batch_processing(
171158
page,
172159
"S9",
173160
"Invitation & Test Kit (FIT)",
174161
"S10 - Invitation & Test Kit Sent",
175-
False,
162+
True,
176163
)
177164

178165
# When I log my subject's latest unlogged FIT kit
@@ -202,42 +189,43 @@ def test_scenario_4(page: Page) -> None:
202189
# When I view the subject
203190
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
204191

192+
# And I close the subject's episode for "Opt out of current episode"
193+
CloseFobtScreeningEpisodePage(page).close_fobt_screening_episode(
194+
"Opt out of current episode"
195+
)
205196

206-
# # And I close the subject's episode for "Opt out of current episode"
207-
# CallAndRecallUtils().close_episode(nhs_no, reason="Opt out of current episode")
208-
197+
# Then my subject has been updated as follows:
198+
subject_assertion(
199+
nhs_no,
200+
{
201+
"calculated FOBT due date": "2 years from episode end",
202+
"calculated lynch due date": "Null",
203+
"calculated surveillance due date": "Null",
204+
"ceased confirmation date": "Null",
205+
"ceased confirmation details": "Null",
206+
"ceased confirmation user ID": "Null",
207+
"clinical reason for cease": "Null",
208+
"latest episode accumulated result": "Definitive abnormal FOBT outcome",
209+
"latest episode recall calculation method": "S92 Interrupt Close Date",
210+
"latest episode recall episode type": "FOBT Screening",
211+
"latest episode recall surveillance type": "Null",
212+
"latest episode status": "Closed",
213+
"latest episode status reason": "Opt out of current episode",
214+
"latest event status": "S92 Close Screening Episode via Interrupt",
215+
"lynch due date": "Null",
216+
"lynch due date date of change": "Unchanged",
217+
"lynch due date reason": "Unchanged",
218+
"screening due date": "Null",
219+
"screening due date date of change": "Today",
220+
"screening due date reason": "Awaiting failsafe",
221+
"screening status": "Recall",
222+
"screening status reason": "Recall",
223+
"surveillance due date": "Null",
224+
"surveillance due date date of change": "Unchanged",
225+
"surveillance due date reason": "Unchanged",
226+
},
227+
)
209228

210-
# # Then my subject has been updated as follows:
211-
# subject_assertion(
212-
# nhs_no,
213-
# {
214-
# "calculated FOBT due date": "2 years from episode end",
215-
# "calculated lynch due date": None,
216-
# "calculated surveillance due date": None,
217-
# "ceased confirmation date": None,
218-
# "ceased confirmation details": None,
219-
# "ceased confirmation user ID": None,
220-
# "clinical reason for cease": None,
221-
# "latest episode accumulated result": "Definitive abnormal FOBT outcome",
222-
# "latest episode recall calculation method": "S92 Interrupt Close Date",
223-
# "latest episode recall episode type": "FOBT Screening",
224-
# "latest episode recall surveillance type": None,
225-
# "latest episode status": "Closed",
226-
# "latest episode status reason": "Opt out of current episode",
227-
# "latest event status": "S92 Close Screening Episode via Interrupt",
228-
# "lynch due date": None,
229-
# "lynch due date date of change": "Unchanged",
230-
# "lynch due date reason": "Unchanged",
231-
# "screening due date": None,
232-
# "screening due date date of change": "Today",
233-
# "screening due date reason": "Awaiting failsafe",
234-
# "screening status": "Recall",
235-
# "screening status reason": "Recall",
236-
# "surveillance due date": None,
237-
# "surveillance due date date of change": "Unchanged",
238-
# "surveillance due date reason": "Unchanged",
239-
# },
240-
# )
241229

242230
# # When I view the subject
243231
# screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)

0 commit comments

Comments
 (0)