Skip to content

Commit d18c205

Browse files
Converting selenium tests to playwright
1 parent 9ebe171 commit d18c205

File tree

6 files changed

+1080
-251
lines changed

6 files changed

+1080
-251
lines changed

docs/utility-guides/InvestigationDataset.md

Lines changed: 218 additions & 110 deletions
Large diffs are not rendered by default.

pages/datasets/investigation_dataset_page.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
get_investigation_dataset_polyp_algorithm_size,
77
)
88
from typing import Optional
9+
import logging
910

1011

1112
class InvestigationDatasetsPage(BasePage):
@@ -361,6 +362,21 @@ def select_polyp1_pathologist_option_index(self, option: int) -> None:
361362
option_elements.nth(option).wait_for(state="visible")
362363
self.click(option_elements.nth(option))
363364

365+
def select_loopup_option_index(self, option: int) -> None:
366+
"""
367+
This method is designed to select a lookup option by index.
368+
It clicks on the lookup link and selects the given option by index.
369+
370+
Args:
371+
option (int): The index of the option to select from the lookup options.
372+
"""
373+
select_locator = self.page.locator(self.visible_ui_results_string)
374+
select_locator.first.wait_for(state="visible")
375+
# Find all option elements inside the select and click the one at the given index
376+
option_elements = select_locator.first.locator("option")
377+
option_elements.nth(option).wait_for(state="visible")
378+
self.click(option_elements.nth(option))
379+
364380
def click_edit_dataset_button(self) -> None:
365381
"""
366382
This method is designed to click on the edit dataset button.
@@ -387,6 +403,10 @@ def assert_polyp_alogrithm_size(
387403
)
388404

389405
# Assert that the actual value matches the expected value
406+
logging.info(
407+
f"Checking Polyp {polyp_number} algorithm size: actual={actual_value}, expected={expected_value}"
408+
)
409+
390410
if actual_value is None or expected_value is None:
391411
assert (
392412
actual_value == expected_value
@@ -415,6 +435,10 @@ def assert_polyp_categrory(
415435
)
416436

417437
# Assert that the actual value matches the expected value
438+
logging.info(
439+
f"Checking Polyp {polyp_number} category: actual={actual_value}, expected={expected_value}"
440+
)
441+
418442
if actual_value is None or expected_value is None:
419443
assert (
420444
actual_value == expected_value
@@ -443,6 +467,20 @@ def get_dataset_id(self) -> int:
443467
dataset_id = -1
444468
return dataset_id
445469

470+
def click_polyp_add_intervention_button(self, polyp_number: int) -> None:
471+
"""
472+
Clicks the add intervention button for the specified polyp number.
473+
474+
Args:
475+
polyp_number (int): The number of the polyp.
476+
"""
477+
478+
self.click(
479+
self.page.locator(f"#spanPolypInterventionLink{polyp_number}").get_by_role(
480+
"link", name="Add Intervention"
481+
)
482+
)
483+
446484

447485
class SiteLookupOptions(StrEnum):
448486
"""Enum for site lookup options"""

0 commit comments

Comments
 (0)