Skip to content

Commit 01ffa38

Browse files
committed
Merge branch 'feature/BCSS-22016-surveillanceregressiontests-scenario-4' into feature/BCSS-22017-surveillanceregressiontests-scenario-5
2 parents 38b3b6c + 0ea0fd9 commit 01ffa38

File tree

3 files changed

+495
-7
lines changed

3 files changed

+495
-7
lines changed

pages/datasets/subject_datasets_page.py

Lines changed: 23 additions & 7 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

44

@@ -24,20 +24,36 @@ def __init__(self, page: Page):
2424
self.add_link = self.page.get_by_role("link", name="Add")
2525

2626
def click_add_link(self) -> None:
27-
"""Clicks on the 'Add' link on the Subject Datasets Page."""
28-
self.click(self.add_link)
27+
"""Clicks on the first 'Add' link on the Subject Datasets Page."""
28+
self.click(self.add_link.first)
2929

3030
def click_colonoscopy_show_datasets(self) -> None:
31-
"""Clicks on the 'Show Dataset' button for the Colonoscopy Assessment row on the Subject Datasets Page."""
32-
self.click(self.colonoscopy_show_dataset_button)
31+
"""
32+
Clicks on the 'Show Dataset(s)' button for the Colonoscopy Assessment row on the Subject Datasets Page.
33+
If the button text is "Show Datasets", also clicks the first 'Add' link.
34+
"""
35+
# Find the DatasetHeader div with Investigation
36+
header = self.page.locator(
37+
"div.DatasetHeader h4:has-text('Colonoscopy Assessment')"
38+
)
39+
self.click_show_datasets_button(header)
3340

3441
def click_investigation_show_datasets(self) -> None:
3542
"""
3643
Clicks on the 'Show Dataset(s)' link for the Investigation row on the Subject Datasets Page.
37-
If the button text is "Show Datasets", also clicks the 'Add' link.
44+
If the button text is "Show Datasets", also clicks the first 'Add' link.
3845
"""
3946
# Find the DatasetHeader div with Investigation
4047
header = self.page.locator("div.DatasetHeader h4:has-text('Investigation')")
48+
self.click_show_datasets_button(header)
49+
50+
def click_show_datasets_button(self, header: Locator) -> None:
51+
"""
52+
Clicks on the 'Show Dataset(s)' link for the specified header.
53+
If the button text is "Show Datasets", also clicks the first 'Add' link.
54+
Args:
55+
header (Locator): The Locator for the DatasetHeader h4 element.
56+
"""
4157
header.wait_for(state="visible", timeout=10000)
4258
# Get the dataset count text from the span inside the h4
4359
dataset_count_text = header.locator("span.DatasetSubLabel").text_content()
@@ -49,7 +65,7 @@ def click_investigation_show_datasets(self) -> None:
4965
show_link.wait_for(state="visible", timeout=10000)
5066
self.click(show_link)
5167
# If plural, also click Add
52-
if dataset_count_text and "2 Datasets" in dataset_count_text:
68+
if dataset_count_text and "Datasets" in dataset_count_text:
5369
self.click_add_link()
5470

5571
def check_investigation_dataset_complete(self) -> None:

pages/screening_subject_search/advance_surveillance_episode_page.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ def __init__(self, page: Page):
2121
name="Discharge from Screening and Surveillance - Clinical Decision",
2222
)
2323
)
24+
self.discharge_from_screening_and_surveillance_patient_choice_button = (
25+
self.page.get_by_role(
26+
"button",
27+
name="Discharge from Screening and Surveillance - Patient Choice",
28+
)
29+
)
30+
2431
self.book_surveillance_appointment_button = self.page.get_by_role(
2532
"button", name="Book Surveillance Appointment"
2633
)
@@ -41,6 +48,12 @@ def click_discharge_from_screening_and_surveillance_clinical_decision_button(
4148
self.discharge_from_screening_and_surveillance_clinical_decision_button
4249
)
4350

51+
def click_discharge_from_screening_and_surveillance_patient_choice_button(
52+
self,
53+
) -> None:
54+
"""Click on the 'Discharge from Screening and Surveillance - Patient Choice' button."""
55+
self.click(self.discharge_from_screening_and_surveillance_patient_choice_button)
56+
4457
def click_book_surveillance_appointment_button(self) -> None:
4558
"""Click on the 'Book Surveillance Appointment' button."""
4659
self.safe_accept_dialog(self.book_surveillance_appointment_button)

0 commit comments

Comments
 (0)