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
16 changes: 15 additions & 1 deletion pages/base_page.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from playwright.sync_api import Page, expect, Locator, Dialog
import logging
import pytest


class BasePage:
Expand Down Expand Up @@ -271,7 +272,7 @@ def handle_dialog(dialog: Dialog):
try:
self.click(locator)
except Exception as e:
logging.error(f"Click failed: {e}")
pytest.fail(f"Click failed: {e}")

def assert_dialog_text(self, expected_text: str, accept: bool = False) -> None:
"""
Expand Down Expand Up @@ -342,3 +343,16 @@ def text_is_visible(self, text: str, is_visible: bool = True) -> None:
expect(locator).to_be_visible()
else:
expect(locator).not_to_be_visible()

def button_with_value_present(self, button_value: str, is_present: bool) -> None:
"""
Asserts whether a button is visble
Args:
button_value (str): The string value of the button
is_present: True if it should be present, False if otherwise
"""
button_locator = self.page.get_by_role("button", name=button_value)
if is_present:
assert button_locator.is_visible()
else:
assert not button_locator.is_visible()
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def __init__(self, page: Page):
self.self_refer_lynch_surveillance_button = self.page.get_by_role(
"button", name="Self-refer Lynch Surveillance"
)
self.self_refer_button = self.page.locator("#self_ref_button")

def wait_for_page_title(self) -> None:
"""Waits for the page to be the Subject Screening Summary"""
Expand Down Expand Up @@ -489,6 +490,11 @@ def click_self_refer_lynch_surveillance_button(self) -> None:
self.safe_accept_dialog(self.self_refer_lynch_surveillance_button)
self.page.wait_for_timeout(1000)

def click_self_refer_button(self) -> None:
"""Click on the 'Self-refer' button"""
self.safe_accept_dialog(self.self_refer_button)
self.page.wait_for_timeout(1000)

def change_screening_status(self, status_option: str, reason_option: str) -> None:
"""
Change the screening status of the subject by selecting the given status and reason options,
Expand Down
Loading