Skip to content

Commit 7bd268b

Browse files
committed
Merge remote-tracking branch 'origin' into feature/BCSS-21311-fobt-regression-scenario-8
# Conflicts: # utils/appointments.py # utils/oracle/subject_selection_query_builder.py
2 parents 4d59a06 + fae5902 commit 7bd268b

File tree

12 files changed

+1139
-125
lines changed

12 files changed

+1139
-125
lines changed

pages/datasets/investigation_dataset_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def expect_text_to_be_visible(self, text: str) -> None:
338338
Args:
339339
text (str): The text to check for visibility.
340340
"""
341-
expect(self.page.get_by_text(text)).to_contain_text(text)
341+
expect(self.page.get_by_text(text)).to_contain_text(text, timeout=10000)
342342

343343
def select_polyp1_pathology_provider_option_index(self, option: int) -> None:
344344
"""

pages/screening_practitioner_appointments/book_appointment_page.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from playwright.sync_api import Page, expect
22
from pages.base_page import BasePage
33
from utils.table_util import TableUtils
4+
from datetime import datetime
5+
from utils.calendar_picker import CalendarPicker
46

57

68
class BookAppointmentPage(BasePage):
@@ -18,10 +20,17 @@ def __init__(self, page: Page):
1820
self.save_button = self.page.get_by_role("button", name="Save")
1921
self.appointments_table = TableUtils(self.page, "#displayRS")
2022
self.current_month_displayed = self.page.locator("#MONTH_AND_YEAR")
23+
self.screening_practitioner_dropdown = self.page.locator("#UI_NEW_PRACTITIONER")
2124

2225
self.appointment_cell_locators = self.page.locator("input.twoColumnCalendar")
23-
self.available_background_colour = "rgb(102, 255, 153)"
24-
self.some_available_background_colour = "rgb(255, 220, 144)"
26+
self.appointment_fully_available_colour = "rgb(102, 255, 153)" # Mint Green
27+
self.appointment_partially_available_colour = (
28+
"rgb(255, 220, 144)" # Peach Orange
29+
)
30+
self.appointment_date_input = self.page.locator("#UI_NEW_APPT_DATE")
31+
self.appointment_time_start_time_input = self.page.locator(
32+
"#UI_NEW_APPT_TIME_FROM"
33+
)
2534

2635
def select_screening_centre_dropdown_option(self, screening_centre: str) -> None:
2736
"""Selects the screening centre from the dropdown."""
@@ -38,15 +47,39 @@ def choose_appointment_time(self) -> None:
3847

3948
def click_save_button(self) -> None:
4049
"""Clicks the save button."""
41-
self.click(self.save_button)
50+
self.safe_accept_dialog(self.save_button)
4251

4352
def appointment_booked_confirmation_is_displayed(self, message: str) -> None:
4453
"""Checks if the appointment booked confirmation message is displayed."""
45-
expect(self.page.get_by_text(message)).to_be_visible()
54+
expect(self.page.get_by_text(message)).to_be_visible(timeout=10000)
4655

4756
def get_current_month_displayed(self) -> str:
4857
"""Returns the current month displayed in the calendar."""
4958
current_month_displayed_content = self.current_month_displayed.text_content()
5059
if current_month_displayed_content is None:
5160
raise ValueError("Current month displayed is 'None'")
5261
return current_month_displayed_content
62+
63+
def select_screening_practitioner_dropdown_option(self, index: int) -> None:
64+
"""Selects the screening practitioner from the dropdown by index."""
65+
self.screening_practitioner_dropdown.select_option(index=index)
66+
67+
def enter_appointment_date(self, date: datetime) -> None:
68+
"""
69+
Enters the appointment date in the date input field and clicks 'Enter'.
70+
Args:
71+
date (datetime): The date to enter.
72+
"""
73+
CalendarPicker(self.page).calendar_picker_ddmmyyyy(
74+
date, self.appointment_date_input
75+
)
76+
self.appointment_date_input.press("Enter")
77+
78+
def enter_appointment_start_time(self, time: str) -> None:
79+
"""
80+
Enters the appointment start time in the time input field and clicks 'Enter'.
81+
Args:
82+
time (str): The time to enter in the format 'HH:MM'.
83+
"""
84+
self.appointment_time_start_time_input.fill(time)
85+
self.appointment_time_start_time_input.press("Enter")

