Skip to content

Commit 3873632

Browse files
Added now POM for Investigation Datasets page (wip)
1 parent 7a7e169 commit 3873632

File tree

2 files changed

+279
-17
lines changed

2 files changed

+279
-17
lines changed
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
from playwright.sync_api import Page
2+
from pages.base_page import BasePage
3+
from enum import Enum
4+
5+
6+
class InvestigationDatasetsPage(BasePage):
7+
"""Investigation Datasets Page locators, and methods for interacting with the page"""
8+
9+
def __init__(self, page: Page):
10+
super().__init__(page)
11+
self.page = page
12+
13+
# Colonoscopy datasets page locators
14+
self.site_lookup_link = self.page.locator("#UI_SITE_SELECT_LINK")
15+
self.select_options = self.page.locator('[id^="UI_RESULTS_"]')
16+
self.pracitioner_link = self.page.locator("#UI_SSP_PIO_SELECT_LINK")
17+
self.testing_clinician_link = self.page.locator(
18+
"#UI_CONSULTANT_PIO_SELECT_LINK"
19+
)
20+
self.aspirant_endoscopist_link = self.page.locator(
21+
"#UI_ASPIRANT_ENDOSCOPIST_PIO_SELECT_LINK"
22+
)
23+
self.show_drug_informations_detail = self.page.locator("#anchorDrug")
24+
self.drug_type_option1 = self.page.locator("#UI_BOWEL_PREP_DRUG1")
25+
self.drug_type_dose1 = self.page.locator("#UI_BOWEL_PREP_DRUG1")
26+
self.show_enscopy_information_details = self.page.locator("#anchorColonoscopy")
27+
self.enscope_inserted_yes = self.page.locator("#radScopeInsertedYes")
28+
self.theraputic_procedure_type = self.page.get_by_role(
29+
"radio", name="Therapeutic"
30+
)
31+
self.bowel_preparation_quality_option = self.page.get_by_label(
32+
"Bowel preparation quality"
33+
)
34+
self.comfort_during_examination_option = self.page.get_by_label(
35+
"Comfort during examination"
36+
)
37+
self.comfort_during_recovery_option = self.page.get_by_label(
38+
"Comfort during recovery"
39+
)
40+
41+
def select_site_lookup_option(self, option: str) -> None:
42+
"""
43+
This method is designed to select a site from the site lookup options.
44+
It clicks on the site lookup link and selects the given option.
45+
46+
Args:
47+
option (str): The option to select from the aspirant endoscopist options.
48+
"""
49+
self.click(self.site_lookup_link)
50+
self.select_options.select_option(option)
51+
52+
def select_practitioner_option(self, option: str) -> None:
53+
"""
54+
This method is designed to select a practitioner from the practitioner options.
55+
It clicks on the practitioner link and selects the given option.
56+
57+
Args:
58+
option (str): The option to select from the aspirant endoscopist options.
59+
"""
60+
self.click(self.pracitioner_link)
61+
self.select_options.select_option(option)
62+
63+
def select_testing_clinician_option(self, option: str) -> None:
64+
"""
65+
This method is designed to select a testing clinician from the testing clinician options.
66+
It clicks on the testing clinician link and selects the given option.
67+
68+
Args:
69+
option (str): The option to select from the aspirant endoscopist options.
70+
"""
71+
self.click(self.testing_clinician_link)
72+
self.select_options.select_option(option)
73+
74+
def select_aspirant_endoscopist_option(self, option: str) -> None:
75+
"""
76+
This method is designed to select an aspirant endoscopist from the aspirant endoscopist options.
77+
It clicks on the aspirant endoscopist link and selects the given option.
78+
79+
Args:
80+
option (str): The option to select from the aspirant endoscopist options.
81+
"""
82+
self.click(self.testing_clinician_link)
83+
self.select_options.select_option(option)
84+
85+
def click_show_drug_information(self) -> None:
86+
"""
87+
This method is designed to click on the show drug information link.
88+
It clicks on the show drug information link.
89+
"""
90+
self.click(self.show_drug_informations_detail)
91+
92+
def select_drug_type_option1(self, option: str) -> None:
93+
"""
94+
This method is designed to select a drug type from the first drug type options.
95+
It clicks on the drug type option and selects the given option.
96+
97+
Args:
98+
option (str): The option to select from the aspirant endoscopist options.
99+
"""
100+
self.drug_type_option1.select_option(option)
101+
102+
def fill_dtrug_type_dose1(self, dose: str) -> None:
103+
"""
104+
This method is designed to fill in the drug type dose for the first drug type options.
105+
It fills in the given dose.
106+
107+
Args:
108+
dose (str): The dose to fill in for the drug type.
109+
"""
110+
self.click(self.drug_type_dose1)
111+
self.drug_type_dose1.fill(dose)
112+
113+
def click_show_enscopy_information(self) -> None:
114+
"""
115+
This method is designed to click on the show endoscopy information link.
116+
It clicks on the show endoscopy information link.
117+
"""
118+
self.click(self.show_enscopy_information_details)
119+
120+
def check_enscope_inserted_yes(self) -> None:
121+
"""
122+
This method is designed to check the endoscope inserted yes option.
123+
It checks the endoscope inserted yes option.
124+
"""
125+
self.enscope_inserted_yes.check()
126+
127+
def select_theraputic_procedure_type(self) -> None:
128+
"""
129+
This method is designed to select the therapeutic procedure type.
130+
It selects the therapeutic procedure type.
131+
"""
132+
self.theraputic_procedure_type.check()
133+
134+
def select_bowel_preparation_quality_option(self, option: str) -> None:
135+
"""
136+
This method is designed to select a bowel preparation quality option.
137+
It selects the given option.
138+
139+
Args:
140+
option (str): The option to select from the bowel preparation quality options.
141+
"""
142+
self.bowel_preparation_quality_option.select_option(option)
143+
144+
def select_comfort_during_examination_option(self, option: str) -> None:
145+
"""
146+
This method is designed to select a comfort during examination option.
147+
It selects the given option.
148+
149+
Args:
150+
option (str): The option to select from the comfort during examination options.
151+
"""
152+
self.comfort_during_examination_option.select_option(option)
153+
154+
def select_comfort_during_recovery_option(self, option: str) -> None:
155+
"""
156+
This method is designed to select a comfort during recovery option.
157+
It selects the given option.
158+
159+
Args:
160+
option (str): The option to select from the comfort during recovery options.
161+
"""
162+
self.comfort_during_recovery_option.select_option(option)
163+
164+
165+
class SiteLookupOptions(Enum):
166+
"""Enum for site lookup options"""
167+
168+
RL401 = "35317"
169+
RL402 = "42805"
170+
RL403 = "42804"
171+
RL404 = "42807"
172+
RL405 = "42808"
173+
174+
175+
class PractitionerOptions(Enum):
176+
"""Enum for practitioner options"""
177+
178+
AMID_SNORING = "1251"
179+
ASTONISH_ETHANOL = "82"
180+
DEEP_POLL_DERBY = "2033"
181+
DOORFRAME_THIRSTY = "2034"
182+
183+
184+
class TestingClinicianOptions(Enum):
185+
"""Enum for testing clinician options"""
186+
187+
BORROWING_PROPERTY = "886"
188+
CLAUSE_CHARTING = "918"
189+
CLUTTER_PUMMEL = "916"
190+
CONSONANT_TRACTOR = "101"
191+
192+
193+
class AspirantEndoscopistOptions(Enum):
194+
"""Enum for aspirant endoscopist options"""
195+
196+
ITALICISE_AMNESTY = "1832"
197+
198+
199+
class DrugTypeOptions(Enum):
200+
"""Enum for drug type options"""
201+
202+
BISACODYL = "200537~Tablet(s)"
203+
KLEAN_PREP = "200533~Sachet(s)"
204+
PICOLAX = "200534~Sachet(s)"
205+
SENNA_LIQUID = "203067~5ml Bottle(s)"
206+
SENNA = "200535~Tablet(s)"
207+
MOVIPREP = "200536~Sachet(s)"
208+
CITRAMAG = "200538~Sachet(s)"
209+
MANNITOL = "200539~Litre(s)"
210+
GASTROGRAFIN = "200540~Mls Solution"
211+
PHOSPHATE_ENEMA = "200528~Sachet(s)"
212+
MICROLAX_ENEMA = "200529~Sachet(s)"
213+
OSMOSPREP = "203063~Tablet(s)"
214+
FLEET_PHOSPHO_SODA = "203064~Mls Solution"
215+
CITRAFLEET = "203065~Sachet(s)"
216+
PLENVU = "305487~Sachet(s)"
217+
OTHER = "203066"
218+
219+
220+
class BowelPreparationQualityOptions(Enum):
221+
"""Enum for bowel preparation quality options"""
222+
223+
EXCELLENT = "305579"
224+
GOOD = "17016"
225+
FAIR = "17017"
226+
POOR = "17995~Enema down scope~305582"
227+
INADEQUATE = "305581~~305582"
228+
229+
230+
class ComfortOptions(Enum):
231+
"""Enum for comfort during examination / recovery options"""
232+
233+
NO_DISCOMFORT = "18505"
234+
MINIMAL_DISCOMFORT = "17273"
235+
MILD_DISCOMFORT = "17274"
236+
MODERATE_DISCOMFORT = "17275"
237+
SEVERE_DISCOMFORT = "17276"

