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
344 changes: 226 additions & 118 deletions docs/utility-guides/InvestigationDataset.md

Large diffs are not rendered by default.

44 changes: 42 additions & 2 deletions pages/datasets/investigation_dataset_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
get_investigation_dataset_polyp_algorithm_size,
)
from typing import Optional
import logging


class InvestigationDatasetsPage(BasePage):
Expand All @@ -15,6 +16,8 @@ def __init__(self, page: Page):
super().__init__(page)
self.page = page

self.add_intervention_string = "Add Intervention"

# Investigation datasets page locators
self.site_lookup_link = self.page.locator("#UI_SITE_SELECT_LINK")
self.practitioner_link = self.page.locator("#UI_SSP_PIO_SELECT_LINK")
Expand Down Expand Up @@ -47,11 +50,11 @@ def __init__(self, page: Page):
self.show_failure_information_details = self.page.locator("#anchorFailure")
self.add_polyp_button = self.page.get_by_role("button", name="Add Polyp")
self.polyp1_add_intervention_button = self.page.get_by_role(
"link", name="Add Intervention"
"link", name=self.add_intervention_string
)
self.polyp2_add_intervention_button = self.page.locator(
"#spanPolypInterventionLink2"
).get_by_role("link", name="Add Intervention")
).get_by_role("link", name=self.add_intervention_string)
self.dataset_complete_checkbox = self.page.locator("#radDatasetCompleteYes")
self.dataset_incomplete_checkbox = self.page.locator("#radDatasetCompleteNo")
self.save_dataset_button = self.page.locator(
Expand Down Expand Up @@ -361,6 +364,21 @@ def select_polyp1_pathologist_option_index(self, option: int) -> None:
option_elements.nth(option).wait_for(state="visible")
self.click(option_elements.nth(option))

def select_loopup_option_index(self, option: int) -> None:
"""
This method is designed to select a lookup option by index.
It clicks on the lookup link and selects the given option by index.

Args:
option (int): The index of the option to select from the lookup options.
"""
select_locator = self.page.locator(self.visible_ui_results_string)
select_locator.first.wait_for(state="visible")
# Find all option elements inside the select and click the one at the given index
option_elements = select_locator.first.locator("option")
option_elements.nth(option).wait_for(state="visible")
self.click(option_elements.nth(option))

def click_edit_dataset_button(self) -> None:
"""
This method is designed to click on the edit dataset button.
Expand All @@ -387,6 +405,10 @@ def assert_polyp_alogrithm_size(
)

# Assert that the actual value matches the expected value
logging.info(
f"Checking Polyp {polyp_number} algorithm size: actual={actual_value}, expected={expected_value}"
)

if actual_value is None or expected_value is None:
assert (
actual_value == expected_value
Expand Down Expand Up @@ -415,6 +437,10 @@ def assert_polyp_categrory(
)

# Assert that the actual value matches the expected value
logging.info(
f"Checking Polyp {polyp_number} category: actual={actual_value}, expected={expected_value}"
)

if actual_value is None or expected_value is None:
assert (
actual_value == expected_value
Expand Down Expand Up @@ -443,6 +469,20 @@ def get_dataset_id(self) -> int:
dataset_id = -1
return dataset_id

def click_polyp_add_intervention_button(self, polyp_number: int) -> None:
"""
Clicks the add intervention button for the specified polyp number.

Args:
polyp_number (int): The number of the polyp.
"""

self.click(
self.page.locator(f"#spanPolypInterventionLink{polyp_number}").get_by_role(
"link", name=self.add_intervention_string
)
)


class SiteLookupOptions(StrEnum):
"""Enum for site lookup options"""
Expand Down
18 changes: 18 additions & 0 deletions pages/screening_subject_search/contact_with_patient_page.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from playwright.sync_api import Page
from pages.base_page import BasePage
from utils.calendar_picker import CalendarPicker
from datetime import datetime


class ContactWithPatientPage(BasePage):
Expand Down Expand Up @@ -84,3 +86,19 @@ def select_outcome_dropdown_option(self, outcome: str) -> None:
def click_save_button(self) -> None:
"""Click the 'Save' button to save the contact with patient form."""
self.click(self.save_button)

def record_post_investigation_appointment_not_required(self) -> None:
"""
Record a post-investigation appointment not required contact.
"""
self.select_direction_dropdown_option("To patient")
self.select_caller_id_dropdown_index_option(1)
self.click_calendar_button()
CalendarPicker(self.page).v1_calender_picker(datetime.today())
self.enter_start_time("11:00")
self.enter_end_time("12:00")
self.enter_discussion_record_text("Test Automation")
self.select_outcome_dropdown_option(
"Post-investigation Appointment Not Required"
)
self.click_save_button()
Loading