Skip to content

Commit d8cb593

Browse files
Responded to review comments and updated doc strings
1 parent 2ff2967 commit d8cb593

File tree

2 files changed

+81
-59
lines changed

2 files changed

+81
-59
lines changed

docs/utility-guides/ScreeningSubjectPageSearcher.md

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
The Screening Subject Search utility allows for
44

5-
- searching for relevant subjects using their NHS Number, forename, last name, DOB, post code, episode closed date, status or latest event status
6-
- verifying the subject's event status using their nhs number
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
77

88
## Table of Contents
99

1010
- [Utility Guide: Screening Subject Page Searcher](#utility-guide-screening-subject-page-searcher)
1111
- [Table of Contents](#table-of-contents)
1212
- [Functions Overview](#functions-overview)
13-
- [Verify subject event status by nhs no](#verify-subject-event-status-by-nhs-no)
13+
- [The page object parameter:](#the-page-object-parameter)
14+
- [Verify subject event status by NHS no](#verify-subject-event-status-by-nhs-no)
1415
- [Arguments](#arguments)
1516
- [How This Function Works](#how-this-function-works)
16-
- [Search subject by nhs number](#search-subject-by-nhs-number)
17+
- [Search subject by NHS number](#search-subject-by-nhs-number)
1718
- [Arguments](#arguments-1)
1819
- [How This Function Works](#how-this-function-works-1)
1920
- [Search subject by surname](#search-subject-by-surname)
@@ -25,7 +26,7 @@ The Screening Subject Search utility allows for
2526
- [Search subject by date of birth](#search-subject-by-date-of-birth)
2627
- [Arguments](#arguments-4)
2728
- [How This Function Works](#how-this-function-works-4)
28-
- [Search subject by post code](#search-subject-by-post-code)
29+
- [Search subject by postcode](#search-subject-by-postcode)
2930
- [Arguments](#arguments-5)
3031
- [How This Function Works](#how-this-function-works-5)
3132
- [Search subject by episode closed date](#search-subject-by-episode-closed-date)
@@ -61,10 +62,13 @@ For this utility we have the following functions:
6162
- `search_subject_by_search_area`
6263
- `check_clear_filters_button_works`
6364

64-
### Verify subject event status by nhs no
65+
### The page object parameter:
66+
- is required for all the listed functions above. It is listed as an arguement just once to avoid repetition
67+
68+
### Verify subject event status by NHS no
6569

6670
This is used to check that the latest event status of a subject has been updated to what is expected.
67-
The provided nhs no is used to search the whole database and then verifies the latest event status is as expected.
71+
The provided NHS no is used to search the whole database and then verifies the latest event status is as expected.
6872

6973
#### Arguments
7074

@@ -73,7 +77,7 @@ The provided nhs no is used to search the whole database and then verifies the l
7377
- This is the playwright page object which is used to tell playwright what page the test is currently on
7478
- `nhs_no`:
7579
- Type: `str`
76-
- This is the subject's nhs number. For example: 123 456 7890
80+
- This is the subject's NHS number. For example: 123 456 7890
7781
- `latest_event_status`:
7882
- Type: `str`
7983
- This is the expected status of the subject that is being verified
@@ -82,37 +86,31 @@ The provided nhs no is used to search the whole database and then verifies the l
8286

8387
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
8488
2. Once on the main menu it navigates to the screening subject search page
85-
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
89+
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
8690
4. It then clicks the search button
8791
5. Once the subject is returned, it then verifies that the latest event status matches the supplied event status
8892

89-
### Search subject by nhs number
93+
### Search subject by NHS number
9094

9195
This searches for a subject by their NHS Number
9296

9397
#### Arguments
9498

95-
- `page`:
96-
- Type: `Page`
97-
- This is the playwright page object which is used to tell playwright what page the test is currently on
9899
- `nhs_no`:
99100
- Type: `str`
100-
- This is the subject's nhs number. For example: 123 456 7890
101+
- This is the subject's NHS number. For example: 123 456 7890
101102

102103
#### How This Function Works
103104

104105
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
105-
2. It then fills in the nhs number filter field with the supplied nhs number and clicks the search button
106+
2. It then fills in the NHS number filter field with the supplied NHS number and clicks the search button
106107

107108
### Search subject by surname
108109

109110
This searches for a subject by their surname
110111

111112
#### Arguments
112113

113-
- `page`:
114-
- Type: `Page`
115-
- This is the playwright page object which is used to tell playwright what page the test is currently on
116114
- `surname`:
117115
- Type: `str`
118116
- This is the subject's surname
@@ -128,9 +126,6 @@ This searches for a subject by their forename
128126

129127
#### Arguments
130128

131-
- `page`:
132-
- Type: `Page`
133-
- This is the playwright page object which is used to tell playwright what page the test is currently on
134129
- `forename`:
135130
- Type: `str`
136131
- This is the subject's forename
@@ -146,9 +141,6 @@ This searches for a subject by their date of birth
146141

147142
#### Arguments
148143

149-
- `page`:
150-
- Type: `Page`
151-
- This is the playwright page object which is used to tell playwright what page the test is currently on
152144
- `dob`:
153145
- Type: `str`
154146
- This is the subject's date of birth
@@ -158,33 +150,27 @@ This searches for a subject by their date of birth
158150
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
159151
2. It then fills in the date of birth filter field with the supplied DOB and clicks the search button
160152

161-
### Search subject by post code
153+
### Search subject by postcode
162154

163-
This searches for a subject by their post code
155+
This searches for a subject by their postcode
164156

165157
#### Arguments
166158

167-
- `page`:
168-
- Type: `Page`
169-
- This is the playwright page object which is used to tell playwright what page the test is currently on
170159
- `postcode`:
171160
- Type: `str`
172-
- This is the subject's post code
161+
- This is the subject's postcode
173162

174163
#### How This Function Works
175164

176165
1. It starts off by clicking on the **Clear filters** button to remove any persisting filters
177-
2. It then fills in the post code filter field with the supplied post code and clicks the search button
166+
2. It then fills in the postcode filter field with the supplied postcode and clicks the search button
178167

179168
### Search subject by episode closed date
180169

181170
This searches for a subject by their episode closed date
182171

183172
#### Arguments
184173

185-
- `page`:
186-
- Type: `Page`
187-
- This is the playwright page object which is used to tell playwright what page the test is currently on
188174
- `episode_closed_date`:
189175
- Type: `str`
190176
- This is the subject's episode closed date
@@ -200,9 +186,6 @@ This searches for a subject by their screening status
200186

201187
#### Arguments
202188

203-
- `page`:
204-
- Type: `Page`
205-
- This is the playwright page object which is used to tell playwright what page the test is currently on
206189
- `status`:
207190
- Type: `str`
208191
- This is the subject's screening status
@@ -218,9 +201,6 @@ This searches for a subject by their latest event status
218201

219202
#### Arguments
220203

221-
- `page`:
222-
- Type: `Page`
223-
- This is the playwright page object which is used to tell playwright what page the test is currently on
224204
- `status`:
225205
- Type: `str`
226206
- This is the subject's latest event status
@@ -236,9 +216,6 @@ This searches for a subject by search area
236216

237217
#### Required Arguments
238218

239-
- `page`:
240-
- Type: `Page`
241-
- This is the playwright page object which is used to tell playwright what page the test is currently on
242219
- `status`:
243220
- Type: `str`
244221
- This is the subject's screening status
@@ -267,14 +244,11 @@ This checks that the "clear filter" button works as intended
267244

268245
#### Arguments
269246

270-
- `page`:
271-
- Type: `Page`
272-
- This is the playwright page object which is used to tell playwright what page the test is currently on
273247
- `nhs_no`:
274248
- Type: `str`
275-
- This is the subject's nhs number. For example: 123 456 7890
249+
- This is the subject's NHS number. For example: 123 456 7890
276250

277251
#### How This Function Works
278252

279-
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
280-
2. It then clicks the clear filters button and verifies that the nhs number filter field is now empty
253+
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
254+
2. It then clicks the clear filters button and verifies that the NHS number filter field is now empty

utils/screening_subject_page_searcher.py

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ def verify_subject_event_status_by_nhs_no(
1616
This is used to check that the latest event status of a subject has been updated to what is expected
1717
We provide the NHS Number for the subject and the expected latest event status and it navigates to the correct page
1818
From here it searches for that subject against the whole database and verifies the latest event status is as expected
19+
20+
Args:
21+
page (Page): This is the playwright page object
22+
nhs_no (str): The screening subject's nhs number
23+
latest_event_status (str | list): the screening subjects's latest event status
1924
"""
2025
BasePage(page).click_main_menu_link()
2126
BasePage(page).go_to_screening_subject_search_page()
@@ -33,79 +38,111 @@ def verify_subject_event_status_by_nhs_no(
3338
)
3439

3540

36-
def search_subject_by_nhs_number(page: Page, nhs_number) -> None:
41+
def search_subject_by_nhs_number(page: Page, nhs_number: str) -> None:
3742
"""
3843
This searches for a subject by their NHS Number and checks the page has redirected accordingly
44+
45+
Args:
46+
page (Page): This is the playwright page object
47+
nhs_no (str): The screening subject's nhs number
3948
"""
4049
SubjectScreeningPage(page).click_clear_filters_button()
4150
SubjectScreeningPage(page).nhs_number_filter.fill(nhs_number)
4251
SubjectScreeningPage(page).nhs_number_filter.press("Tab")
4352
SubjectScreeningPage(page).click_search_button()
4453

4554

46-
def search_subject_by_surname(page: Page, surname) -> None:
55+
def search_subject_by_surname(page: Page, surname: str) -> None:
4756
"""
4857
This searches for a subject by their surname and checks the page has redirected accordingly
58+
59+
Args:
60+
page (Page): This is the playwright page object
61+
surname (str): The screening subject's surname
4962
"""
5063
SubjectScreeningPage(page).click_clear_filters_button()
5164
SubjectScreeningPage(page).surname_filter.fill(surname)
5265
SubjectScreeningPage(page).surname_filter.press("Tab")
5366
SubjectScreeningPage(page).click_search_button()
5467

5568

56-
def search_subject_by_forename(page: Page, forename) -> None:
69+
def search_subject_by_forename(page: Page, forename: str) -> None:
5770
"""
5871
This searches for a subject by their forename and checks the page has redirected accordingly
72+
73+
Args:
74+
page (Page): This is the playwright page object
75+
forename (str): The screening subject's forename
5976
"""
6077
SubjectScreeningPage(page).click_clear_filters_button()
6178
SubjectScreeningPage(page).forename_filter.fill(forename)
6279
SubjectScreeningPage(page).forename_filter.press("Tab")
6380
SubjectScreeningPage(page).click_search_button()
6481

6582

66-
def search_subject_by_dob(page: Page, dob) -> None:
83+
def search_subject_by_dob(page: Page, dob: str) -> None:
6784
"""
6885
This searches for a subject by their date of birth and checks the page has redirected accordingly
86+
87+
Args:
88+
page (Page): This is the playwright page object
89+
dob (str): The screening subject's date of birth
6990
"""
7091
SubjectScreeningPage(page).click_clear_filters_button()
7192
SubjectScreeningPage(page).date_of_birth_filter.fill(dob)
7293
SubjectScreeningPage(page).date_of_birth_filter.press("Tab")
7394
SubjectScreeningPage(page).click_search_button()
7495

7596

76-
def search_subject_by_postcode(page: Page, postcode) -> None:
97+
def search_subject_by_postcode(page: Page, postcode: str) -> None:
7798
"""
7899
This searches for a subject by their postcode and checks the page has redirected accordingly
100+
101+
Args:
102+
page (Page): This is the playwright page object
103+
postcode (str): The screening subject's postcode
79104
"""
80105
SubjectScreeningPage(page).click_clear_filters_button()
81106
SubjectScreeningPage(page).postcode_filter.fill(postcode)
82107
SubjectScreeningPage(page).postcode_filter.press("Tab")
83108
SubjectScreeningPage(page).click_search_button()
84109

85110

86-
def search_subject_by_episode_closed_date(page: Page, episode_closed_date) -> None:
111+
def search_subject_by_episode_closed_date(page: Page, episode_closed_date: str) -> None:
87112
"""
88113
This searches for a subject by their episode closed date and checks the page has redirected accordingly
114+
115+
Args:
116+
page (Page): This is the playwright page object
117+
episode_closed_date (str): The screening subject's episode closed date
89118
"""
90119
SubjectScreeningPage(page).click_clear_filters_button()
91120
SubjectScreeningPage(page).episode_closed_date_filter.fill(episode_closed_date)
92121
SubjectScreeningPage(page).episode_closed_date_filter.press("Tab")
93122
SubjectScreeningPage(page).click_search_button()
94123

95124

96-
def search_subject_by_status(page: Page, status) -> None:
125+
def search_subject_by_status(page: Page, status: str) -> None:
97126
"""
98127
This searches for a subject by their screening status and checks the page has redirected accordingly
128+
129+
Args:
130+
page (Page): This is the playwright page object
131+
status (str): The screening subject's screening status
99132
"""
100133
SubjectScreeningPage(page).click_clear_filters_button()
101134
SubjectScreeningPage(page).select_screening_status_options(status)
102135
SubjectScreeningPage(page).select_screening_status.press("Tab")
103136
SubjectScreeningPage(page).click_search_button()
104137

105138

106-
def search_subject_by_latest_event_status(page: Page, status) -> None:
139+
def search_subject_by_latest_event_status(page: Page, status: str) -> None:
107140
"""
108141
This searches for a subject by their latest event status and checks the page has redirected accordingly
142+
143+
Args:
144+
page (Page): This is the playwright page object
145+
status (str): The screening subject's latest event status
109146
"""
110147
SubjectScreeningPage(page).click_clear_filters_button()
111148
SubjectScreeningPage(page).select_episode_status_option(status)
@@ -114,10 +151,17 @@ def search_subject_by_latest_event_status(page: Page, status) -> None:
114151

115152

116153
def search_subject_by_search_area(
117-
page: Page, status, search_area, code=None, gp_practice_code=None
154+
page: Page, status: str, search_area: str, code: str=None, gp_practice_code: str=None
118155
) -> None:
119156
"""
120157
This searches for a subject by the search area, populating necessary fields were needed, and checks that the page has redirected accordingly
158+
159+
Args:
160+
page (Page): This is the playwright page object
161+
status (str): The screening subject's screening status
162+
search_area (str): This is the search area option to use
163+
code (str): If provided, the code parameter is used to fill the appropriate code filter field
164+
gp_practice_code (str): If provided, the GP practice code parameter is used to fill the GP Practice in CCG filter field
121165
"""
122166
SubjectScreeningPage(page).click_clear_filters_button()
123167
SubjectScreeningPage(page).select_screening_status_options(status)
@@ -133,9 +177,13 @@ def search_subject_by_search_area(
133177
SubjectScreeningPage(page).click_search_button()
134178

135179

136-
def check_clear_filters_button_works(page, nhs_number) -> None:
180+
def check_clear_filters_button_works(page: Page, nhs_number: str) -> None:
137181
"""
138182
This checks that the "clear filter" button works as intended
183+
184+
Args:
185+
page (Page): This is the playwright page object
186+
nhs_number (str): The screening subject's nhs number
139187
"""
140188
SubjectScreeningPage(page).nhs_number_filter.fill(nhs_number)
141189
expect(SubjectScreeningPage(page).nhs_number_filter).to_have_value(nhs_number)

0 commit comments

Comments
 (0)