Skip to content

Commit 675e2d1

Browse files
committed
correcting the locators
1 parent be2443d commit 675e2d1

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

pages/screening_subject_search/diagnostic_test_outcome_page.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from playwright.sync_api import Page, expect
1+
from playwright.sync_api import Page, expect, Locator
22
from pages.base_page import BasePage
33
from enum import StrEnum
44

@@ -18,9 +18,28 @@ def __init__(self, page: Page):
1818
)
1919
self.save_button = self.page.get_by_role("button", name="Save")
2020

21+
def get_test_outcome_locator(self, outcome_name: str) -> Locator:
22+
"""
23+
Get the locator for the test outcome dynamically.
24+
25+
Args:
26+
outcome_name (str): The accessible name or visible text of the test outcome cell.
27+
28+
Returns:
29+
Locator: A Playwright Locator object for the specified test outcome cell.
30+
"""
31+
return self.page.get_by_role("cell", name=outcome_name).nth(1)
32+
2133
def verify_diagnostic_test_outcome(self, outcome_name: str) -> None:
22-
"""Verify that the diagnostic test outcome is visible."""
23-
expect(self.test_outcome_result).to_be_visible()
34+
"""
35+
Verify that the diagnostic test outcome is visible.
36+
37+
Args:
38+
outcome_name (str): The accessible name or visible text of the test outcome cell to verify.
39+
"""
40+
41+
test_outcome_locator = self.get_test_outcome_locator(outcome_name)
42+
expect(test_outcome_locator).to_be_visible()
2443

2544
def select_test_outcome_option(self, option: str) -> None:
2645
"""Select an option from the Outcome of Diagnostic Test dropdown."""

0 commit comments

Comments
 (0)