|
1 | 1 | from playwright.sync_api import Page |
| 2 | +from pages.base_page import BasePage |
2 | 3 | from datetime import datetime |
3 | 4 |
|
4 | | -class HandoverIntoSymptomaticCarePage: |
| 5 | +class HandoverIntoSymptomaticCarePage(BasePage): |
| 6 | + """ |
| 7 | + HandoverIntoSymptomaticCarePage class for interacting with the 'Handover Into Symptomatic Care' page elements. |
| 8 | + """ |
5 | 9 | def __init__(self, page: Page): |
6 | 10 | self.page = page |
7 | 11 | self.referral_dropdown = self.page.get_by_label("Referral") |
8 | 12 | self.calendar_button = self.page.get_by_role("button", name="Calendar") |
9 | 13 | self.consultant_link = self.page.locator("#UI_NS_CONSULTANT_PIO_SELECT_LINK") |
10 | | - self.consultant_option = lambda value: self.page.locator(f'[value="{value}"]:visible') |
11 | 14 | self.notes_textbox = self.page.get_by_role("textbox", name="Notes") |
12 | 15 | self.save_button = self.page.get_by_role("button", name="Save") |
13 | 16 |
|
14 | | - def select_referral_dropdown_option(self, value: str): |
| 17 | + def select_referral_dropdown_option(self, value: str) -> None: |
| 18 | + """Select a given option from the Referral dropdown.""" |
15 | 19 | self.referral_dropdown.select_option(value) |
16 | 20 |
|
17 | 21 | def click_calendar_button(self) -> None: |
| 22 | + """Click the calendar button to open the calendar picker.""" |
18 | 23 | self.click(self.calendar_button) |
19 | 24 |
|
20 | | - def select_consultant(self, value: str): |
| 25 | + def select_consultant(self, value: str) -> None: |
| 26 | + """Select a consultant from the dropdown.""" |
21 | 27 | self.consultant_link.click() |
22 | | - option = self.consultant_option(value) |
23 | | - option.wait_for(state="visible") |
24 | | - option.click() |
| 28 | + option_locator = self.page.locator(f'[value="{value}"]:visible') |
| 29 | + option_locator.wait_for(state="visible") |
| 30 | + self.click(option_locator) |
25 | 31 |
|
26 | | - def fill_notes(self, notes: str): |
| 32 | + def fill_notes(self, notes: str) -> None: |
| 33 | + """Fill the notes textbox with the given text.""" |
27 | 34 | self.notes_textbox.click() |
28 | 35 | self.notes_textbox.fill(notes) |
29 | 36 |
|
30 | | - def click_save_button(self): |
31 | | - self.page.once("dialog", lambda dialog: dialog.accept()) |
32 | | - self.click(self.save_button) |
33 | | - |
| 37 | + def click_save_button(self) -> None: |
| 38 | + """Click the save button to save the changes.""" |
| 39 | + self.safe_accept_dialog(self.save_button) |
0 commit comments