Skip to content

Commit abef415

Browse files
Added POM for Subject Datasets and updated Compartment 5 tests accord… (#39)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description Added POM for Subject Datasets and updated Compartment 5 tests accordingly <!-- Describe your changes in detail. --> ## Context We had some hard coded locators/values in our compartment 5 tests that have been refactored to use a POM <!-- Why is this change required? What problem does it solve? --> ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [x] Refactoring (non-breaking change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I am familiar with the [contributing guidelines](https://github.com/nhs-england-tools/playwright-python-blueprint/blob/main/CONTRIBUTING.md) - [x] I have followed the code style of the project - [ ] I have added tests to cover my changes (where appropriate) - [ ] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes. --------- Signed-off-by: AndyG <[email protected]> Co-authored-by: adrianoaru-nhs <[email protected]>
1 parent 98c6bf0 commit abef415

File tree

2 files changed

+70
-7
lines changed

2 files changed

+70
-7
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from playwright.sync_api import Page, expect
2+
from pages.base_page import BasePage
3+
from enum import Enum
4+
5+
6+
class SubjectDatasets(BasePage):
7+
def __init__(self, page: Page):
8+
super().__init__(page)
9+
self.page = page
10+
11+
self.show_dataset_button = self.page.get_by_role("link", name="Show Dataset")
12+
13+
self.save_dataset_button = self.page.locator(
14+
"#UI_DIV_BUTTON_SAVE1"
15+
).get_by_role("button", name="Save Dataset")
16+
17+
self.select_asa_grade_dropdown = self.page.get_by_label("ASA Grade")
18+
19+
self.select_fit_for_colonoscopy_dropdown = self.page.get_by_label(
20+
"Fit for Colonoscopy (SSP)"
21+
)
22+
23+
self.dataset_complete_radio_button_yes = self.page.get_by_role(
24+
"radio", name="Yes"
25+
)
26+
27+
self.dataset_complete_radio_button_no = self.page.get_by_role(
28+
"radio", name="No"
29+
)
30+
31+
def click_show_datasets(self) -> None:
32+
self.click(self.show_dataset_button)
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+
self.select_asa_grade_dropdowen.select_option(option)
39+
40+
def select_fit_for_colonoscopy_option(self, option: str) -> None:
41+
self.select_fit_for_colonoscopy_dropdown.select_option(option)
42+
43+
def click_dataset_complete_radio_button_yes(self) -> None:
44+
self.dataset_complete_radio_button_yes.check()
45+
46+
def click_dataset_complete_radio_button_no(self) -> None:
47+
self.dataset_complete_radio_button_no.check()
48+
49+
50+
class AsaGradeOptions(Enum):
51+
FIT = "17009"
52+
53+
54+
class FitForColonoscopySspOptions(Enum):
55+
YES = "17058"

tests/smokescreen/test_compartment_5.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
from pages.screening_practitioner_appointments.screening_practitioner_appointments import (
66
ScreeningPractitionerAppointmentsPage,
77
)
8+
from pages.screening_practitioner_appointments.subject_datasets import (
9+
SubjectDatasets,
10+
FitForColonoscopySspOptions,
11+
AsaGradeOptions,
12+
)
813
from pages.screening_subject_search.subject_screening_summary import (
914
SubjectScreeningSummary,
1015
)
@@ -94,22 +99,25 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
9499
SubjectScreeningSummary(page).click_datasets_link()
95100

96101
# Click on 'Show Dataset' next to the Colonoscopy Assessment
102+
SubjectDatasets(page).click_show_datasets()
97103

98104
# Populate Colonoscopy Assessment Details fields
99105

100106
# ASA Grade - I - Fit
107+
SubjectDatasets(page).select_asa_grade_option(AsaGradeOptions.FIT.value)
108+
101109
# Fit for Colonoscopy (SSP) - Yes
110+
SubjectDatasets(page).select_fit_for_colonoscopy_option(
111+
FitForColonoscopySspOptions.YES.value
112+
)
102113

103114
# Click 'Yes' for Dataset Complete?
115+
SubjectDatasets(page).click_dataset_complete_radio_button_yes()
116+
104117
# Click Save Dataset button
118+
SubjectDatasets(page).save_dataset()
119+
105120
# Click Back
106-
page.get_by_role("link", name="Show Dataset").click()
107-
page.get_by_label("ASA Grade").select_option("17009")
108-
page.get_by_label("Fit for Colonoscopy (SSP)").select_option("17058")
109-
page.get_by_role("radio", name="Yes").check()
110-
page.locator("#UI_DIV_BUTTON_SAVE1").get_by_role(
111-
"button", name="Save Dataset"
112-
).click()
113121
BasePage(page).click_back_button()
114122
BasePage(page).click_back_button()
115123
# This brings you back to the subject screening summary page

0 commit comments

Comments
 (0)