22from playwright .sync_api import Page , expect
33from utils .user_tools import UserTools
44from pages .base_page import BasePage
5+ from pages .alerts .alerts_page import AlertsPage
6+ from pages .gfobt_test_kits .gfobt_test_kits_page import GFOBTTestKitsPage
57from utils .screening_subject_page_searcher import search_subject_by_forename , search_subject_by_surname
6-
8+ from pages .screening_practitioner_appointments .screening_practitioner_appointments_page import ScreeningPractitionerAppointmentsPage
9+ from pages .screening_subject_search .subject_search_page import SubjectSearchPage
10+ from pages .organisations .organisations_page import OrganisationsPage
711
812# Scenario 1
13+ @pytest .mark .wip
914@pytest .mark .regression
1015@pytest .mark .hub_user_tests
1116def test_hub_user_alerts_populated (page : Page ) -> None :
@@ -18,10 +23,12 @@ def test_hub_user_alerts_populated(page: Page) -> None:
1823 BasePage (page ).click_refresh_alerts_link ()
1924
2025 # Step 2: Assert the refresh alerts button is visible
21- page .get_by_role ("link" , name = "Refresh alerts" ).click ()
22- expect (page .get_by_role ("link" , name = "Refresh alerts" )).to_be_visible (timeout = 5000 )
26+ alerts_page = AlertsPage (page )
27+ alerts_page .click_refresh_alerts ()
28+ expect (alerts_page .refresh_alerts_link ).to_be_visible (timeout = 5000 )
2329
2430# Scenario 2
31+ @pytest .mark .wip
2532@pytest .mark .regression
2633@pytest .mark .hub_user_tests
2734def test_hub_user_kits_logged_not_read_report (page : Page ) -> None :
@@ -34,10 +41,12 @@ def test_hub_user_kits_logged_not_read_report(page: Page) -> None:
3441 BasePage (page ).go_to_gfobt_test_kits_page ()
3542
3643 # Step 2: Assert the Kits Logged Not Read report loads as expected
37- page .get_by_text ("gFOBT Test Kits" ).click ()
38- expect (page .get_by_text ("gFOBT Test Kits" )).to_be_visible (timeout = 5000 )
44+ test_kits_page = GFOBTTestKitsPage (page )
45+ test_kits_page .open_test_kits_report ()
46+ expect (test_kits_page .test_kits_header ).to_be_visible (timeout = 5000 )
3947
4048# Scenario 3
49+ @pytest .mark .wip
4150@pytest .mark .regression
4251@pytest .mark .hub_user_tests
4352def test_hub_user_people_requiring_colonoscopy_assessment_report (page : Page ) -> None :
@@ -50,10 +59,12 @@ def test_hub_user_people_requiring_colonoscopy_assessment_report(page: Page) ->
5059 BasePage (page ).go_to_screening_practitioner_appointments_page ()
5160
5261 # Step 2: Assert the People Requiring Colonoscopy Assessment report loads as expected
53- page .get_by_text ("Screening Practitioner Appointments" ).click ()
54- expect (page .get_by_text ("Screening Practitioner Appointments" )).to_be_visible (timeout = 5000 )
62+ appointments_page = ScreeningPractitionerAppointmentsPage (page )
63+ appointments_page .open_appointments_report ()
64+ expect (appointments_page .appointments_header ).to_be_visible (timeout = 5000 )
5565
5666# Scenario 4
67+ @pytest .mark .wip
5768@pytest .mark .regression
5869@pytest .mark .hub_user_tests
5970def test_screening_centre_user_subject_search_and_summary (page : Page ) -> None :
@@ -65,21 +76,13 @@ def test_screening_centre_user_subject_search_and_summary(page: Page) -> None:
6576 UserTools .user_login (page , "Screening Centre Manager at BCS001" )
6677 BasePage (page ).go_to_screening_subject_search_page ()
6778
68- # Step 2: Add value "A*" to the "Surname" & "Forename" with ScreeningStatus as "Recall" and EpisodeStatus as "Closed"
69- # Click search button on the subject search criteria page
70- search_subject_by_surname (page , "A*" )
71- page .get_by_role ("link" , name = "Back" , exact = True ).click ()
72- search_subject_by_forename (page , "A*" )
73- page .get_by_role ("link" , name = "Back" , exact = True ).click ()
74- page .locator ("#A_C_ScreeningStatus" ).select_option ("4004" )
75- page .locator ("#A_C_ScreeningStatus" ).click ()
76- page .get_by_role ("button" , name = "Search" ).click ()
77- page .get_by_role ("link" , name = "Back" , exact = True ).click ()
78- page .locator ("#A_C_EpisodeStatus" ).select_option ("2" )
79- page .get_by_role ("button" , name = "Search" ).click ()
80- page .get_by_role ("link" , name = "Back" , exact = True ).click ()
79+ # Step 2: Use POM for subject search
80+ search_page = SubjectSearchPage (page )
81+ """screening_status=4004 value represents 'Recall' & episode_status=2 value represents 'Closed'"""
82+ search_page .search_subject (surname = "A*" , forename = "A*" , screening_status = "4004" , episode_status = "2" )
8183
8284# Scenario 5
85+ @pytest .mark .wip
8386@pytest .mark .regression
8487@pytest .mark .hub_user_tests
8588def test_screening_centre_user_subject_search_and_surveillance (page : Page ) -> None :
@@ -91,14 +94,7 @@ def test_screening_centre_user_subject_search_and_surveillance(page: Page) -> No
9194 UserTools .user_login (page , "Screening Centre Manager at BCS001" )
9295 BasePage (page ).go_to_organisations_page ()
9396
94- page .get_by_role ("link" , name = "Organisation and Site Details" ).click ()
95- page .get_by_role ("link" , name = "List All Organisations" ).click ()
96- page .get_by_role ("link" , name = "Back" , exact = True ).click ()
97- page .get_by_role ("link" , name = "List All Sites" ).click ()
98- [page .get_by_role ("link" , name = "Back" , exact = True ).click () for _ in range (3 )]
99- page .get_by_role ("link" , name = "Surveillance" , exact = True ).click ()
100- page .get_by_role ("link" , name = "Manage Surveillance Review" ).click ()
101-
102- # Step 2: Assert the Surveillance Review Summary report loads as expected
103- page .goto ("https://bcss-bcss-18680-ddc-bcss.k8s-nonprod.texasplatform.uk/surveillance/review/summary" )
104- expect (page .get_by_text ("Surveillance Review Summary" )).to_be_visible (timeout = 5000 )
97+ # Step 2: Use POM for navigation and assertion
98+ org_page = OrganisationsPage (page )
99+ org_page .navigate_to_surveillance_review_summary ()
100+ expect (org_page .surveillance_review_summary_header ).to_be_visible (timeout = 5000 )
0 commit comments