Skip to content

Commit 7a4a10f

Browse files
committed
Merge remote-tracking branch 'origin' into feature/BCSS-20365-compartment-5-pom-for-contact-with-patient-page
# Conflicts: # tests/smokescreen/test_compartment_5.py
2 parents 634da6e + acd42e4 commit 7a4a10f

File tree

4 files changed

+132
-67
lines changed

4 files changed

+132
-67
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
from playwright.sync_api import Page
2+
from pages.base_page import BasePage
3+
from enum import Enum
4+
5+
6+
class ColonoscopyDatasetsPage(BasePage):
7+
"""
8+
This class contains locators and methods to interact with the Colonoscopy Datasets page.
9+
"""
10+
11+
def __init__(self, page: Page):
12+
super().__init__(page)
13+
self.page = page
14+
15+
# Colonoscopy datasets page locators
16+
self.save_dataset_button = self.page.locator(
17+
"#UI_DIV_BUTTON_SAVE1"
18+
).get_by_role("button", name="Save Dataset")
19+
20+
self.select_asa_grade_dropdown = self.page.get_by_label("ASA Grade")
21+
22+
self.select_fit_for_colonoscopy_dropdown = self.page.get_by_label(
23+
"Fit for Colonoscopy (SSP)"
24+
)
25+
26+
self.dataset_complete_radio_button_yes = self.page.get_by_role(
27+
"radio", name="Yes"
28+
)
29+
30+
self.dataset_complete_radio_button_no = self.page.get_by_role(
31+
"radio", name="No"
32+
)
33+
34+
def save_dataset(self) -> None:
35+
self.click(self.save_dataset_button)
36+
37+
def select_asa_grade_option(self, option: str) -> None:
38+
"""
39+
This method is designed to select a specific grade option from the colonoscopy dataset page, ASA Grade dropdown menu.
40+
Args:
41+
option (str): The ASA grade option to be selected. This should be a string that matches one of the available options in the dropdown menu.
42+
Valid options are: "FIT", "RELEVANT_DISEASE", "UNABLE_TO_ASSESS", RESTRICTIVE_DISEASE, "LIFE_THREATENING_DISEASE", "MORIBUND", "NOT_APPLICABLE", or "NOT_KNOWN".
43+
Returns:
44+
None
45+
"""
46+
self.select_asa_grade_dropdown.select_option(option)
47+
48+
def select_fit_for_colonoscopy_option(self, option: str) -> None:
49+
"""
50+
This method is designed to select a specific option from the colonoscopy dataset page, Fit for Colonoscopy (SSP) dropdown menu.
51+
Args:
52+
option (str): The option to be selected. This should be a string that matches one of the available options in the dropdown menu.
53+
Valid options are: "YES", "NO", or "UNABLE_TO_ASSESS".
54+
Returns:
55+
None
56+
"""
57+
self.select_fit_for_colonoscopy_dropdown.select_option(option)
58+
59+
def click_dataset_complete_radio_button_yes(self) -> None:
60+
self.dataset_complete_radio_button_yes.check()
61+
62+
def click_dataset_complete_radio_button_no(self) -> None:
63+
self.dataset_complete_radio_button_no.check()
64+
65+
66+
class AsaGradeOptions(Enum):
67+
FIT = "17009"
68+
RELEVANT_DISEASE = "17010"
69+
RESTRICTIVE_DISEASE = "17011"
70+
LIFE_THREATENING_DISEASE = "17012"
71+
MORIBUND = "17013"
72+
NOT_APPLICABLE = "17014"
73+
NOT_KNOWN = "17015"
74+
75+
76+
class FitForColonoscopySspOptions(Enum):
77+
YES = "17058"
78+
NO = "17059"
79+
UNABLE_TO_ASSESS = "17954"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from playwright.sync_api import Page
2+
from pages.base_page import BasePage
3+
4+
5+
class SubjectDatasetsPage(BasePage):
6+
"""
7+
This class contains locators and methods to interact with the Subject Datasets page.
8+
"""
9+
10+
def __init__(self, page: Page):
11+
super().__init__(page)
12+
self.page = page
13+
# Subject datasets page locators
14+
self.colonoscopy_show_dataset_button = (
15+
self.page.locator("div")
16+
# Note: The "(1 Dataset)" part of the line below may be dynamic and may change based on the actual dataset count.
17+
.filter(
18+
has_text="Colonoscopy Assessment (1 Dataset) Show Dataset"
19+
).get_by_role("link")
20+
)
21+
self.investigation_show_dataset_button = (
22+
self.page.locator("div")
23+
# Note: The "(1 Dataset)" part of the line below may be dynamic and may change based on the actual dataset count.
24+
.filter(has_text="Investigation (1 Dataset) Show Dataset").get_by_role(
25+
"link"
26+
)
27+
)
28+
29+
def click_colonoscopy_show_datasets(self) -> None:
30+
"""
31+
This method clicks on the 'Show Dataset' button for the Colonoscopy Assessment row on the Subject Datasets Page.
32+
"""
33+
self.click(self.colonoscopy_show_dataset_button)
34+
35+
def click_investigation_show_datasets(self) -> None:
36+
"""
37+
This method clicks on the 'Show Dataset' button for the Investigation row on the Subject Datasets Page.
38+
"""
39+
self.click(self.investigation_show_dataset_button)

