11import pytest
22from playwright .sync_api import Page , expect
33
4+ from pages .base_page import BasePage
45from pages .reports_page import ReportsPage
56from utils .click_helper import click
6- from pages import reports_page
7- from pages .base_page import BasePage
8- from utils .user_tools import UserTools
97from utils .date_time_utils import DateTimeUtils
8+ from utils .user_tools import UserTools
109
1110
1211@pytest .fixture (scope = "function" , autouse = True )
@@ -28,27 +27,30 @@ def test_reports_page_navigation(page: Page) -> None:
2827 Confirms all menu items are displayed on the reports page, and that the relevant pages
2928 are loaded when the links are clicked
3029 """
30+ bureau_reports_link = page .get_by_text ("Bureau Reports" )
31+ qa_report_data_completion_link = page .get_by_text ("QA Report : Dataset Completion" )
32+
3133 # Bureau reports link is visible
32- expect (page . get_by_text ( "Bureau Reports" ) ).to_be_visible ()
34+ expect (bureau_reports_link ).to_be_visible ()
3335
3436 # Failsafe reports page opens as expected
3537 ReportsPage (page ).go_to_failsafe_reports_page ()
36- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Failsafe Reports" )
38+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Failsafe Reports" )
3739 BasePage (page ).click_back_button ()
3840
3941 # Operational reports page opens as expected
4042 ReportsPage (page ).go_to_operational_reports_page ()
41- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Operational Reports" )
43+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Operational Reports" )
4244 BasePage (page ).click_back_button ()
4345
4446 # Strategic reports page opens as expected
4547 ReportsPage (page ).go_to_strategic_reports_page ()
46- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Strategic Reports" )
48+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Strategic Reports" )
4749 BasePage (page ).click_back_button ()
4850
4951 # "Cancer waiting times reports" page opens as expected
5052 ReportsPage (page ).go_to_cancer_waiting_times_reports_page ()
51- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Cancer Waiting Times Reports" )
53+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Cancer Waiting Times Reports" )
5254 BasePage (page ).click_back_button ()
5355
5456 # Dashboard opens as expected TODO - this step may be failing legitimately
@@ -57,11 +59,11 @@ def test_reports_page_navigation(page: Page) -> None:
5759 # BasePage(page).click_back_button()
5860
5961 # QA Report : Dataset Completion link is visible
60- expect (page . get_by_text ( "QA Report : Dataset Completion" ) ).to_be_visible ()
62+ expect (qa_report_data_completion_link ).to_be_visible ()
6163
6264 # Return to main menu
6365 BasePage (page ).click_main_menu_link ()
64- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Main Menu" )
66+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Main Menu" )
6567
6668
6769# Failsafe Reports
@@ -77,7 +79,7 @@ def test_failsafe_reports_date_report_last_requested(page: Page) -> None:
7779 ReportsPage (page ).go_to_date_report_last_requested_page ()
7880
7981 # Verify 'Date Report Last Requested' is the page title
80- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Date Report Last Requested" )
82+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Date Report Last Requested" )
8183
8284 # Click 'generate report' button
8385 ReportsPage (page ).click_generate_report_button ()
@@ -93,6 +95,7 @@ def test_failsafe_reports_date_report_last_requested(page: Page) -> None:
9395 expect (page .locator ("b" )).to_contain_text (report_timestamp )
9496
9597
98+ @pytest .mark .only
9699def test_failsafe_reports_screening_subjects_with_inactive_open_episode (page : Page ) -> None :
97100 """
98101 Confirms 'screening_subjects_with_inactive_open_episode' page loads, 'generate report' button works as expected
@@ -107,7 +110,7 @@ def test_failsafe_reports_screening_subjects_with_inactive_open_episode(page: Pa
107110 ReportsPage (page ).go_to_screening_subjects_with_inactive_open_episode_link_page ()
108111
109112 # Verify "Screening Subjects With Inactive Open Episode" is the page title
110- expect (page . locator ( "#page-title" )). to_contain_text ("Screening Subjects With Inactive Open Episode" )
113+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Screening Subjects With Inactive Open Episode" )
111114
112115 # Click 'Generate Report' button
113116 ReportsPage (page ).click_generate_report_button ()
@@ -116,7 +119,7 @@ def test_failsafe_reports_screening_subjects_with_inactive_open_episode(page: Pa
116119 nhs_number_link .click ()
117120
118121 # Verify "Subject Screening Summary" is the page title
119- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Subject Screening Summary" )
122+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Subject Screening Summary" )
120123
121124
122125def test_failsafe_reports_subjects_ceased_due_to_date_of_birth_changes (page : Page ) -> None :
@@ -151,7 +154,7 @@ def test_failsafe_reports_subjects_ceased_due_to_date_of_birth_changes(page: Pag
151154 nhs_number_link .click ()
152155
153156 # Verify page title is "Subject Demographic"
154- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Subject Demographic" )
157+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Subject Demographic" )
155158
156159
157160def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundaries (page : Page ) -> None :
@@ -173,7 +176,7 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundarie
173176 ReportsPage (page ).go_to_allocate_sc_for_patient_movements_within_hub_boundaries_page ()
174177
175178 # Verify page title is "Allocate SC for Patient Movements within Hub Boundaries"
176- BasePage (page ).bowel_cancer_screening_page_title_contains_text (
179+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text (
177180 "Allocate SC for Patient Movements within Hub Boundaries" )
178181
179182 # Click "Generate Report"
@@ -187,7 +190,7 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundarie
187190 nhs_number_link .click ()
188191
189192 # Verify page title is "Set Patient's Screening Centre"
190- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Set Patient's Screening Centre" )
193+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Set Patient's Screening Centre" )
191194
192195 # Select another screening centre
193196 page .locator ("#cboScreeningCentre" ).select_option (coventry_and_warwickshire_bcs_centre )
@@ -212,7 +215,8 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_into_your_hub(page:
212215 ReportsPage (page ).go_to_allocate_sc_for_patient_movements_into_your_hub_page ()
213216
214217 # Verify page title is "Date Report Last Requested"
215- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Allocate SC for Patient Movements into your Hub" )
218+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text (
219+ "Allocate SC for Patient Movements into your Hub" )
216220
217221 # Click "Generate Report" button
218222 ReportsPage (page ).click_generate_report_button ()
@@ -247,7 +251,7 @@ def test_failsafe_reports_identify_and_link_new_gp(page: Page) -> None:
247251 ReportsPage (page ).go_to_identify_and_link_new_gp_page ()
248252
249253 # Verify page title is "Identify and link new GP practices"
250- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Identify and link new GP practices" )
254+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Identify and link new GP practices" )
251255
252256 # Click on "Generate Report"
253257 ReportsPage (page ).click_generate_report_button ()
@@ -267,7 +271,7 @@ def test_failsafe_reports_identify_and_link_new_gp(page: Page) -> None:
267271 nhs_number_link .click ()
268272
269273 # Verify page title is "Link GP practice to Screening Centre"
270- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Link GP practice to Screening Centre" )
274+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Link GP practice to Screening Centre" )
271275
272276
273277# Operational Reports
@@ -290,7 +294,7 @@ def test_operational_reports_appointment_attendance_not_updated(page: Page) -> N
290294 ReportsPage (page ).go_to_appointment_attendance_not_updated_page ()
291295
292296 # Verify page title is "Appointment Attendance Not Updated"
293- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Appointment Attendance Not Updated" )
297+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Appointment Attendance Not Updated" )
294298
295299 # Select a screening centre from the drop-down options
296300 page .get_by_label ("Screening Centre" ).select_option (coventry_and_warwickshire_bcs_centre )
@@ -306,7 +310,7 @@ def test_operational_reports_appointment_attendance_not_updated(page: Page) -> N
306310 nhs_number_link .click ()
307311
308312 # Verify the page title is "Appointment Detail"
309- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Appointment Detail" )
313+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Appointment Detail" )
310314
311315
312316def test_operational_reports_fobt_kits_logged_but_not_read (page : Page ) -> None :
@@ -322,7 +326,7 @@ def test_operational_reports_fobt_kits_logged_but_not_read(page: Page) -> None:
322326 ReportsPage (page ).go_to_fobt_kits_logged_but_not_read_page ()
323327
324328 # Verify page title is "FOBT Kits Logged but Not Read - Summary View"
325- expect (page . locator ( "#page-title" )). to_contain_text ("FOBT Kits Logged but Not Read - Summary View" )
329+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("FOBT Kits Logged but Not Read - Summary View" )
326330
327331 # Click refresh button
328332 ReportsPage (page ).click_refresh_button ()
@@ -345,7 +349,7 @@ def test_operational_reports_demographic_update_inconsistent_with_manual_update(
345349 ReportsPage (page ).go_to_demographic_update_inconsistent_with_manual_update_page ()
346350
347351 # Verify page title is "Demographic Update Inconsistent With Manual Update"
348- expect (page . locator ( "#page-title" )). to_contain_text ("Demographic Update Inconsistent With Manual Update" )
352+ BasePage (page ). bowel_cancer_screening_page_title_contains_text ("Demographic Update Inconsistent With Manual Update" )
349353
350354
351355def test_operational_reports_screening_practitioner_6_weeks_availability_not_set_up (page : Page ) -> None :
@@ -365,7 +369,7 @@ def test_operational_reports_screening_practitioner_6_weeks_availability_not_set
365369 ReportsPage (page ).go_to_screening_practitioner_6_weeks_availability_not_set_up_report_page ()
366370
367371 # Verify page title is "Screening Practitioner 6 Weeks Availability Not Set Up"
368- BasePage (page ).bowel_cancer_screening_page_title_contains_text (
372+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text (
369373 "Screening Practitioner 6 Weeks Availability Not Set Up" )
370374
371375 # Select a screening centre
@@ -396,6 +400,7 @@ def test_operational_reports_screening_practitioner_appointments(page: Page) ->
396400
397401 coventry_and_warwickshire_bcs_centre = "23643"
398402 screening_practitioner_named_another_stubble = "1982"
403+ generate_report_button = page .locator ("#submitThisForm" ) #The locator appears to be unique to this button
399404
400405 # Go to operational reports page
401406 ReportsPage (page ).go_to_operational_reports_page ()
@@ -404,7 +409,7 @@ def test_operational_reports_screening_practitioner_appointments(page: Page) ->
404409 ReportsPage (page ).go_to_screening_practitioner_appointments_page ()
405410
406411 # Verify page title is "Screening Practitioner Appointments"
407- BasePage (page ).bowel_cancer_screening_page_title_contains_text ("Screening Practitioner Appointments" )
412+ BasePage (page ).bowel_cancer_screening_ntsh_page_title_contains_text ("Screening Practitioner Appointments" )
408413
409414 # Select a screening centre
410415 page .get_by_label ("Screening Centre" ).select_option (coventry_and_warwickshire_bcs_centre )
@@ -413,7 +418,7 @@ def test_operational_reports_screening_practitioner_appointments(page: Page) ->
413418 page .locator ("#A_C_NURSE" ).select_option (screening_practitioner_named_another_stubble )
414419
415420 # Click "Generate Report"
416- click (page , page . locator ( "#submitThisForm" ) )
421+ generate_report_button . click ()
417422
418423 # Verify timestamp has updated to current date and time
419424 report_timestamp = DateTimeUtils .screening_practitioner_appointments_report_timestamp_date_format ()
0 commit comments