@@ -33,35 +33,35 @@ def test_reports_page_navigation(page: Page) -> None:
3333
3434 # Failsafe reports page opens as expected
3535 ReportsPage (page ).go_to_failsafe_reports_page ()
36- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Failsafe Reports" )
37- click (page , page . get_by_role ( "link" , name = "Back" ) )
36+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Failsafe Reports" )
37+ BasePage (page ). click_back_button ( )
3838
3939 # Operational reports page opens as expected
4040 ReportsPage (page ).go_to_operational_reports_page ()
41- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Operational Reports" )
42- click (page , page . get_by_role ( "link" , name = "Back" ) )
41+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Operational Reports" )
42+ BasePage (page ). click_back_button ( )
4343
4444 # Strategic reports page opens as expected
4545 ReportsPage (page ).go_to_strategic_reports_page ()
46- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Strategic Reports" )
47- click (page , page . get_by_role ( "link" , name = "Back" ) )
46+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Strategic Reports" )
47+ BasePage (page ). click_back_button ( )
4848
4949 # "Cancer waiting times reports" page opens as expected
5050 ReportsPage (page ).go_to_cancer_waiting_times_reports_page ()
51- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Cancer Waiting Times Reports" )
52- click (page , page . get_by_role ( "link" , name = "Back" ) )
51+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Cancer Waiting Times Reports" )
52+ BasePage (page ). click_back_button ( )
5353
5454 # Dashboard opens as expected TODO - this step may be failing legitimately
55- # ReportsPage(page).go_to_dashboard(page )
56- # expect (page.locator("#ntshPageTitle")).to_contain_text ("Dashboard")
57- # click (page, page.get_by_role("link", name="Back" )
55+ # ReportsPage(page).go_to_dashboard()
56+ # BasePage (page).bowel_cancer_screening_page_title_contains_text ("Dashboard")
57+ # BasePage (page).click_back_button( )
5858
5959 # QA Report : Dataset Completion link is visible
6060 expect (page .get_by_text ("QA Report : Dataset Completion" )).to_be_visible ()
6161
6262 # Return to main menu
63- click (page , page . get_by_role ( "link" , name = "Main Menu" ) )
64- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Main Menu" )
63+ BasePage (page ). click_main_menu_link ( )
64+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Main Menu" )
6565
6666
6767# Failsafe Reports
@@ -77,17 +77,16 @@ def test_failsafe_reports_date_report_last_requested(page: Page) -> None:
7777 ReportsPage (page ).go_to_date_report_last_requested_page ()
7878
7979 # Verify 'Date Report Last Requested' is the page title
80- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Date Report Last Requested" )
80+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Date Report Last Requested" )
8181
8282 # Click 'generate report' button
83- click (page , page .get_by_role ("button" , name = "Generate Report" ))
84-
83+ ReportsPage (page ).click_generate_report_button ()
8584 # Verify timestamp has updated (equals current date and time)
8685 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
8786 expect (page .locator ("b" )).to_contain_text (report_timestamp )
8887
8988 # Click 'refresh' button
90- click (page , page . get_by_role ( "button" , name = "Refresh" ) )
89+ ReportsPage (page ). click_refresh_button ( )
9190
9291 # Verify timestamp has updated (equals current date and time)
9392 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
@@ -111,13 +110,13 @@ def test_failsafe_reports_screening_subjects_with_inactive_open_episode(page: Pa
111110 expect (page .locator ("#page-title" )).to_contain_text ("Screening Subjects With Inactive Open Episode" )
112111
113112 # Click 'Generate Report' button
114- click (page , page . get_by_role ( "button" , name = "Generate Report" ) )
113+ ReportsPage (page ). click_generate_report_button ( )
115114
116115 # Open a screening subject record
117116 nhs_number_link .click ()
118117
119118 # Verify "Subject Screening Summary" is the page title
120- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Subject Screening Summary" )
119+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Subject Screening Summary" )
121120
122121
123122def test_failsafe_reports_subjects_ceased_due_to_date_of_birth_changes (page : Page ) -> None :
@@ -143,8 +142,7 @@ def test_failsafe_reports_subjects_ceased_due_to_date_of_birth_changes(page: Pag
143142 click (page , page .get_by_role ("cell" , name = "18" , exact = True ))
144143
145144 # Click "Generate Report"
146- click (page , page .get_by_role ("button" , name = "Generate Report" ))
147-
145+ ReportsPage (page ).click_generate_report_button ()
148146 # Verify timestamp has updated to current date and time
149147 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
150148 expect (timestamp ).to_contain_text (report_timestamp )
@@ -153,7 +151,7 @@ def test_failsafe_reports_subjects_ceased_due_to_date_of_birth_changes(page: Pag
153151 nhs_number_link .click ()
154152
155153 # Verify page title is "Subject Demographic"
156- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Subject Demographic" )
154+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Subject Demographic" )
157155
158156
159157def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundaries (page : Page ) -> None :
@@ -175,10 +173,11 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundarie
175173 ReportsPage (page ).go_to_allocate_sc_for_patient_movements_within_hub_boundaries_page ()
176174
177175 # Verify page title is "Allocate SC for Patient Movements within Hub Boundaries"
178- expect (page .locator ("#ntshPageTitle" )).to_contain_text ("Allocate SC for Patient Movements within Hub Boundaries" )
176+ BasePage (page ).bowel_cancer_screening_page_title_contains_text (
177+ "Allocate SC for Patient Movements within Hub Boundaries" )
179178
180179 # Click "Generate Report"
181- click (page , page . get_by_role ( "button" , name = "Generate Report" ) )
180+ ReportsPage (page ). click_generate_report_button ( )
182181
183182 # Verify timestamp has updated to current date and time
184183 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
@@ -188,13 +187,13 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundarie
188187 nhs_number_link .click ()
189188
190189 # Verify page title is "Set Patient's Screening Centre"
191- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Set Patient's Screening Centre" )
190+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Set Patient's Screening Centre" )
192191
193192 # Select another screening centre
194193 page .locator ("#cboScreeningCentre" ).select_option (coventry_and_warwickshire_bcs_centre )
195194
196195 # Click update
197- click (page , page . get_by_role ( "button" , name = "Update" ) )
196+ ReportsPage (page ). click_reports_pages_update_button ( )
198197
199198 # Verify new screening centre has saved
200199 expect (page .locator ("#cboScreeningCentre" )).to_have_value (coventry_and_warwickshire_bcs_centre )
@@ -213,17 +212,17 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_into_your_hub(page:
213212 ReportsPage (page ).go_to_allocate_sc_for_patient_movements_into_your_hub_page ()
214213
215214 # Verify page title is "Date Report Last Requested"
216- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Allocate SC for Patient Movements into your Hub" )
215+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Allocate SC for Patient Movements into your Hub" )
217216
218217 # Click "Generate Report" button
219- click (page , page . get_by_role ( "button" , name = "Generate Report" ) )
218+ ReportsPage (page ). click_generate_report_button ( )
220219
221220 # Verify timestamp has updated to current date and time
222221 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
223222 expect (page .locator ("b" )).to_contain_text (report_timestamp )
224223
225224 # Click "Refresh" button
226- click (page , page . get_by_role ( "button" , name = "Refresh" ) )
225+ ReportsPage (page ). click_refresh_button ( )
227226
228227 # Verify timestamp has updated to current date and time
229228 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
@@ -248,17 +247,17 @@ def test_failsafe_reports_identify_and_link_new_gp(page: Page) -> None:
248247 ReportsPage (page ).go_to_identify_and_link_new_gp_page ()
249248
250249 # Verify page title is "Identify and link new GP practices"
251- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Identify and link new GP practices" )
250+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Identify and link new GP practices" )
252251
253252 # Click on "Generate Report"
254- click (page , page . get_by_role ( "button" , name = "Generate Report" ) )
253+ ReportsPage (page ). click_generate_report_button ( )
255254
256255 # Verify timestamp has updated to current date and time
257256 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
258257 expect (page .locator ("b" )).to_contain_text (report_timestamp )
259258
260259 # Click "Refresh" button
261- click (page , page . get_by_role ( "button" , name = "Refresh" ) )
260+ ReportsPage (page ). click_refresh_button ( )
262261
263262 # Verify timestamp has updated to current date and time
264263 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
@@ -268,7 +267,7 @@ def test_failsafe_reports_identify_and_link_new_gp(page: Page) -> None:
268267 nhs_number_link .click ()
269268
270269 # Verify page title is "Link GP practice to Screening Centre"
271- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Link GP practice to Screening Centre" )
270+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Link GP practice to Screening Centre" )
272271
273272
274273# Operational Reports
@@ -291,13 +290,13 @@ def test_operational_reports_appointment_attendance_not_updated(page: Page) -> N
291290 ReportsPage (page ).go_to_appointment_attendance_not_updated_page ()
292291
293292 # Verify page title is "Appointment Attendance Not Updated"
294- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Appointment Attendance Not Updated" )
293+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Appointment Attendance Not Updated" )
295294
296295 # Select a screening centre from the drop-down options
297296 page .get_by_label ("Screening Centre" ).select_option (coventry_and_warwickshire_bcs_centre )
298297
299298 # Click "Generate Report" button
300- click (page , page . get_by_role ( "button" , name = "Generate Report" ) )
299+ ReportsPage (page ). click_generate_report_button ( )
301300
302301 # Verify timestamp has updated to current date and time
303302 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
@@ -307,7 +306,7 @@ def test_operational_reports_appointment_attendance_not_updated(page: Page) -> N
307306 nhs_number_link .click ()
308307
309308 # Verify the page title is "Appointment Detail"
310- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Appointment Detail" )
309+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Appointment Detail" )
311310
312311
313312def test_operational_reports_fobt_kits_logged_but_not_read (page : Page ) -> None :
@@ -326,7 +325,7 @@ def test_operational_reports_fobt_kits_logged_but_not_read(page: Page) -> None:
326325 expect (page .locator ("#page-title" )).to_contain_text ("FOBT Kits Logged but Not Read - Summary View" )
327326
328327 # Click refresh button
329- click (page , page . get_by_role ( "button" , name = "Refresh" ) )
328+ ReportsPage (page ). click_refresh_button ( )
330329
331330 # Verify timestamp has updated to current date and time
332331 report_timestamp = DateTimeUtils .fobt_kits_logged_but_not_read_report_timestamp_date_format ()
@@ -366,20 +365,21 @@ def test_operational_reports_screening_practitioner_6_weeks_availability_not_set
366365 ReportsPage (page ).go_to_screening_practitioner_6_weeks_availability_not_set_up_report_page ()
367366
368367 # Verify page title is "Screening Practitioner 6 Weeks Availability Not Set Up"
369- expect (page .locator ("#ntshPageTitle" )).to_contain_text ("Screening Practitioner 6 Weeks Availability Not Set Up" )
368+ BasePage (page ).bowel_cancer_screening_page_title_contains_text (
369+ "Screening Practitioner 6 Weeks Availability Not Set Up" )
370370
371371 # Select a screening centre
372372 page .get_by_label ("Screening Centre" ).select_option (coventry_and_warwickshire_bcs_centre )
373373
374374 # Click "Generate Report"
375- click (page , page . get_by_role ( "button" , name = "Generate Report" ) )
375+ ReportsPage (page ). click_generate_report_button ( )
376376
377377 # Verify timestamp has updated to current date and time
378378 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
379379 expect (page .locator ("#displayGenerateDate" )).to_contain_text (report_timestamp )
380380
381381 # Click "Refresh" button
382- click (page , page . get_by_role ( "button" , name = "Refresh" ) )
382+ ReportsPage (page ). click_refresh_button ( )
383383
384384 # Verify timestamp has updated to current date and time
385385 report_timestamp = DateTimeUtils .report_timestamp_date_format ()
@@ -404,7 +404,7 @@ def test_operational_reports_screening_practitioner_appointments(page: Page) ->
404404 ReportsPage (page ).go_to_screening_practitioner_appointments_page ()
405405
406406 # Verify page title is "Screening Practitioner Appointments"
407- expect (page . locator ( "#ntshPageTitle" )). to_contain_text ("Screening Practitioner Appointments" )
407+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Screening Practitioner Appointments" )
408408
409409 # Select a screening centre
410410 page .get_by_label ("Screening Centre" ).select_option (coventry_and_warwickshire_bcs_centre )
0 commit comments