pages/screening_subject_search/advance_fobt_screening_episode_page.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ def __init__(self, page: Page):
1616
"button", name="Suitable for Endoscopic Test"
1717
)
1818
self.calendar_button = self.page.get_by_role("button", name="Calendar")
19-
self.test_type_dropdown = self.page.locator("#UI_EXT_TEST_TYPE_2233")
20-
self.test_type_dropdown_2 = self.page.locator("#UI_EXT_TEST_TYPE_4325")
21-
self.advance_checkbox = self.page.get_by_label(
19+
self.test_type_dropdown = self.page.locator("[id^='UI_EXT_TEST_TYPE_']")
20+
self.advance_checkbox_label = self.page.get_by_label(
2221
"There are some events available which should only be used in exceptional circumstances. If you wish to see them, check this box"
2322
)
2423
self.invite_for_diagnostic_test_button = self.page.get_by_role(
@@ -48,7 +47,7 @@ def __init__(self, page: Page):
4847
self.amend_diagnosis_date_button = self.page.get_by_role(
4948
"button", name="Amend Diagnosis Date"
5049
)
51-
self.advance_checkbox_v2 = self.page.get_by_role("checkbox")
50+
self.advance_checkbox_label_v2 = self.page.get_by_role("checkbox")
5251
self.subsequent_assessment_appointment_required_dropdown = (
5352
self.page.get_by_role("combobox")
5453
)
@@ -74,6 +73,9 @@ def __init__(self, page: Page):
7473
self.cancel_diagnostic_test_button = self.page.get_by_role(
7574
"button", name="Cancel Diagnostic Test"
7675
)
76+
self.post_investigation_appointment_required_button = self.page.get_by_role(
77+
"button", name="Post-investigation Appointment Required"
78+
)
7779

7880
def click_suitable_for_endoscopic_test_button(self) -> None:
7981
"""Click the 'Suitable for Endoscopic Test' button."""
@@ -87,10 +89,6 @@ def select_test_type_dropdown_option(self, text: str) -> None:
8789
"""Select the test type from the dropdown."""
8890
self.test_type_dropdown.select_option(label=text)
8991

90-
def select_test_type_dropdown_option_2(self, text: str) -> None:
91-
"""Select the test type from the dropdown."""
92-
self.test_type_dropdown_2.select_option(label=text)
93-
9492
def click_invite_for_diagnostic_test_button(self) -> None:
9593
"""Click the 'Invite for Diagnostic Test' button."""
9694
self.safe_accept_dialog(self.invite_for_diagnostic_test_button)
@@ -147,11 +145,11 @@ def click_record_contact_with_patient_button(self) -> None:
147145

148146
def check_advance_checkbox(self) -> None:
149147
"""Selects the 'Advance FOBT' checkbox"""
150-
self.advance_checkbox.check()
148+
self.advance_checkbox_label.check()
151149

152150
def click_amend_diagnosis_date_button(self) -> None:
153151
"""Checks the 'Advance FOBT' checkbox and clicks the 'Amend Diagnosis Date' button."""
154-
self.advance_checkbox_v2.check()
152+
self.advance_checkbox_label_v2.check()
155153
self.click(self.amend_diagnosis_date_button)
156154

157155
def click_and_select_subsequent_assessment_appointment_required(
@@ -273,3 +271,7 @@ def click_not_suitable_for_diagnostic_tests_button(self) -> None:
273271
def click_cancel_diagnostic_test_button(self) -> None:
274272
"""Click the 'Cancel Diagnostic Test' button."""
275273
self.safe_accept_dialog(self.cancel_diagnostic_test_button)
274+
275+
def click_post_investigation_appointment_required_button(self) -> None:
276+
"""Click the 'Post-investigation Appointment Required' button."""
277+
self.safe_accept_dialog(self.post_investigation_appointment_required_button)

pages/screening_subject_search/contact_with_patient_page.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from playwright.sync_api import Page
1+
from playwright.sync_api import Page, expect
22
from pages.base_page import BasePage
33
from utils.calendar_picker import CalendarPicker
44
from datetime import datetime
@@ -142,3 +142,25 @@ def record_contact(self, outcome: str, patient_contacted: str = "Yes") -> None:
142142
self.select_patient_contacted_dropdown_option(patient_contacted)
143143
self.select_outcome_dropdown_option(outcome)
144144
self.click_save_button()
145+
146+
def verify_contact_with_patient_page_is_displayed(self) -> None:
147+
"""Verify that the 'Contact With Patient' page is displayed."""
148+
expect(self.bowel_cancer_screening_ntsh_page_title).to_have_text(
149+
"Contact with Patient", timeout=10000
150+
)
151+
152+
def verify_outcome_select_options(self, options: list) -> None:
153+
"""
154+
Verifies that the 'Outcome' dropdown contains the expected options.
155+
Args:
156+
options (list): A list containing all of the expected options in the dropdown.
157+
Raises:
158+
AssertionError: If any of the expected options are missing.
159+
"""
160+
actual_options = self.outcome_dropdown.locator("option").all_text_contents()
161+
missing = [val for val in options if val not in actual_options]
162+
163+
assert not missing, (
164+
f"Missing expected dropdown values in the outcome options: {missing}."
165+
f"Actual options: {actual_options}"
166+
)

pages/screening_subject_search/record_diagnosis_date_page.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def __init__(self, page: Page):
1515
self.diagnosis_date_field = self.page.locator("#diagnosisDate")
1616
self.reason_dropdown = self.page.locator("#reason")
1717
self.save_button = self.page.get_by_role("button", name="Save")
18+
self.confirm_button = self.page.get_by_role("button", name="Confirm")
1819

1920
def enter_date_in_diagnosis_date_field(self, date: datetime) -> None:
2021
"""
@@ -29,6 +30,8 @@ def enter_date_in_diagnosis_date_field(self, date: datetime) -> None:
2930
def click_save_button(self) -> None:
3031
"""Clicks the save button."""
3132
self.click(self.save_button)
33+
if self.confirm_button.is_visible():
34+
self.click(self.confirm_button)
3235

3336
def get_alert_message(self) -> str:
3437
"""

pages/screening_subject_search/reopen_fobt_screening_episode_page.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ def __init__(self, page: Page):
2121
self.reopen_following_non_response_button = self.page.get_by_role(
2222
"button", name="Reopen following Non-Response"
2323
)
24+
self.reopen_to_confirm_diagnostic_test_result_and_outcome_button = (
25+
self.page.get_by_role(
26+
"button", name="Reopen to Confirm Diagnostic Test Result and Outcome"
27+
)
28+
)
2429

2530
def click_reopen_to_book_an_assessment_button(self) -> None:
2631
"""Click the 'Reopen to book an assessment' button."""
@@ -37,3 +42,9 @@ def click_reopen_due_to_subject_or_patient_decision(self) -> None:
3742
def click_reopen_following_non_response_button(self) -> None:
3843
"""Click the 'Reopen following Non-Response' button."""
3944
self.safe_accept_dialog(self.reopen_following_non_response_button)
45+
46+
def click_reopen_to_confirm_diagnostic_test_result_and_outcome_button(self) -> None:
47+
"""Click the 'Reopen to Confirm Diagnostic Test Result and Outcome' button."""
48+
self.safe_accept_dialog(
49+
self.reopen_to_confirm_diagnostic_test_result_and_outcome_button
50+
)

0 commit comments

Comments
 (0)