Skip to content

Commit 6668f64

Browse files
committed
adding steps to scenario 14
1 parent 92d3acd commit 6668f64

10 files changed

+777
-127
lines changed

pages/screening_subject_search/advance_fobt_screening_episode_page.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@ def __init__(self, page: Page):
114114
"button",
115115
name="Refer Another Diagnostic Test after return from Symptomatic Referral",
116116
)
117+
self.refer_to_survelliance_after_symptomatic_referral_button = (
118+
self.page.get_by_role(
119+
"button", name="Refer to Surveillance after Symptomatic Referral"
120+
)
121+
)
122+
self.redirect_to_rerecord_the_outcome_of_symptomatic_referral_button = (
123+
self.page.get_by_role(
124+
"button",
125+
name="Redirect to Re-record the Outcome of Symptomatic Referral",
126+
)
127+
)
117128
# Contact recording locators
118129
self.contact_direction_dropdown = self.page.get_by_label("Contact Direction")
119130
self.contact_made_between_dropdown = self.page.get_by_label(
@@ -135,6 +146,9 @@ def __init__(self, page: Page):
135146
self.ct_colonography_test_type_dropdown = self.page.locator(
136147
"#UI_EXT_TEST_TYPE_38"
137148
)
149+
self.lnpcp_result_from_symptomatic_procedure_button = self.page.get_by_role(
150+
"button", name="LNPCP Result from Symptomatic Procedure"
151+
)
138152

139153
def click_suitable_for_endoscopic_test_button(self) -> None:
140154
"""Click the 'Suitable for Endoscopic Test' button."""
@@ -437,3 +451,19 @@ def click_refer_another_diagnostic_test_after_return_from_symptomatic_referral_b
437451
self.click(
438452
self.refer_another_diagnostic_test_after_return_from_symptomatic_referral_button
439453
)
454+
455+
def click_lnpcp_result_from_symptomatic_procedure_button(self) -> None:
456+
"""Click the 'LNPCP Result from Symptomatic Procedure' button."""
457+
self.safe_accept_dialog(self.lnpcp_result_from_symptomatic_procedure_button)
458+
459+
def click_refer_to_survelliance_after_symptomatic_referral_button(
460+
self,
461+
) -> None:
462+
"""Click the 'Refer to Surveillance after Symptomatic Referral' button."""
463+
self.safe_accept_dialog(
464+
self.refer_to_survelliance_after_symptomatic_referral_button
465+
)
466+
467+
def click_redirect_to_rerecord_the_outcome_of_symptomatic_referral_button(self) -> None:
468+
"""Click the 'Redirect to Re-record the Outcome of Symptomatic Referral' button."""
469+
self.safe_accept_dialog(self.redirect_to_rerecord_the_outcome_of_symptomatic_referral_button)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from playwright.sync_api import Page
2+
from pages.screening_subject_search.result_from_symptomatic_procedure_page import (
3+
ResultFromSymptomaticProcedurePage,
4+
)
5+
6+
7+
class LnpcpResultFromSymptomaticProcedure(ResultFromSymptomaticProcedurePage):
8+
"""LNPCP specific implementation of Result from Symptomatic Procedure Page."""
9+
10+
def __init__(self, page: Page):
11+
super().__init__(page)
12+
self.page = page
Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,14 @@
1-
from datetime import datetime
21
from playwright.sync_api import Page
3-
from pages.base_page import BasePage
4-
from utils.calendar_picker import CalendarPicker
2+
from pages.screening_subject_search.result_from_symptomatic_procedure_page import (
3+
ResultFromSymptomaticProcedurePage,
4+
)
55

66

7-
class NonNeoplasticResultFromSymptomaticProcedurePage(BasePage):
8-
"""Non Neoplastic Result From Symptomatic Procedure Page locators, and methods for interacting with the page."""
7+
class NonNeoplasticResultFromSymptomaticProcedurePage(
8+
ResultFromSymptomaticProcedurePage
9+
):
10+
"""Non-Neoplastic specific implementation of Result from Symptomatic Procedure Page."""
911

1012
def __init__(self, page: Page):
1113
super().__init__(page)
12-
# Non Neoplastic Result From Symptomatic Procedure - page locators
13-
self.date_of_symptomatic_procedure_calendar_button = self.page.locator(
14-
"#UI_SURGERY_DATE__LinkOrButton"
15-
)
16-
self.alert_textbox = self.page.locator("#UI_SPAN_RECALL_TEXT")
17-
self.all_tests = self.page.locator("#UI_ID_RECALL_ANCHOR_DATE_EXT_TEST_ID")
18-
self.save_button = self.page.get_by_role("button", name="Save")
19-
20-
def click_date_of_symptomatic_procedure_calendar_button(self) -> None:
21-
"""Click the date of symptomatic procedure calendar button."""
22-
self.click(self.date_of_symptomatic_procedure_calendar_button)
23-
24-
def enter_date_of_symptomatic_procedure(self, date: datetime) -> None:
25-
"""
26-
Enter the date of the symptomatic procedure.
27-
Args:
28-
date (datetime): The date to be entered in the date of symptomatic procedure field. Example: datetime(2023, 10, 25)
29-
"""
30-
self.click_date_of_symptomatic_procedure_calendar_button()
31-
CalendarPicker(self.page).v1_calender_picker(date)
32-
33-
def assert_text_in_alert_textbox(self, expected_text: str) -> None:
34-
"""
35-
Assert that the expected text is present in the alert textbox.
36-
Args:
37-
expected_text (str): The text expected to be found in the alert textbox. Example: "This is a test alert"
38-
"""
39-
actual_text = self.alert_textbox.inner_text()
40-
assert (
41-
expected_text in actual_text
42-
), f"Expected text '{expected_text}' not found in alert textbox. Actual text: '{actual_text}'"
43-
44-
def select_test_number(self, test_number: int) -> None:
45-
"""
46-
Select a test from the all tests dropdown by its index.
47-
Args:
48-
test_number (int): The index of the test to select (1-based index). Example: if you want to select the 1st test pass in 1
49-
"""
50-
self.click(self.all_tests.nth(test_number - 1))
51-
52-
def click_save_button(self) -> None:
53-
"""Click the 'Save' button."""
54-
self.click(self.save_button)
14+
self.page = page
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from playwright.sync_api import Page
2+
from pages.base_page import BasePage
3+
from datetime import datetime
4+
from utils.calendar_picker import CalendarPicker
5+
6+
7+
class ReferToMdtPage(BasePage):
8+
"""Refer to MDT Page locators, and methods for interacting with the page."""
9+
10+
def __init__(self, page: Page):
11+
super().__init__(page)
12+
self.page = page
13+
14+
# Refer MDT page - page locators
15+
self.mdt_discussion_date_field = self.page.locator("#UI_MDT_DATE_LinkOrButton")
16+
self.mdt_location = self.page.locator("#UI_NS_SITE_SELECT_LINK")
17+
self.visible_ui_results_string = 'select[id^="UI_RESULTS_"]:visible'
18+
self.record_MDT_appointment_button = self.page.locator(
19+
'[name="UI_BUTTON_SAVE"]'
20+
)
21+
22+
def enter_date_in_Mdt_discussion_date_field(self, date: datetime) -> None:
23+
"""
24+
Enters a date in the MDT discussion date field.
25+
Args:
26+
date (datetime): The date to enter in the field.
27+
"""
28+
self.click(self.mdt_discussion_date_field)
29+
CalendarPicker(self.page).v2_calendar_picker(date)
30+
self.mdt_discussion_date_field.press("Tab")
31+
32+
def select_mdt_location_lookup(self, option: int) -> None:
33+
"""
34+
This method is designed to select an option from the MDT location lookup dropdown.
35+
Args:
36+
option (int): The index of the option to select (0-based).
37+
"""
38+
self.click(self.mdt_location)
39+
select_locator = self.page.locator(self.visible_ui_results_string)
40+
select_locator.first.wait_for(state="visible")
41+
# Find all option elements inside the select and click the one at the given index
42+
option_elements = select_locator.first.locator("option")
43+
option_elements.nth(option).wait_for(state="visible")
44+
self.click(option_elements.nth(option))
45+
46+
def click_record_MDT_appointment_button(self) -> None:
47+
"""Clicks the record MDT appointment button."""
48+
self.click(self.record_MDT_appointment_button)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from datetime import datetime
2+
from playwright.sync_api import Page
3+
from pages.base_page import BasePage
4+
from utils.calendar_picker import CalendarPicker
5+
6+
7+
class ResultFromSymptomaticProcedurePage(BasePage):
8+
"""Base class for Result from Symptomatic Procedure pages with common locators and methods."""
9+
10+
def __init__(self, page: Page):
11+
super().__init__(page)
12+
self.page = page
13+
# Result from Symptomatic Procedure Page - page locators
14+
self.date_of_symptomatic_procedure_calendar_button = self.page.locator(
15+
"#UI_SURGERY_DATE__LinkOrButton"
16+
)
17+
self.alert_textbox = self.page.locator("#UI_SPAN_RECALL_TEXT")
18+
self.all_tests = self.page.locator("#UI_ID_RECALL_ANCHOR_DATE_EXT_TEST_ID")
19+
self.save_button = self.page.get_by_role("button", name="Save")
20+
21+
def click_date_of_symptomatic_procedure_calendar_button(self) -> None:
22+
"""Click the date of symptomatic procedure calendar button."""
23+
self.click(self.date_of_symptomatic_procedure_calendar_button)
24+
25+
def enter_date_of_symptomatic_procedure(self, date: datetime) -> None:
26+
"""
27+
Enter the date of the symptomatic procedure.
28+
Args:
29+
date (datetime): The date to be entered in the date of symptomatic procedure field. Example: datetime(2023, 10, 25)
30+
"""
31+
self.click_date_of_symptomatic_procedure_calendar_button()
32+
CalendarPicker(self.page).v1_calender_picker(date)
33+
34+
def assert_text_in_alert_textbox(self, expected_text: str) -> None:
35+
"""
36+
Assert that the expected text is present in the alert textbox.
37+
Args:
38+
expected_text (str): The text expected to be found in the alert textbox. Example: "This is a test alert"
39+
"""
40+
actual_text = self.alert_textbox.inner_text()
41+
assert (
42+
expected_text in actual_text
43+
), f"Expected text '{expected_text}' not found in alert textbox. Actual text: '{actual_text}'"
44+
45+
def select_test_number(self, test_number: int) -> None:
46+
"""
47+
Select a test from the all tests dropdown by its index.
48+
Args:
49+
test_number (int): The index of the test to select (1-based index). Example: if you want to select the 1st test pass in 1
50+
"""
51+
self.click(self.all_tests.nth(test_number - 1))
52+
53+
def click_save_button(self) -> None:
54+
"""Click the 'Save' button."""
55+
self.click(self.save_button)

pages/screening_subject_search/subject_screening_summary_page.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ def change_screening_status(self, status_option: str, reason_option: str) -> Non
446446
self.click_update_subject_data()
447447
self.page.wait_for_timeout(1000)
448448

449+
def assert_reopen_episode_button_not_visible(self) -> None:
450+
"""Assert that the 'Reopen FOBT Screening Episode' button is not visible"""
451+
expect(self.reopen_fobt_screening_episode_button).not_to_be_visible()
452+
449453

450454
class ChangeScreeningStatusOptions(StrEnum):
451455
"""Enum for Change Screening Status options."""

tests/regression/regression_tests/fobt_regression_tests/test_scenario_12.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757
YesNoOptions,
5858
EndoscopyLocationOptions,
5959
)
60-
from pages.screening_subject_search.non_neoplastic_result_from_symptomatic_procedure_page import (
61-
NonNeoplasticResultFromSymptomaticProcedurePage,
62-
)
60+
from pages.screening_subject_search.non_neoplastic_result_from_symptomatic_procedure_page import (NonNeoplasticResultFromSymptomaticProcedurePage)
6361
from utils.subject_demographics import SubjectDemographicUtil
6462
from pages.screening_subject_search.reopen_fobt_screening_episode_page import (
6563
ReopenFOBTScreeningEpisodePage,

0 commit comments

Comments
 (0)