|
| 1 | +import pytest |
| 2 | +from playwright.sync_api import Page, expect |
| 3 | +from utils.user_tools import UserTools |
| 4 | +from pages.base_page import BasePage |
| 5 | +from utils.screening_subject_page_searcher import search_subject_by_forename, search_subject_by_surname |
| 6 | + |
| 7 | + |
| 8 | +# Scenario 1 |
| 9 | +@pytest.mark.regression |
| 10 | +@pytest.mark.hub_user_tests |
| 11 | +def test_hub_user_alerts_populated(page: Page) -> None: |
| 12 | + """ |
| 13 | + Scenario: Hub User - Alerts populated |
| 14 | + This test ensures that the alerts have at least been populated for the user within a reasonable amount of time. |
| 15 | + """ |
| 16 | + # Step 1: Log in as Hub Manager - State Registered (England) |
| 17 | + UserTools.user_login(page, "Hub Manager State Registered at BCS01") |
| 18 | + BasePage(page).click_refresh_alerts_link() |
| 19 | + |
| 20 | + # 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) |
| 23 | + |
| 24 | +# Scenario 2 |
| 25 | +@pytest.mark.regression |
| 26 | +@pytest.mark.hub_user_tests |
| 27 | +def test_hub_user_kits_logged_not_read_report(page: Page) -> None: |
| 28 | + """ |
| 29 | + Scenario: Hub User - Kits Logged Not Read report |
| 30 | + This test ensures that if available, the Kits Logged Not Read report loads within a reasonable amount of time. |
| 31 | + """ |
| 32 | + # Step 1: Log in as Hub Manager - State Registered (England) |
| 33 | + UserTools.user_login(page, "Hub Manager State Registered at BCS01") |
| 34 | + BasePage(page).go_to_gfobt_test_kits_page() |
| 35 | + |
| 36 | + # 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) |
| 39 | + |
| 40 | +# Scenario 3 |
| 41 | +@pytest.mark.regression |
| 42 | +@pytest.mark.hub_user_tests |
| 43 | +def test_hub_user_people_requiring_colonoscopy_assessment_report(page: Page) -> None: |
| 44 | + """ |
| 45 | + Scenario: Hub User - People Requiring Colonoscopy Assessment report |
| 46 | + This test ensures that if available, the People Requiring Colonoscopy Assessment report loads within a reasonable amount of time. |
| 47 | + """ |
| 48 | + # Step 1: Log in as Hub Manager - State Registered (England) |
| 49 | + UserTools.user_login(page, "Hub Manager State Registered at BCS01") |
| 50 | + BasePage(page).go_to_screening_practitioner_appointments_page() |
| 51 | + |
| 52 | + # 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) |
| 55 | + |
| 56 | +# Scenario 4 |
| 57 | +@pytest.mark.regression |
| 58 | +@pytest.mark.hub_user_tests |
| 59 | +def test_screening_centre_user_subject_search_and_summary(page: Page) -> None: |
| 60 | + """ |
| 61 | + Scenario: Screening Centre User - Subject Search & Subject Summary |
| 62 | + This test ensures that the subject search works as expected and the subject summary loads and displays data correctly |
| 63 | + """ |
| 64 | + # Step 1: Log in as Screening Centre Manager (England) |
| 65 | + UserTools.user_login(page, "Screening Centre Manager at BCS001") |
| 66 | + BasePage(page).go_to_screening_subject_search_page() |
| 67 | + |
| 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() |
| 81 | + |
| 82 | +# Scenario 5 |
| 83 | +@pytest.mark.regression |
| 84 | +@pytest.mark.hub_user_tests |
| 85 | +def test_screening_centre_user_subject_search_and_surveillance(page: Page) -> None: |
| 86 | + """ |
| 87 | + Scenario: Screening Centre User - Organisation Search & Surveillance Review Summary |
| 88 | + This test ensures that the organisation search works as expected and the surveillance review summary loads and displays data correctly |
| 89 | + """ |
| 90 | + # Step 1: Log in as Screening Centre Manager (England) |
| 91 | + UserTools.user_login(page, "Screening Centre Manager at BCS001") |
| 92 | + BasePage(page).go_to_organisations_page() |
| 93 | + |
| 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) |
0 commit comments