Skip to content

Commit 0b97db7

Browse files
committed
Merge branch 'main' into feature/BCSS-20477-c6-pom-diagnostic-test-outcome-page
# Conflicts: # tests/smokescreen/test_compartment_6.py
2 parents 8464e0e + f17510c commit 0b97db7

File tree

5 files changed

+377
-23
lines changed

5 files changed

+377
-23
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
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
from playwright.sync_api import Page
2+
from pages.base_page import BasePage
3+
from datetime import datetime
4+
5+
class HandoverIntoSymptomaticCarePage(BasePage):
6+
"""
7+
HandoverIntoSymptomaticCarePage class for interacting with the 'Handover Into Symptomatic Care' page elements.
8+
"""
9+
def __init__(self, page: Page):
10+
self.page = page
11+
self.referral_dropdown = self.page.get_by_label("Referral")
12+
self.calendar_button = self.page.get_by_role("button", name="Calendar")
13+
self.consultant_link = self.page.locator("#UI_NS_CONSULTANT_PIO_SELECT_LINK")
14+
self.notes_textbox = self.page.get_by_role("textbox", name="Notes")
15+
self.save_button = self.page.get_by_role("button", name="Save")
16+
17+
def select_referral_dropdown_option(self, value: str) -> None:
18+
"""
19+
Select a given option from the Referral dropdown.
20+
21+
Args:
22+
value (str): The value of the option you want to select
23+
"""
24+
self.referral_dropdown.select_option(value)
25+
26+
def click_calendar_button(self) -> None:
27+
"""Click the calendar button to open the calendar picker."""
28+
self.click(self.calendar_button)
29+
30+
def select_consultant(self, value: str) -> None:
31+
"""
32+
Select a consultant from the consultant dropdown using the given value.
33+
34+
Args:
35+
value (str): The value attribute of the consultant option to select.
36+
"""
37+
self.consultant_link.click()
38+
option_locator = self.page.locator(f'[value="{value}"]:visible')
39+
option_locator.wait_for(state="visible")
40+
self.click(option_locator)
41+
42+
def fill_notes(self, notes: str) -> None:
43+
"""
44+
Fill the 'Notes' textbox with the provided text.
45+
46+
Args:
47+
notes (str): The text to enter into the notes textbox.
48+
"""
49+
self.notes_textbox.click()
50+
self.notes_textbox.fill(notes)
51+
52+
def click_save_button(self) -> None:
53+
"""Click the save button to save the changes."""
54+
self.safe_accept_dialog(self.save_button)

tests/smokescreen/test_compartment_5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
162162

163163
logging.info(f"Inviting {name_from_util} to diagnostic test")
164164
AdvanceFOBTScreeningEpisodePage(page).click_invite_for_diagnostic_test_button()
165-
SubjectScreeningSummaryPage(page).verify_latest_event_status_value(
165+
AdvanceFOBTScreeningEpisodePage(page).verify_latest_event_status_value(
166166
"A59 - Invited for Diagnostic Test"
167167
)
168168

tests/smokescreen/test_compartment_6.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
from utils.batch_processing import batch_processing
1010
from pages.logout.log_out_page import LogoutPage
1111
from pages.datasets.subject_datasets_page import SubjectDatasetsPage
12+
from pages.screening_subject_search.handover_into_symptomatic_care_page import (
13+
HandoverIntoSymptomaticCarePage
14+
)
1215
from utils.calendar_picker import CalendarPicker
1316
from datetime import datetime
1417
from pages.screening_subject_search.record_diagnosis_date_page import (
@@ -248,19 +251,12 @@ def handover_subject_to_symptomatic_care(page: Page) -> None:
248251
AdvanceFOBTScreeningEpisodePage(page).click_handover_into_symptomatic_care_button()
249252

250253
# The following code is on the handover into symptomatic care page
251-
page.get_by_label("Referral").select_option("20445")
252-
page.get_by_role("button", name="Calendar").click()
254+
HandoverIntoSymptomaticCarePage(page).select_referral_dropdown_option("20445")
255+
HandoverIntoSymptomaticCarePage(page).click_calendar_button()
253256
CalendarPicker(page).v1_calender_picker(datetime.today())
254-
page.locator("#UI_NS_CONSULTANT_PIO_SELECT_LINK").click()
255-
option_locator = page.locator(
256-
'[value="201"]:visible'
257-
) # Here value '201' is referring to Consultant B, Frame
258-
option_locator.wait_for(state="visible")
259-
option_locator.click()
260-
page.get_by_role("textbox", name="Notes").click()
261-
page.get_by_role("textbox", name="Notes").fill("Test Automation")
262-
page.once("dialog", lambda dialog: dialog.accept())
263-
page.get_by_role("button", name="Save").click()
257+
HandoverIntoSymptomaticCarePage(page).select_consultant("201")
258+
HandoverIntoSymptomaticCarePage(page).fill_notes("Test Automation")
259+
HandoverIntoSymptomaticCarePage(page).click_save_button()
264260

265261
SubjectScreeningSummaryPage(page).wait_for_page_title()
266262
SubjectScreeningSummaryPage(page).verify_latest_event_status_value(

0 commit comments

Comments
 (0)