pages/screening_practitioner_appointments/subject_datasets.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

tests/smokescreen/test_compartment_5.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import pytest
2-
from playwright.sync_api import Page, expect
2+
from playwright.sync_api import Page
33
from pages.logout.log_out_page import Logout
44
from pages.base_page import BasePage
55
from pages.screening_practitioner_appointments.appointment_calendar_page import AppointmentCalendar
66
from pages.screening_practitioner_appointments.appointment_detail_page import AppointmentDetail
77
from pages.screening_practitioner_appointments.screening_practitioner_appointments import (
88
ScreeningPractitionerAppointmentsPage,
99
)
10-
from pages.screening_practitioner_appointments.screening_practitioner_day_view import ScreeningPractitionerDayView
11-
from pages.screening_practitioner_appointments.subject_datasets import (
12-
SubjectDatasets,
10+
from pages.datasets.subject_datasets_page import (
11+
SubjectDatasetsPage,
12+
)
13+
from pages.datasets.colonoscopy_dataset_page import (
14+
ColonoscopyDatasetsPage,
1315
FitForColonoscopySspOptions,
1416
AsaGradeOptions,
1517
)
@@ -71,11 +73,11 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
7173

7274
AppointmentCalendar(page).click_view_appointments_on_this_day_button()
7375
ScreeningPractitionerDayView(page).click_calendar_button()
74-
date_from_util = datetime(2025, 4, 29)
76+
date_from_util = datetime(2025, 4, 30)
7577
CalendarPicker(page).v1_calender_picker(date_from_util)
7678

7779
# Select subject from inital test data util
78-
ScreeningPractitionerDayView(page).click_patient_link("STARLESS BLUSH")
80+
ScreeningPractitionerDayView(page).click_patient_link("DIVIDEND MUZZLE")
7981

8082
# Select Attendance radio button, tick Attended checkbox, set Attended Date to yesterday's (system) date and then press Save
8183
AppointmentDetail(page).check_attendance_radio()
@@ -88,7 +90,7 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
8890
# Repeat for x Abnormal patients
8991

9092
# Navigate to the 'Subject Screening Summary' screen for the 1st Abnormal patient
91-
nhs_no = "9937265193" # Test NHS NO for Scaliding Cod
93+
nhs_no = "9852356488" # Test NHS NO for DIVIDEND MUZZLE
9294
verify_subject_event_status_by_nhs_no(
9395
page, nhs_no, "J10 - Attended Colonoscopy Assessment Appointment"
9496
)
@@ -97,23 +99,23 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
9799
SubjectScreeningSummary(page).click_datasets_link()
98100

99101
# Click on 'Show Dataset' next to the Colonoscopy Assessment
100-
SubjectDatasets(page).click_show_datasets()
102+
SubjectDatasetsPage(page).click_colonoscopy_show_datasets()
101103

102104
# Populate Colonoscopy Assessment Details fields
103105

104106
# ASA Grade - I - Fit
105-
SubjectDatasets(page).select_asa_grade_option(AsaGradeOptions.FIT.value)
107+
ColonoscopyDatasetsPage(page).select_asa_grade_option(AsaGradeOptions.FIT.value)
106108

107109
# Fit for Colonoscopy (SSP) - Yes
108-
SubjectDatasets(page).select_fit_for_colonoscopy_option(
110+
ColonoscopyDatasetsPage(page).select_fit_for_colonoscopy_option(
109111
FitForColonoscopySspOptions.YES.value
110112
)
111113

112114
# Click 'Yes' for Dataset Complete?
113-
SubjectDatasets(page).click_dataset_complete_radio_button_yes()
115+
ColonoscopyDatasetsPage(page).click_dataset_complete_radio_button_yes()
114116

115117
# Click Save Dataset button
116-
SubjectDatasets(page).save_dataset()
118+
ColonoscopyDatasetsPage(page).save_dataset()
117119

118120
# Click Back
119121
BasePage(page).click_back_button()

0 commit comments

Comments
 (0)