Skip to content

Commit 2e71c28

Browse files
Merge branch 'main' of github.com:NHSDigital/bcss-playwright into feature/BCSS-20478-c6-pom-handover-into-symptomatic-care-page
2 parents 741111b + f87a688 commit 2e71c28

File tree

4 files changed

+344
-15
lines changed

4 files changed

+344
-15
lines changed
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
# Utility Guide: Screening Subject Page Searcher
2+
3+
The Screening Subject Search utility allows for
4+
5+
- searching for relevant subjects using their NHS Number, forename, last name, DOB, postcode, episode closed date, status or latest event status
6+
- verifying the subject's event status using their NHS number
7+
8+
## Table of Contents
9+
10+
- [Utility Guide: Screening Subject Page Searcher](#utility-guide-screening-subject-page-searcher)
11+
- [Table of Contents](#table-of-contents)
12+
- [Functions Overview](#functions-overview)
13+
- [The page object parameter](#the-page-object-parameter)
14+
- [Verify subject event status by NHS no](#verify-subject-event-status-by-nhs-no)
15+
- [Arguments](#arguments)
16+
- [How This Function Works](#how-this-function-works)
17+
- [Search subject by NHS number](#search-subject-by-nhs-number)
18+
- [Arguments](#arguments-1)
19+
- [How This Function Works](#how-this-function-works-1)
20+
- [Search subject by surname](#search-subject-by-surname)
21+
- [Arguments](#arguments-2)
22+
- [How This Function Works](#how-this-function-works-2)
23+
- [Search subject by forename](#search-subject-by-forename)
24+
- [Arguments](#arguments-3)
25+
- [How This Function Works](#how-this-function-works-3)
26+
- [Search subject by date of birth](#search-subject-by-date-of-birth)
27+
- [Arguments](#arguments-4)
28+
- [How This Function Works](#how-this-function-works-4)
29+
- [Search subject by postcode](#search-subject-by-postcode)
30+
- [Arguments](#arguments-5)
31+
- [How This Function Works](#how-this-function-works-5)
32+
- [Search subject by episode closed date](#search-subject-by-episode-closed-date)
33+
- [Arguments](#arguments-6)
34+
- [How This Function Works](#how-this-function-works-6)
35+
- [Search subject by status](#search-subject-by-status)
36+
- [Arguments](#arguments-7)
37+
- [How This Function Works](#how-this-function-works-7)
38+
- [Search subject by latest event status](#search-subject-by-latest-event-status)
39+
- [Arguments](#arguments-8)
40+
- [How This Function Works](#how-this-function-works-8)
41+
- [Search subject by search area](#search-subject-by-search-area)
42+
- [Required Arguments](#required-arguments)
43+
- [Optional Arguments](#optional-arguments)
44+
- [How This Function Works](#how-this-function-works-9)
45+
- [Check clear filters button works](#check-clear-filters-button-works)
46+
- [Arguments](#arguments-9)
47+
- [How This Function Works](#how-this-function-works-10)
48+
49+
## Functions Overview
50+
51+
For this utility we have the following functions:
52+
53+
- `verify_subject_event_status_by_nhs_no`
54+
- `search_subject_by_nhs_number`
55+
- `search_subject_by_surname`
56+
- `search_subject_by_forename`
57+
- `search_subject_by_dob`
58+
- `search_subject_by_postcode`
59+
- `search_subject_by_episode_closed_date`
60+
- `search_subject_by_status`
61+
- `search_subject_by_latest_event_status`
62+
- `search_subject_by_search_area`
63+
- `check_clear_filters_button_works`
64+
65+
### The page object parameter
66+
67+
- Is required for all the listed functions above.
68+
- It is listed as an argument just once to avoid repetition.
69+
70+
### Verify subject event status by NHS no
71+
72+
This is used to check that the latest event status of a subject has been updated to what is expected.
73+
The provided NHS no is used to search the whole database and then verifies the latest event status is as expected.
74+
75+
#### Arguments
76+
77+
- `page`:
78+
- Type: `Page`
79+
- This is the playwright page object which is used to tell playwright what page the test is currently on
80+
- `nhs_no`:
81+
- Type: `str`
82+
- This is the subject's NHS number. For example: 123 456 7890
83+
- `latest_event_status`:
84+
- Type: `str`
85+
- This is the expected status of the subject that is being verified
86+
87+
#### How This Function Works
88+
89+
1. It starts off by navigating to the main menu if not already on this page. This is done to ensure that this can be called from any page
90+
2. Once on the main menu it navigates to the screening subject search page
91+
3. From here it fills in the NHS number filter field with the supplied NHS number and chooses the whole area database as the search area option
92+
4. It then clicks the search button
93+
5. Once the subject is returned, it then verifies that the latest event status matches the supplied event status
94+
95+
### Search subject by NHS number
96+
97+
This searches for a subject by their NHS Number
98+
99+
#### Arguments
100+
101+
- `nhs_no`:
102+
- Type: `str`
103+
- This is the subject's NHS number. For example: 123 456 7890
104+
105+
#### How This Function Works
106+
107+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
108+
2. It then fills in the NHS number filter field with the supplied NHS number and clicks the search button
109+
110+
### Search subject by surname
111+
112+
This searches for a subject by their surname
113+
114+
#### Arguments
115+
116+
- `surname`:
117+
- Type: `str`
118+
- This is the subject's surname
119+
120+
#### How This Function Works
121+
122+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
123+
2. It then fills in the surname filter field with the supplied surname and clicks the search button
124+
125+
### Search subject by forename
126+
127+
This searches for a subject by their forename
128+
129+
#### Arguments
130+
131+
- `forename`:
132+
- Type: `str`
133+
- This is the subject's forename
134+
135+
#### How This Function Works
136+
137+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
138+
2. It then fills in the forename filter field with the supplied forename and clicks the search button
139+
140+
### Search subject by date of birth
141+
142+
This searches for a subject by their date of birth
143+
144+
#### Arguments
145+
146+
- `dob`:
147+
- Type: `str`
148+
- This is the subject's date of birth
149+
150+
#### How This Function Works
151+
152+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
153+
2. It then fills in the date of birth filter field with the supplied DOB and clicks the search button
154+
155+
### Search subject by postcode
156+
157+
This searches for a subject by their postcode
158+
159+
#### Arguments
160+
161+
- `postcode`:
162+
- Type: `str`
163+
- This is the subject's postcode
164+
165+
#### How This Function Works
166+
167+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
168+
2. It then fills in the postcode filter field with the supplied postcode and clicks the search button
169+
170+
### Search subject by episode closed date
171+
172+
This searches for a subject by their episode closed date
173+
174+
#### Arguments
175+
176+
- `episode_closed_date`:
177+
- Type: `str`
178+
- This is the subject's episode closed date
179+
180+
#### How This Function Works
181+
182+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
183+
2. It then fills in the episode closed date filter field with the supplied date and clicks the search button
184+
185+
### Search subject by status
186+
187+
This searches for a subject by their screening status
188+
189+
#### Arguments
190+
191+
- `status`:
192+
- Type: `str`
193+
- This is the subject's screening status
194+
195+
#### How This Function Works
196+
197+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
198+
2. It then selects the screening status option that matches the supplied status and clicks the search button
199+
200+
### Search subject by latest event status
201+
202+
This searches for a subject by their latest event status
203+
204+
#### Arguments
205+
206+
- `status`:
207+
- Type: `str`
208+
- This is the subject's latest event status
209+
210+
#### How This Function Works
211+
212+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
213+
2. It then selects the episode status option that matches the supplied status and clicks the search button
214+
215+
### Search subject by search area
216+
217+
This searches for a subject by search area
218+
219+
#### Required Arguments
220+
221+
- `status`:
222+
- Type: `str`
223+
- This is the subject's screening status
224+
- `search_area`:
225+
- Type: `str`
226+
- This is the search area option to use
227+
228+
#### Optional Arguments
229+
230+
- `code`:
231+
- Type: `str`
232+
- `gp_practice_code`:
233+
- Type: `str`
234+
235+
#### How This Function Works
236+
237+
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
238+
2. It then selects the screening status option that matches the supplied status
239+
3. If provided, the code parameter is used to fill the appropriate code filter field
240+
4. If provided, the GP practice code parameter is used to fill the GP Practice in CCG filter field
241+
5. It then clicks the search button
242+
243+
### Check clear filters button works
244+
245+
This checks that the "clear filter" button works as intended
246+
247+
#### Arguments
248+
249+
- `nhs_no`:
250+
- Type: `str`
251+
- This is the subject's NHS number. For example: 123 456 7890
252+
253+
#### How This Function Works
254+
255+
1. It fills in the NHS number filter field with the supplied NHS number and verifies that the NHS number filter field contains the entered value
256+
2. It then clicks the clear filters button and verifies that the NHS number filter field is now empty

pages/screening_subject_search/advance_fobt_screening_episode_page.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ def __init__(self, page: Page):
2828
self.record_other_post_investigation_contact_button = self.page.get_by_role(
2929
"button", name="Record other post-"
3030
)
31+
self.enter_diagnostic_test_outcome_button = self.page.get_by_role(
32+
"button", name="Enter Diagnostic Test Outcome"
33+
)
34+
self.handover_into_symptomatic_care_button = self.page.get_by_role(
35+
"button", name="Handover into Symptomatic Care"
36+
)
37+
self.record_diagnosis_date_button = self.page.get_by_role(
38+
"button", name="Record Diagnosis Date"
39+
)
3140

3241
def click_suitable_for_endoscopic_test_button(self) -> None:
3342
"""Click the 'Suitable for Endoscopic Test' button."""
@@ -78,3 +87,15 @@ def verify_latest_event_status_value(self, latest_event_status: str) -> None:
7887
def click_record_other_post_investigation_contact_button(self) -> None:
7988
"""Click the 'Record other post-investigation contact' button."""
8089
self.click(self.record_other_post_investigation_contact_button)
90+
91+
def click_enter_diagnostic_test_outcome_button(self) -> None:
92+
"""Click the 'Enter Diagnostic Test Outcome' button."""
93+
self.click(self.enter_diagnostic_test_outcome_button)
94+
95+
def click_handover_into_symptomatic_care_button(self) -> None:
96+
"""Click the 'Handover Into Symptomatic Care' button."""
97+
self.click(self.handover_into_symptomatic_care_button)
98+
99+
def click_record_diagnosis_date_button(self) -> None:
100+
"""Click the 'Record Diagnosis Date' button."""
101+
self.click(self.record_diagnosis_date_button)

tests/smokescreen/test_compartment_6.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
PolypInterventionDeviceOptions,
4040
PolypInterventionExcisionTechniqueOptions,
4141
)
42+
from pages.screening_subject_search.advance_fobt_screening_episode_page import (
43+
AdvanceFOBTScreeningEpisodePage,
44+
)
4245

4346

4447
# This should go into a util. Adding it here to avoid SonarQube duplication errors:
@@ -210,7 +213,8 @@ def after_high_risk_result(page: Page) -> None:
210213

211214
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
212215
# The following code is on the advance fobt screening episode page
213-
page.get_by_role("button", name="Enter Diagnostic Test Outcome").click()
216+
AdvanceFOBTScreeningEpisodePage(page).click_enter_diagnostic_test_outcome_button()
217+
214218
# The following code is on the diagnostic test outcome page
215219
expect(page.get_by_role("cell", name="High-risk findings").nth(1)).to_be_visible()
216220
page.get_by_label("Outcome of Diagnostic Test").select_option("20365")
@@ -228,7 +232,7 @@ def after_lnpcp_result(page: Page) -> None:
228232
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
229233

230234
# The following code is on the advance fobt screening episode page
231-
page.get_by_role("button", name="Enter Diagnostic Test Outcome").click()
235+
AdvanceFOBTScreeningEpisodePage(page).click_enter_diagnostic_test_outcome_button()
232236

233237
# The following code is on the diagnostic test outcome page
234238
expect(page.get_by_role("cell", name="LNPCP").nth(1)).to_be_visible()
@@ -310,7 +314,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
310314
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
311315

312316
# The following code is on the advance fobt screening episode page
313-
page.get_by_role("button", name="Record Diagnosis Date").click()
317+
AdvanceFOBTScreeningEpisodePage(page).click_record_diagnosis_date_button()
314318

315319
# The following code is on the record diagnosis date page
316320
RecordDiagnosisDatePage(page).enter_date_in_diagnosis_date_field(datetime.today())
@@ -389,7 +393,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
389393
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
390394

391395
# The following code is on the advance fobt screening episode page
392-
page.get_by_role("button", name="Enter Diagnostic Test Outcome").click()
396+
AdvanceFOBTScreeningEpisodePage(page).click_enter_diagnostic_test_outcome_button()
393397

394398
# The following code is on the diagnostic test outcome page
395399
expect(
@@ -404,7 +408,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
404408
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
405409

406410
# The following code is on the advance fobt screening episode page
407-
page.get_by_role("button", name="Record Diagnosis Date").click()
411+
AdvanceFOBTScreeningEpisodePage(page).click_record_diagnosis_date_button()
408412

409413
# The following code is on the record diagnosis date page
410414
RecordDiagnosisDatePage(page).enter_date_in_diagnosis_date_field(datetime.today())

0 commit comments

Comments
 (0)