|
1 | | -import logging |
2 | 1 | import pytest |
3 | 2 | from playwright.sync_api import Page, expect |
4 | 3 | from pages.logout.log_out_page import Logout |
|
12 | 11 | from pages.screening_practitioner_appointments.practitioner_availability_page import ( |
13 | 12 | PractitionerAvailabilityPage, |
14 | 13 | ) |
| 14 | +from pages.screening_practitioner_appointments.colonoscopy_assessment_appointments_page import ( |
| 15 | + ColonoscopyAssessmentAppointments, |
| 16 | +) |
| 17 | +from pages.screening_practitioner_appointments.book_appointment_page import ( |
| 18 | + BookAppointmentPage, |
| 19 | +) |
15 | 20 | from utils.user_tools import UserTools |
16 | 21 | from utils.load_properties_file import PropertiesFile |
17 | 22 | from utils.calendar_picker import CalendarPicker |
@@ -66,34 +71,35 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None: |
66 | 71 | CalendarPicker(page).select_day( |
67 | 72 | datetime.today() |
68 | 73 | ) # This will make it so that we can only run this test once a day, or we need to restore the DB back to the snapshot |
69 | | - page.get_by_role("button", name="Show").dblclick() |
70 | | - page.get_by_role("textbox", name="From:").click() |
71 | | - page.get_by_role("textbox", name="From:").fill("09:00") |
72 | | - page.get_by_role("textbox", name="To:").click() |
73 | | - page.get_by_role("textbox", name="To:").fill("17:15") |
74 | | - page.get_by_role("button", name="Calculate Slots").click() |
75 | | - page.locator("#FOR_WEEKS").click() |
76 | | - page.locator("#FOR_WEEKS").fill("6") |
77 | | - page.locator("#FOR_WEEKS").press("Enter") |
78 | | - page.get_by_role("button", name="Save").click() |
79 | | - expect(page.get_by_text("Slots Updated for 6 Weeks")).to_be_visible() |
| 74 | + PractitionerAvailabilityPage(page).click_show_button() |
| 75 | + PractitionerAvailabilityPage(page).enter_start_time("09:00") |
| 76 | + PractitionerAvailabilityPage(page).enter_end_time("17:15") |
| 77 | + PractitionerAvailabilityPage(page).click_calculate_slots_button() |
| 78 | + PractitionerAvailabilityPage(page).enter_number_of_weeks("6") |
| 79 | + PractitionerAvailabilityPage(page).click_save_button() |
| 80 | + PractitionerAvailabilityPage(page).slots_updated_message_is_displayed( |
| 81 | + "Slots Updated for 6 Weeks" |
| 82 | + ) |
80 | 83 | Logout(page).log_out(close_page=False) |
81 | 84 |
|
82 | | - page.get_by_role("button", name="Log in").click() |
| 85 | + ScreeningPractitionerAppointmentsPage(page).go_to_log_in_page() |
83 | 86 | UserTools.user_login(page, "Hub Manager State Registered at BCS01") |
84 | 87 | BasePage(page).go_to_screening_practitioner_appointments_page() |
85 | | - page.get_by_role("link", name="Patients that Require").click() |
| 88 | + ScreeningPractitionerAppointmentsPage(page).go_to_patients_that_require_page() |
86 | 89 | # Add for loop to loop x times (depends on how many we want to run it for) 70 - 79 |
87 | | - page.locator("#nhsNumberFilter").click() |
88 | | - page.locator("#nhsNumberFilter").fill("9991406131") |
89 | | - page.locator("#nhsNumberFilter").press("Enter") |
90 | | - page.get_by_role("link", name="999 140 6131").click() |
91 | | - page.get_by_label("Screening Centre ( All)").select_option("23162") |
92 | | - page.locator("#UI_NEW_SITE").select_option("42808") |
93 | | - page.locator('input[name="fri2"]').click() # Todays date if available |
94 | | - page.locator("#UI_NEW_SLOT_SELECTION_ID_359119").check() |
95 | | - page.get_by_role("button", name="Save").click() |
96 | | - expect(page.get_by_text("Appointment booked")).to_be_visible() |
| 90 | + ColonoscopyAssessmentAppointments(page).filter_by_nhs_number("976 475 5232") |
| 91 | + ColonoscopyAssessmentAppointments(page).click_nhs_number_link("976 475 5232") |
| 92 | + BookAppointmentPage(page).select_screening_centre_dropdown_option( |
| 93 | + "BCS001 - Wolverhampton Bowel Cancer Screening Centre" |
| 94 | + ) |
| 95 | + BookAppointmentPage(page).select_site_dropdown_option("Holly Hall Clinic (? km)") |
| 96 | + BookAppointmentPage(page).choose_day_with_available_slots() |
| 97 | + # page.locator("#UI_NEW_SLOT_SELECTION_ID_359119").check() |
| 98 | + BookAppointmentPage(page).choose_appointment_time() |
| 99 | + BookAppointmentPage(page).click_save_button() |
| 100 | + BookAppointmentPage(page).appointment_booked_confirmation_is_displayed( |
| 101 | + "Appointment booked" |
| 102 | + ) |
97 | 103 |
|
98 | 104 | batch_processing( |
99 | 105 | page, |
|
0 commit comments