Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pages/base_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,16 @@ def safe_accept_dialog_select_option(self, locator: Locator, option: str) -> Non
locator.select_option(option)
except Exception as e:
logging.error(f"Option selection failed: {e}")

def text_is_visible(self, text: str, is_visible: bool = True) -> None:
"""
Checks whether the given text is visible on the page.
Args:
text (str): The text to check for visibility.
is_visible (bool): If True, asserts text is visible; if False, asserts it is not visible.
"""
locator = self.page.get_by_text(text, exact=True)
if is_visible:
expect(locator).to_be_visible()
else:
expect(locator).not_to_be_visible()
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def __init__(self, page: Page):
self.last_colonoscopy_date_field = self.page.locator(
"input[type='text'][id^='UI_APPT_DATE_']"
)
self.return_to_lynch_after_symptomatic_referral_button = self.page.get_by_role(
"button", name="Return to Lynch after symptomatic referral"
)

def click_review_suitability_for_lynch_surveillance_button(self) -> None:
"""Click on the 'Review suitability for Lynch Surveillance' button."""
Expand Down Expand Up @@ -73,3 +76,7 @@ def enter_lynch_last_colonoscopy_date(self, date: datetime) -> None:
CalendarPicker(self.page).calendar_picker_ddmmyyyy(
date, self.last_colonoscopy_date_field
)

def click_return_to_lynch_after_symptomatic_referral_button(self) -> None:
"""Click on the 'Return to Lynch after symptomatic referral' button."""
self.safe_accept_dialog(self.return_to_lynch_after_symptomatic_referral_button)
Loading