|
| 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" |
0 commit comments