tests/smokescreen/test_compartment_6.py

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99
from utils.batch_processing import batch_processing
1010
from pages.logout.log_out_page import LogoutPage
1111
from pages.datasets.subject_datasets_page import SubjectDatasetsPage
12+
from pages.datasets.investigation_dataset_page import (
13+
InvestigationDatasetsPage,
14+
SiteLookupOptions,
15+
PractitionerOptions,
16+
TestingClinicianOptions,
17+
AspirantEndoscopistOptions,
18+
DrugTypeOptions,
19+
BowelPreparationQualityOptions,
20+
ComfortOptions,
21+
)
1222

1323

1424
# This should go into a util. Adding it here to avoid SonarQube duplication errors:
@@ -22,23 +32,38 @@ def go_to_investigation_datasets_page(page: Page, nhs_no) -> None:
2232

2333

2434
def investigation_dataset_forms(page: Page) -> None:
25-
page.locator("#UI_SITE_SELECT_LINK").click()
26-
page.locator("#UI_RESULTS_rljsjnkh").select_option("35317")
27-
page.locator("#UI_SSP_PIO_SELECT_LINK").click()
28-
page.locator("#UI_RESULTS_okdvpfko").select_option("1251")
29-
page.locator("#UI_CONSULTANT_PIO_SELECT_LINK").click()
30-
page.locator("#UI_RESULTS_sawaeghr").select_option("886")
31-
page.locator("#UI_ASPIRANT_ENDOSCOPIST_PIO_SELECT_LINK").click()
32-
page.locator("#anchorDrug").click()
33-
page.locator("#UI_BOWEL_PREP_DRUG1").select_option("200537~Tablet(s)")
34-
page.locator("#UI_BOWEL_PREP_DRUG_DOSE1").click()
35-
page.locator("#UI_BOWEL_PREP_DRUG_DOSE1").fill("10")
36-
page.get_by_role("link", name="Show details").click()
37-
page.locator("#radScopeInsertedYes").check()
38-
page.get_by_role("radio", name="Therapeutic").check()
39-
page.get_by_label("Bowel preparation quality").select_option("17016")
40-
page.get_by_label("Comfort during examination").select_option("18505")
41-
page.get_by_label("Comfort during recovery").select_option("18505")
35+
# Investigation Dataset
36+
InvestigationDatasetsPage(page).select_site_lookup_option(
37+
SiteLookupOptions.RL401.value
38+
)
39+
InvestigationDatasetsPage(page).select_practitioner_option(
40+
PractitionerOptions.AMID_SNORING.value
41+
)
42+
InvestigationDatasetsPage(page).select_testing_clinician_option(
43+
TestingClinicianOptions.BORROWING_PROPERTY.value
44+
)
45+
InvestigationDatasetsPage(page).select_aspirant_endoscopist_option(
46+
AspirantEndoscopistOptions.ITALICISE_AMNESTY.value
47+
)
48+
# Drug Information
49+
InvestigationDatasetsPage(page).click_show_drug_information()
50+
InvestigationDatasetsPage(page).select_drug_type_option1(
51+
DrugTypeOptions.BISACODYL.value
52+
)
53+
InvestigationDatasetsPage(page).fill_dtrug_type_dose1("10")
54+
# Ensocopy Information
55+
InvestigationDatasetsPage(page).click_show_enscopy_information()
56+
InvestigationDatasetsPage(page).check_enscope_inserted_yes()
57+
InvestigationDatasetsPage(page).select_theraputic_procedure_type()
58+
InvestigationDatasetsPage(page).select_bowel_preparation_quality_option(
59+
BowelPreparationQualityOptions.GOOD.value
60+
)
61+
InvestigationDatasetsPage(page).select_comfort_during_examination_option(
62+
ComfortOptions.NO_DISCOMFORT.value
63+
)
64+
InvestigationDatasetsPage(page).select_comfort_during_recovery_option(
65+
ComfortOptions.NO_DISCOMFORT.value
66+
)
4267
page.get_by_label("Endoscopist defined extent").select_option(
4368
"17240~Colonoscopy Complete"
4469
)

0 commit comments

Comments
 (0)