1- import logging
21import pytest
3- from playwright .sync_api import Page , expect
2+ from playwright .sync_api import Page
43from pages .logout .log_out_page import Logout
54from pages .base_page import BasePage
5+ from pages .screening_practitioner_appointments .screening_practitioner_appointments import (
6+ ScreeningPractitionerAppointmentsPage ,
7+ )
8+ from pages .screening_practitioner_appointments .set_availability_page import (
9+ SetAvailabilityPage ,
10+ )
11+ from pages .screening_practitioner_appointments .practitioner_availability_page import (
12+ PractitionerAvailabilityPage ,
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+ )
20+ from pages .screening_subject_search .subject_screening_summary import (
21+ SubjectScreeningSummary ,
22+ )
23+ from pages .screening_subject_search .episode_events_and_notes_page import (
24+ EpisodeEventsAndNotesPage ,
25+ )
626from utils .user_tools import UserTools
727from utils .load_properties_file import PropertiesFile
828from utils .calendar_picker import CalendarPicker
@@ -36,44 +56,50 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:
3656
3757 UserTools .user_login (page , "Screening Centre Manager at BCS001" )
3858 BasePage (page ).go_to_screening_practitioner_appointments_page ()
39- page .get_by_role ("link" , name = "Set Availability" ).click ()
40- page .get_by_role ("link" , name = "Practitioner Availability -" ).click ()
41- page .locator ("#UI_SITE_ID" ).select_option (index = 1 )
42- page .locator ("#UI_PRACTITIONER_ID" ).select_option (index = 1 )
43- page .get_by_role ("button" , name = "Calendar" ).click ()
59+ ScreeningPractitionerAppointmentsPage (page ).go_to_set_availability_page ()
60+ SetAvailabilityPage (page ).go_to_practitioner_availability_page ()
61+ PractitionerAvailabilityPage (page ).select_site_dropdown_option (
62+ "THE ROYAL HOSPITAL (WOLVERHAMPTON)"
63+ )
64+ PractitionerAvailabilityPage (page ).select_practitioner_dropdown_option (
65+ "Astonish, Ethanol"
66+ )
67+ PractitionerAvailabilityPage (page ).click_calendar_button ()
4468 CalendarPicker (page ).select_day (
4569 datetime .today ()
4670 ) # 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
47- page .get_by_role ("button" , name = "Show" ).dblclick ()
48- page .get_by_role ("textbox" , name = "From:" ).click ()
49- page .get_by_role ("textbox" , name = "From:" ).fill ("09:00" )
50- page .get_by_role ("textbox" , name = "To:" ).click ()
51- page .get_by_role ("textbox" , name = "To:" ).fill ("17:15" )
52- page .get_by_role ("button" , name = "Calculate Slots" ).click ()
53- page .locator ("#FOR_WEEKS" ).click ()
54- page .locator ("#FOR_WEEKS" ).fill ("6" )
55- page .locator ("#FOR_WEEKS" ).press ("Enter" )
56- page .get_by_role ("button" , name = "Save" ).click ()
57- expect (page .get_by_text ("Slots Updated for 6 Weeks" )).to_be_visible ()
58- Logout (page ).log_out ()
71+ PractitionerAvailabilityPage (page ).click_show_button ()
72+ PractitionerAvailabilityPage (page ).enter_start_time ("09:00" )
73+ PractitionerAvailabilityPage (page ).enter_end_time ("17:15" )
74+ PractitionerAvailabilityPage (page ).click_calculate_slots_button ()
75+ PractitionerAvailabilityPage (page ).enter_number_of_weeks ("6" )
76+ PractitionerAvailabilityPage (page ).click_save_button ()
77+ PractitionerAvailabilityPage (page ).slots_updated_message_is_displayed (
78+ "Slots Updated for 6 Weeks"
79+ )
80+ Logout (page ).log_out (close_page = False )
5981
60- page . get_by_role ( "button" , name = "Log in" ). click ()
82+ ScreeningPractitionerAppointmentsPage ( page ). go_to_log_in_page ()
6183 UserTools .user_login (page , "Hub Manager State Registered at BCS01" )
6284 BasePage (page ).go_to_screening_practitioner_appointments_page ()
63- page . get_by_role ( "link" , name = "Patients that Require" ). click ()
85+ ScreeningPractitionerAppointmentsPage ( page ). go_to_patients_that_require_page ()
6486 # Add for loop to loop x times (depends on how many we want to run it for) 70 - 79
6587 nhs_number = subjects_df ["subject_nhs_number" ].iloc [0 ]
6688 nhs_number_spaced = NHSNumberTools ().spaced_nhs_number (nhs_number )
67- page .locator ("#nhsNumberFilter" ).click ()
68- page .locator ("#nhsNumberFilter" ).fill (nhs_number )
69- page .locator ("#nhsNumberFilter" ).press ("Enter" )
70- page .get_by_role ("link" , name = nhs_number_spaced ).click ()
71- page .get_by_label ("Screening Centre ( All)" ).select_option ("23162" )
72- page .locator ("#UI_NEW_SITE" ).select_option ("42808" )
73- page .locator ('input[name="fri2"]' ).click () # Todays date if available
74- page .locator ("#UI_NEW_SLOT_SELECTION_ID_359119" ).check ()
75- page .get_by_role ("button" , name = "Save" ).click ()
76- expect (page .get_by_text ("Appointment booked" )).to_be_visible ()
89+ ColonoscopyAssessmentAppointments (page ).filter_by_nhs_number (nhs_number )
90+ ColonoscopyAssessmentAppointments (page ).click_nhs_number_link (nhs_number_spaced )
91+ BookAppointmentPage (page ).select_screening_centre_dropdown_option (
92+ "BCS001 - Wolverhampton Bowel Cancer Screening Centre"
93+ )
94+ BookAppointmentPage (page ).select_site_dropdown_option ("Holly Hall Clinic (? km)" )
95+ BookAppointmentPage (page ).choose_day_with_available_slots ()
96+ BookAppointmentPage (page ).appointments_table .click_first_input_in_column (
97+ "Appt/Slot Time"
98+ )
99+ BookAppointmentPage (page ).click_save_button ()
100+ BookAppointmentPage (page ).appointment_booked_confirmation_is_displayed (
101+ "Appointment booked"
102+ )
77103
78104 batch_processing (
79105 page ,
@@ -88,9 +114,10 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:
88114 "GP Result (Abnormal)" ,
89115 "A25 - 1st Colonoscopy Assessment Appointment Booked, letter sent" ,
90116 )
91- page .locator ("#ID_LINK_EPISODES_img" ).click ()
92- page .get_by_role ("link" , name = "FOBT Screening" ).click ()
93- expect (
94- page .get_by_role ("cell" , name = "A167 - GP Abnormal FOBT Result Sent" , exact = True )
95- ).to_be_visible ()
117+
118+ SubjectScreeningSummary (page ).expand_episodes_list ()
119+ SubjectScreeningSummary (page ).click_first_fobt_episode_link ()
120+ EpisodeEventsAndNotesPage (page ).expected_episode_event_is_displayed (
121+ "A167 - GP Abnormal FOBT Result Sent"
122+ )
96123 Logout (page ).log_out ()
0 commit comments