|
| 1 | +from playwright.sync_api import Page |
| 2 | +from pages.base_page import BasePage |
| 3 | +from enum import Enum |
| 4 | +from utils.calendar_picker import CalendarPicker |
| 5 | +from datetime import datetime |
| 6 | +from pages.datasets.investigation_dataset_page import ( |
| 7 | + EndoscopyLocationOptions as TumorLocationOptions, |
| 8 | +) |
| 9 | + |
| 10 | + |
| 11 | +class CancerAuditDatasetsPage(BasePage): |
| 12 | + """Subject Datasets Page locators, and methods for interacting with the page""" |
| 13 | + |
| 14 | + def __init__(self, page: Page): |
| 15 | + super().__init__(page) |
| 16 | + self.page = page |
| 17 | + # Cancer audit datasets page locators |
| 18 | + self.dataset_complete_button = self.page.get_by_role("radio", name="Yes") |
| 19 | + self.staging_and_pretreatment_information_show_details_button = ( |
| 20 | + self.page.locator("#anchorPreTreatment") |
| 21 | + ) |
| 22 | + self.tumour_information_show_details_button = self.page.locator("#anchorTumour") |
| 23 | + self.add_new_treatment_button = self.page.get_by_role( |
| 24 | + "button", name="Add New Treatment" |
| 25 | + ) |
| 26 | + self.save_dataset_button = self.page.locator( |
| 27 | + "#UI_DIV_BUTTON_SAVE1" |
| 28 | + ).get_by_role("button", name="Save Dataset") |
| 29 | + # Types of Scan |
| 30 | + self.abdominal_ultrasound_checkbox = self.page.get_by_role( |
| 31 | + "checkbox", name="Abdominal Ultrasound" |
| 32 | + ) |
| 33 | + self.ct_scan_checkbox = self.page.get_by_role("checkbox", name="CT Scan") |
| 34 | + self.endoanal_ultrasound_checkbox = self.page.get_by_role( |
| 35 | + "checkbox", name="Endoanal Ultrasound" |
| 36 | + ) |
| 37 | + self.endorectal_ultrasound_checkbox = self.page.get_by_role( |
| 38 | + "checkbox", name="Endorectal Ultrasound" |
| 39 | + ) |
| 40 | + self.mri_scan_checkbox = self.page.get_by_role("checkbox", name="MRI Scan") |
| 41 | + self.positron_emission_tomography_checkbox = self.page.get_by_role( |
| 42 | + "checkbox", name="Positron Emission Tomography" |
| 43 | + ) |
| 44 | + # Metastases Location |
| 45 | + self.peritoneum_omentum_checkbox = self.page.get_by_role( |
| 46 | + "checkbox", name="Peritoneum/Omentum" |
| 47 | + ) |
| 48 | + self.bone_checkbox = self.page.get_by_role("checkbox", name="Bone") |
| 49 | + self.lung_checkbox = self.page.get_by_role("checkbox", name="Lung") |
| 50 | + self.liver_checkbox = self.page.get_by_role("checkbox", name="Liver") |
| 51 | + self.other_checkbox = self.page.get_by_role("checkbox", name="Other") |
| 52 | + self.other_textbox = self.page.get_by_role( |
| 53 | + "textbox", name="Please enter the other" |
| 54 | + ) |
| 55 | + # Tumour Information |
| 56 | + self.date_of_diagnosis_textbox = self.page.get_by_role( |
| 57 | + "textbox", name="Date of Diagnosis" |
| 58 | + ) |
| 59 | + # Treatment Information |
| 60 | + self.date_of_treatment_textbox = self.page.get_by_role( |
| 61 | + "textbox", name="Date of Treatment Date of" |
| 62 | + ) |
| 63 | + self.treatment_provider_lookup_link = self.page.locator("#UI_RESULTS_rnkylygq") |
| 64 | + self.consultant_lookup_link = self.page.locator("#UI_RESULTS_gpwbfppu") |
| 65 | + |
| 66 | + def check_dataset_complete_button(self) -> None: |
| 67 | + """Checks the 'Yes' radio button for dataset completion.""" |
| 68 | + self.dataset_complete_button.check() |
| 69 | + |
| 70 | + def click_staging_and_pretreatment_information_show_details_button(self) -> None: |
| 71 | + """Clicks on the 'Show Details' button for the Staging and Pretreatment Information section.""" |
| 72 | + self.click(self.staging_and_pretreatment_information_show_details_button) |
| 73 | + |
| 74 | + def click_tumour_information_show_details_button(self) -> None: |
| 75 | + """Clicks on the 'Show Details' button for the Tumour Information section.""" |
| 76 | + self.click(self.tumour_information_show_details_button) |
| 77 | + |
| 78 | + def click_add_new_treatment_button(self) -> None: |
| 79 | + """Clicks on the 'Add New Treatment' button.""" |
| 80 | + self.click(self.add_new_treatment_button) |
| 81 | + |
| 82 | + def click_save_dataset_button(self) -> None: |
| 83 | + """Clicks on the 'Save Dataset' button.""" |
| 84 | + self.click(self.save_dataset_button) |
| 85 | + |
| 86 | + def check_abdominal_ultrasound_checkbox(self) -> None: |
| 87 | + """Checks the 'Abdominal Ultrasound' checkbox.""" |
| 88 | + self.abdominal_ultrasound_checkbox.check() |
| 89 | + |
| 90 | + def check_ct_scan_checkbox(self) -> None: |
| 91 | + """Checks the 'CT Scan' checkbox.""" |
| 92 | + self.ct_scan_checkbox.check() |
| 93 | + |
| 94 | + def check_endoanal_ultrasound_checkbox(self) -> None: |
| 95 | + """Checks the 'Endoanal Ultrasound' checkbox.""" |
| 96 | + self.endoanal_ultrasound_checkbox.check() |
| 97 | + |
| 98 | + def check_endorectal_ultrasound_checkbox(self) -> None: |
| 99 | + """Checks the 'Endorectal Ultrasound' checkbox.""" |
| 100 | + self.endorectal_ultrasound_checkbox.check() |
| 101 | + |
| 102 | + def check_mri_scan_checkbox(self) -> None: |
| 103 | + """Checks the 'MRI Scan' checkbox.""" |
| 104 | + self.mri_scan_checkbox.check() |
| 105 | + |
| 106 | + def check_positron_emission_tomography_checkbox(self) -> None: |
| 107 | + """Checks the 'Positron Emission Tomography' checkbox.""" |
| 108 | + self.positron_emission_tomography_checkbox.check() |
| 109 | + |
| 110 | + def check_peritoneum_omentum_checkbox(self) -> None: |
| 111 | + """Checks the 'Peritoneum/Omentum' checkbox.""" |
| 112 | + self.peritoneum_omentum_checkbox.check() |
| 113 | + |
| 114 | + def check_bone_checkbox(self) -> None: |
| 115 | + """Checks the 'Bone' checkbox.""" |
| 116 | + self.bone_checkbox.check() |
| 117 | + |
| 118 | + def check_lung_checkbox(self) -> None: |
| 119 | + """Checks the 'Lung' checkbox.""" |
| 120 | + self.lung_checkbox.check() |
| 121 | + |
| 122 | + def check_liver_checkbox(self) -> None: |
| 123 | + """Checks the 'Liver' checkbox.""" |
| 124 | + self.liver_checkbox.check() |
| 125 | + |
| 126 | + def check_other_checkbox(self) -> None: |
| 127 | + """Checks the 'Other' checkbox.""" |
| 128 | + self.other_checkbox.check() |
| 129 | + |
| 130 | + def fill_other_textbox(self, text: str) -> None: |
| 131 | + """Fills the 'Other' textbox with the provided text and presses Tab.""" |
| 132 | + self.other_textbox.fill(text) |
| 133 | + self.other_textbox.press("Tab") |
| 134 | + |
| 135 | + def fill_date_of_diagnosis_textbox(self, date: datetime) -> None: |
| 136 | + """Fills the 'Date of Diagnosis' textbox with the provided date.""" |
| 137 | + CalendarPicker(self.page).calendar_picker_ddmmyyyy( |
| 138 | + date, self.date_of_diagnosis_textbox |
| 139 | + ) |
| 140 | + |
| 141 | + def fill_date_of_treatment_textbox(self, date: datetime) -> None: |
| 142 | + """Fills the 'Date of Treatment' textbox with the provided date.""" |
| 143 | + CalendarPicker(self.page).calendar_picker_ddmmyyyy( |
| 144 | + date, self.date_of_treatment_textbox |
| 145 | + ) |
| 146 | + |
| 147 | + def select_treatment_provider_lookup_option(self, option: str) -> None: |
| 148 | + """Selects an option from the Treatment Provider lookup dropdown.""" |
| 149 | + self.treatment_provider_lookup_link.select_option(option) |
| 150 | + |
| 151 | + def select_consultant_lookup_option(self, option: str) -> None: |
| 152 | + """Selects an option from the Consultant lookup dropdown.""" |
| 153 | + self.consultant_lookup_link.select_option(option) |
| 154 | + |
| 155 | + def select_first_definitive_teatment_information_option(self, option: str) -> None: |
| 156 | + """Selects an option for the First Definitive Treatment Information.""" |
| 157 | + self.page.locator(f"#UI_FIRST_DEFINITIVE_TREATMENT_1_{option}").check() |
| 158 | + |
| 159 | + |
| 160 | +NOT_REPORTED_CODE = "202140~~202188" |
| 161 | + |
| 162 | + |
| 163 | +class ASAGradeOptions(Enum): |
| 164 | + """Enum for ASA Grade options.""" |
| 165 | + |
| 166 | + FIT = "17009" |
| 167 | + RELEVANT_DISEASE = "17010" |
| 168 | + RESTRICTIVE_DISEASE = "17011" |
| 169 | + LIFE_THREATENING_DISEASE = "17012" |
| 170 | + MORIBUND = "17013" |
| 171 | + NOT_KNOWN = "17015" |
| 172 | + |
| 173 | + |
| 174 | +class YesNoOptions(Enum): |
| 175 | + """Enum for YesNo options.""" |
| 176 | + |
| 177 | + YES = "17058" |
| 178 | + NO = "17059" |
| 179 | + |
| 180 | + |
| 181 | +class MetastasesPresentOptions(Enum): |
| 182 | + """Enum for Metastases Present options.""" |
| 183 | + |
| 184 | + CERTAIN = "17131~~202199" |
| 185 | + NONE = "17130" |
| 186 | + NOT_REPORTED = NOT_REPORTED_CODE |
| 187 | + |
| 188 | + |
| 189 | +class FinalPreTreatmentTCategoryOptions(Enum): |
| 190 | + """Enum for Final Pre-Treatment T Category options.""" |
| 191 | + |
| 192 | + CTX = "17356" |
| 193 | + CT0 = "202203" |
| 194 | + CT1 = "17357" |
| 195 | + CT2 = "17358" |
| 196 | + CT3 = "17359" |
| 197 | + CT4 = "17360" |
| 198 | + NOT_REPORTED = NOT_REPORTED_CODE |
| 199 | + |
| 200 | + |
| 201 | +class FinalPreTreatmentNCategoryOptions(Enum): |
| 202 | + """Enum for Final Pre-Treatment N Category options.""" |
| 203 | + |
| 204 | + CNX = "202201" |
| 205 | + CN0 = "17256" |
| 206 | + CN1 = "17257" |
| 207 | + CN2 = "17258" |
| 208 | + NOT_REPORTED = NOT_REPORTED_CODE |
| 209 | + |
| 210 | + |
| 211 | +class ReasonNoTreatmentRecievedOptions(Enum): |
| 212 | + """Enum for Reason No Treatment Received options.""" |
| 213 | + |
| 214 | + ADVANCED_DISEASE = "99016" |
| 215 | + DIED = "99017" |
| 216 | + MEDICALLY_UNFIT = "99014" |
| 217 | + NO_EVIDENCE_OF_CANCER = "99061" |
| 218 | + PATIENT_CHOICE = "99015" |
| 219 | + UNKNOWN = "99018" |
| 220 | + |
| 221 | + |
| 222 | +class PreviouslyExcisedTumorOptions(Enum): |
| 223 | + """Enum for Previously Excised Tumor options.""" |
| 224 | + |
| 225 | + YES = "17058~~305403" |
| 226 | + NO = "17059" |
| 227 | + UNKNOWN = "202197~~202204" |
| 228 | + NOT_REPORTED = "202140" |
| 229 | + |
| 230 | + |
| 231 | +class TreatmentTypeOptions(Enum): |
| 232 | + """Enum for Treatment Type options.""" |
| 233 | + |
| 234 | + SURGICAL = "202143" |
| 235 | + NON_SURGICAL = "202144" |
| 236 | + |
| 237 | + |
| 238 | +class TreatmentGivenOptions(Enum): |
| 239 | + """Enum for Treatment Given options.""" |
| 240 | + |
| 241 | + CHEMOTHERAPY = "202160~~202184,202217,202218,202219,202220,202221,202222,202223,202224,202225,202226,202227,202228,202287,305395,305397" |
| 242 | + RADIOTHERAPY = "202163~~202183,202217,202218,202287,305395,305397" |
| 243 | + CHEMOTHERAPY_AND_RADIOTHERAPY = "202161~~202217,202218,202287,305395,305397" |
| 244 | + IMMUNOTHERAPY = "202162~~202184,202217,202218,202219,202220,202221,202222,202223,202224,202225,202226,202227,202228,202287,305395,305397" |
| 245 | + SPECIALIST_PALLIATIVE_CARE = "202164~~202184,202217,202218,202219,202220,202221,202222,202223,202224,202225,202226,202227,202228,305395,305397" |
| 246 | + |
| 247 | + |
| 248 | +class CancerTreatmentIntentOptions(Enum): |
| 249 | + """Enum for Cancer Treatment Intent options.""" |
| 250 | + |
| 251 | + CURATIVE = "17370" |
| 252 | + PALLIATIVE = "17371" |
| 253 | + UNCERTAIN = "17372" |
| 254 | + NOT_KNOWN = "17373" |
| 255 | + |
| 256 | + |
| 257 | +class NHSOrPrivateOptions(Enum): |
| 258 | + """Enum for NHS or Private options.""" |
| 259 | + |
| 260 | + NHS = "202153~~202177,202178" |
| 261 | + PRIVATE = "202154~~202179" |
| 262 | + |
| 263 | + |
| 264 | +class TreatmentProviderLookupOptions(Enum): |
| 265 | + """Enum for Treatment Provider lookup options.""" |
| 266 | + |
| 267 | + ADVANCE_NURSE_PRACTITIONER_1 = "51905" |
| 268 | + ADVANCE_NURSE_PRACTITIONER_10 = "51914" |
| 269 | + ADVANCE_NURSE_PRACTITIONER_12 = "52313" |
| 270 | + ADVANCE_NURSE_PRACTITIONER_13 = "52314" |
| 271 | + ADVANCE_NURSE_PRACTITIONER_14 = "52315" |
| 272 | + ADVANCE_NURSE_PRACTITIONER_15 = "52316" |
| 273 | + ADVANCE_NURSE_PRACTITIONER_16 = "52317" |
| 274 | + ADVANCE_NURSE_PRACTITIONER_2 = "51906" |
| 275 | + ADVANCE_NURSE_PRACTITIONER_3 = "51907" |
| 276 | + ADVANCE_NURSE_PRACTITIONER_4 = "51908" |
| 277 | + ADVANCE_NURSE_PRACTITIONER_5 = "51909" |
| 278 | + ADVANCE_NURSE_PRACTITIONER_6 = "51910" |
| 279 | + ADVANCE_NURSE_PRACTITIONER_7 = "51911" |
| 280 | + ADVANCE_NURSE_PRACTITIONER_8 = "51912" |
| 281 | + ADVANCE_NURSE_PRACTITIONER_9 = "51913" |
| 282 | + ADVANCE_NURSE_PRACTITIONER_11 = "52310" |
| 283 | + ALFRED_SQUIRE_HEALTH_CENTRE = "51796" |
| 284 | + ASHMORE_PARK_CLINIC = "51797" |
| 285 | + BCS_RUSSELLS_HALL = "61273" |
| 286 | + BILSTON_HEALTH_CENTRE = "51798" |
| 287 | + BLAKENALL_MEADOW_PRACTICE = "42113" |
| 288 | + BRADLEY_CLINIC = "51799" |
| 289 | + BROOKLANDS_PARADE_CLINIC = "51800" |
| 290 | + BUSHBURY_HEALTH_CENTRE = "51801" |
| 291 | + |
| 292 | + |
| 293 | +class ConsultantLookupOptions(Enum): |
| 294 | + """Enum for Consultant lookup options.""" |
| 295 | + |
| 296 | + B_FRAME = "201" |
| 297 | + DAYDREAM_TRICEPS_ONCOLOGIST = "164" |
| 298 | + DAYDREAM_TRICEPS_SURGEON = "161" |
| 299 | + ENDURANCE_SNACK = "241" |
| 300 | + FROSTY_CRISPING = "461" |
| 301 | + SLAM_DAFFODIL = "181" |
0 commit comments