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
@@ -46,42 +66,48 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:
4666
4767 UserTools .user_login (page , "Screening Centre Manager at BCS001" )
4868 BasePage (page ).go_to_screening_practitioner_appointments_page ()
49- page .get_by_role ("link" , name = "Set Availability" ).click ()
50- page .get_by_role ("link" , name = "Practitioner Availability -" ).click ()
51- page .locator ("#UI_SITE_ID" ).select_option (index = 1 )
52- page .locator ("#UI_PRACTITIONER_ID" ).select_option (index = 1 )
53- page .get_by_role ("button" , name = "Calendar" ).click ()
69+ ScreeningPractitionerAppointmentsPage (page ).go_to_set_availability_page ()
70+ SetAvailabilityPage (page ).go_to_practitioner_availability_page ()
71+ PractitionerAvailabilityPage (page ).select_site_dropdown_option (
72+ "THE ROYAL HOSPITAL (WOLVERHAMPTON)"
73+ )
74+ PractitionerAvailabilityPage (page ).select_practitioner_dropdown_option (
75+ "Astonish, Ethanol"
76+ )
77+ PractitionerAvailabilityPage (page ).click_calendar_button ()
5478 CalendarPicker (page ).select_day (
5579 datetime .today ()
5680 ) # 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
57- page .get_by_role ("button" , name = "Show" ).dblclick ()
58- page .get_by_role ("textbox" , name = "From:" ).click ()
59- page .get_by_role ("textbox" , name = "From:" ).fill ("09:00" )
60- page .get_by_role ("textbox" , name = "To:" ).click ()
61- page .get_by_role ("textbox" , name = "To:" ).fill ("17:15" )
62- page .get_by_role ("button" , name = "Calculate Slots" ).click ()
63- page .locator ("#FOR_WEEKS" ).click ()
64- page .locator ("#FOR_WEEKS" ).fill ("6" )
65- page .locator ("#FOR_WEEKS" ).press ("Enter" )
66- page .get_by_role ("button" , name = "Save" ).click ()
67- expect (page .get_by_text ("Slots Updated for 6 Weeks" )).to_be_visible ()
68- Logout (page ).log_out ()
81+ PractitionerAvailabilityPage (page ).click_show_button ()
82+ PractitionerAvailabilityPage (page ).enter_start_time ("09:00" )
83+ PractitionerAvailabilityPage (page ).enter_end_time ("17:15" )
84+ PractitionerAvailabilityPage (page ).click_calculate_slots_button ()
85+ PractitionerAvailabilityPage (page ).enter_number_of_weeks ("6" )
86+ PractitionerAvailabilityPage (page ).click_save_button ()
87+ PractitionerAvailabilityPage (page ).slots_updated_message_is_displayed (
88+ "Slots Updated for 6 Weeks"
89+ )
90+ Logout (page ).log_out (close_page = False )
6991
70- page . get_by_role ( "button" , name = "Log in" ). click ()
92+ ScreeningPractitionerAppointmentsPage ( page ). go_to_log_in_page ()
7193 UserTools .user_login (page , "Hub Manager State Registered at BCS01" )
7294 BasePage (page ).go_to_screening_practitioner_appointments_page ()
73- page . get_by_role ( "link" , name = "Patients that Require" ). click ()
95+ ScreeningPractitionerAppointmentsPage ( page ). go_to_patients_that_require_page ()
7496 # Add for loop to loop x times (depends on how many we want to run it for) 70 - 79
75- page .locator ("#nhsNumberFilter" ).click ()
76- page .locator ("#nhsNumberFilter" ).fill ("9991406131" )
77- page .locator ("#nhsNumberFilter" ).press ("Enter" )
78- page .get_by_role ("link" , name = "999 140 6131" ).click ()
79- page .get_by_label ("Screening Centre ( All)" ).select_option ("23162" )
80- page .locator ("#UI_NEW_SITE" ).select_option ("42808" )
81- page .locator ('input[name="fri2"]' ).click () # Todays date if available
82- page .locator ("#UI_NEW_SLOT_SELECTION_ID_359119" ).check ()
83- page .get_by_role ("button" , name = "Save" ).click ()
84- expect (page .get_by_text ("Appointment booked" )).to_be_visible ()
97+ ColonoscopyAssessmentAppointments (page ).filter_by_nhs_number ("999 205 6339" )
98+ ColonoscopyAssessmentAppointments (page ).click_nhs_number_link ("999 205 6339" )
99+ BookAppointmentPage (page ).select_screening_centre_dropdown_option (
100+ "BCS001 - Wolverhampton Bowel Cancer Screening Centre"
101+ )
102+ BookAppointmentPage (page ).select_site_dropdown_option ("Holly Hall Clinic (? km)" )
103+ BookAppointmentPage (page ).choose_day_with_available_slots ()
104+ # page.locator("#UI_NEW_SLOT_SELECTION_ID_359119").check()
105+ # Will be revisited as part of Utilities update
106+ BookAppointmentPage (page ).choose_appointment_time ()
107+ BookAppointmentPage (page ).click_save_button ()
108+ BookAppointmentPage (page ).appointment_booked_confirmation_is_displayed (
109+ "Appointment booked"
110+ )
85111
86112 batch_processing (
87113 page ,
@@ -96,9 +122,10 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:
96122 "GP Result (Abnormal)" ,
97123 "A25 - 1st Colonoscopy Assessment Appointment Booked, letter sent" ,
98124 )
99- page .locator ("#ID_LINK_EPISODES_img" ).click ()
100- page .get_by_role ("link" , name = "FOBT Screening" ).click ()
101- expect (
102- page .get_by_role ("cell" , name = "A167 - GP Abnormal FOBT Result Sent" , exact = True )
103- ).to_be_visible ()
125+
126+ SubjectScreeningSummary (page ).expand_episodes_list ()
127+ SubjectScreeningSummary (page ).click_first_fobt_episode_link ()
128+ EpisodeEventsAndNotesPage (page ).expected_episode_event_is_displayed (
129+ "A167 - GP Abnormal FOBT Result Sent"
130+ )
104131 Logout (page ).log_out ()
0 commit comments