Skip to content

Commit 53dcd3a

Browse files
Merge remote-tracking branch 'origin/main' into feature/BCSS-20351-poc-test-runner-workflow
2 parents 3ded9da + 870ac35 commit 53dcd3a

File tree

2 files changed

+184
-0
lines changed

2 files changed

+184
-0
lines changed

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ markers =
3333
compartment2: only for compartment 2
3434
compartment3: only for compartment 3
3535
compartment4: only for compartment 4
36+
compartment5: only for compartment 5
3637
compartment1_plan_creation: to run the plan creation for compartment 1
3738
vpn_required: for tests that require a VPN connection
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
import pytest
2+
from playwright.sync_api import Page, expect
3+
from pages.logout.log_out_page import Logout
4+
from pages.base_page import BasePage
5+
from pages.screening_practitioner_appointments.screening_practitioner_appointments import (
6+
ScreeningPractitionerAppointmentsPage,
7+
)
8+
from pages.screening_subject_search.subject_screening_summary import (
9+
SubjectScreeningSummary,
10+
)
11+
from utils.user_tools import UserTools
12+
from utils.load_properties_file import PropertiesFile
13+
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
14+
from utils.calendar_picker import CalendarPicker
15+
from datetime import datetime, timedelta
16+
17+
18+
@pytest.fixture
19+
def smokescreen_properties() -> dict:
20+
return PropertiesFile().get_smokescreen_properties()
21+
22+
23+
@pytest.mark.vpn_required
24+
@pytest.mark.smokescreen
25+
@pytest.mark.compartment5
26+
def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
27+
"""
28+
This is the main compartment 5 method
29+
It involves marking the attendance of subjects to their screening practitioner appointments
30+
Then it invites them for colonoscopy
31+
Then it marks post investigation appointment as not required
32+
"""
33+
34+
# --------------
35+
# Attendance of Screening
36+
# Practitioner Clinic Appointment
37+
# --------------
38+
39+
# Log in as a Screening Centre user
40+
UserTools.user_login(page, "Screening Centre Manager at BCS001")
41+
42+
# From the Main Menu, choose the 'Screening Practitioner Appointments' and then 'View Appointments' option
43+
BasePage(page).go_to_screening_practitioner_appointments_page()
44+
ScreeningPractitionerAppointmentsPage(page).go_to_view_appointments_page()
45+
46+
# Select the Appointment Type, Site, Screening Practitioner and required date of the appointment and click 'View appointments on this day' button
47+
page.locator("#UI_APPOINTMENT_TYPE").select_option(label="Colonoscopy Assessment")
48+
page.locator("#UI_SCREENING_CENTRE").select_option(
49+
label="BCS001 - Wolverhampton Bowel Cancer Screening Centre"
50+
)
51+
page.locator("#UI_SITE").select_option(label="The Royal Hospital (Wolverhampton)")
52+
53+
page.get_by_role("button", name="View appointments on this day").click()
54+
page.get_by_role("button", name="Calendar").click()
55+
date_from_util = datetime(2025, 4, 28)
56+
CalendarPicker(page).v1_calender_picker(date_from_util)
57+
58+
# Select subject from inital test data util
59+
page.get_by_role("link", name="HAT-PIN UNTRUTH").click()
60+
61+
# Select Attendance radio button, tick Attended checkbox, set Attended Date to yesterday's (system) date and then press Save
62+
page.get_by_role("radio", name="Attendance").check()
63+
page.locator("#UI_ATTENDED").check()
64+
page.get_by_role("button", name="Calendar").click()
65+
CalendarPicker(page).v1_calender_picker(datetime.today() - timedelta(1))
66+
page.get_by_role("button", name="Save").click()
67+
expect(page.get_by_text("Record updated")).to_be_visible()
68+
69+
# Repeat for x Abnormal patients
70+
71+
# Navigate to the 'Subject Screening Summary' screen for the 1st Abnormal patient
72+
nhs_no = "9543076472" # Test NHS NO for Scaliding Cod
73+
verify_subject_event_status_by_nhs_no(
74+
page, nhs_no, "J10 - Attended Colonoscopy Assessment Appointment"
75+
)
76+
77+
# Click on 'Datasets' link
78+
page.get_by_role("link", name="Datasets").click()
79+
80+
# Click on 'Show Dataset' next to the Colonoscopy Assessment
81+
82+
# Populate Colonoscopy Assessment Details fields
83+
84+
# ASA Grade - I - Fit
85+
# Fit for Colonoscopy (SSP) - Yes
86+
87+
# Click 'Yes' for Dataset Complete?
88+
# Click Save Dataset button
89+
# Click Back
90+
page.get_by_role("link", name="Show Dataset").click()
91+
page.get_by_label("ASA Grade").select_option("17009")
92+
page.get_by_label("Fit for Colonoscopy (SSP)").select_option("17058")
93+
page.get_by_role("radio", name="Yes").check()
94+
page.locator("#UI_DIV_BUTTON_SAVE1").get_by_role(
95+
"button", name="Save Dataset"
96+
).click()
97+
BasePage(page).click_back_button()
98+
BasePage(page).click_back_button()
99+
# This brings you back to the subject screening summary page
100+
101+
# On the Subject Screening Summary click on the 'Advance FOBT Screening Episode' button and then click on the 'Suitable for Endoscopic Test' button
102+
# Click OK after message
103+
page.get_by_role("button", name="Advance FOBT Screening Episode").click()
104+
page.once("dialog", lambda dialog: dialog.accept())
105+
page.get_by_role("button", name="Suitable for Endoscopic Test").click()
106+
107+
# Enter a 'First Offered Appointment Date' (enter a date after the attended appt)
108+
page.get_by_role("button", name="Calendar").click()
109+
CalendarPicker(page).v1_calender_picker(datetime.today())
110+
111+
# Select 'Colonoscopy' from the 'Type of Test' from the drop down list
112+
page.locator("#UI_EXT_TEST_TYPE_2233").select_option(label="Colonoscopy")
113+
114+
# Click the 'Invite for Diagnostic Test >>' button
115+
# Click 'OK'
116+
page.once("dialog", lambda dialog: dialog.accept())
117+
page.get_by_role("button", name="Invite for Diagnostic Test >>").click()
118+
SubjectScreeningSummary(page).verify_latest_event_status_value(
119+
"A59 - Invited for Diagnostic Test"
120+
)
121+
122+
# Click 'Attend Diagnostic Test' button
123+
page.get_by_role("button", name="Attend Diagnostic Test").click()
124+
125+
# Select Colonoscopy from drop down list. Enter the actual appointment date as today's date and select 'Save'
126+
page.locator("#UI_CONFIRMED_TYPE_OF_TEST").select_option(label="Colonoscopy")
127+
page.get_by_role("button", name="Calendar").click()
128+
CalendarPicker(page).v1_calender_picker(datetime.today())
129+
page.get_by_role("button", name="Save").click()
130+
SubjectScreeningSummary(page).verify_latest_event_status_value(
131+
"A259 - Attended Diagnostic Test"
132+
)
133+
# Repeat above for x number of subjects
134+
135+
# Click on 'Advance FOBT Screening Episode' button for the 1st Abnormal patient
136+
verify_subject_event_status_by_nhs_no(
137+
page, nhs_no, "A259 - Attended Diagnostic Test"
138+
)
139+
page.get_by_role("button", name="Advance FOBT Screening Episode").click()
140+
141+
# Click 'Other Post-investigation Contact Required' button
142+
# Click 'OK'
143+
page.once("dialog", lambda dialog: dialog.accept())
144+
page.get_by_role("button", name="Other Post-investigation").click()
145+
expect(
146+
page.get_by_role(
147+
"cell", name="A361 - Other Post-investigation Contact Required", exact=True
148+
)
149+
).to_be_visible()
150+
151+
# Select 'Record other post-investigation contact' button
152+
page.get_by_role("button", name="Record other post-").click()
153+
154+
# Complete 'Contact Direction', To patient
155+
# 'Contact made between patient and', Selects the top option in the dropdown
156+
# 'Date of Patient Contact', Today
157+
# 'Duration', 01:00
158+
# 'Start Time', 11:00
159+
# 'End Time', 12:00
160+
# 'Discussion Record' TEST AUTOMATION
161+
# select 'Outcome' - 'Post-investigation Appointment Not Required' and click 'Save'
162+
page.locator("#UI_DIRECTION").select_option(label="To patient")
163+
page.locator("#UI_CALLER_ID").select_option(index=0)
164+
page.get_by_role("button", name="Calendar").click()
165+
CalendarPicker(page).v1_calender_picker(datetime.today())
166+
page.locator("#UI_START_TIME").click()
167+
page.locator("#UI_START_TIME").fill("11:00")
168+
page.locator("#UI_END_TIME").click()
169+
page.locator("#UI_END_TIME").fill("12:00")
170+
page.locator("#UI_COMMENT_ID").click()
171+
page.locator("#UI_COMMENT_ID").fill("Test Automation")
172+
page.locator("#UI_OUTCOME").select_option(
173+
label="Post-investigation Appointment Not Required"
174+
)
175+
page.get_by_role("button", name="Save").click()
176+
177+
verify_subject_event_status_by_nhs_no(
178+
page, nhs_no, "A361 - Other Post-investigation Contact Required"
179+
)
180+
181+
# Repeat above for x subjects
182+
183+
Logout(page).log_out()

0 commit comments

Comments
 (0)