Skip to content

Commit fae5902

Browse files
Adding scenario 10 and any relevant utils / poms (#140)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> Adding scenario 10 from FOBTREgressionTests.feature. ## Context <!-- Why is this change required? What problem does it solve? --> Adding scenario 10 from FOBTREgressionTests.feature. ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [x] Refactoring (non-breaking change) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I am familiar with the [contributing guidelines](https://github.com/nhs-england-tools/playwright-python-blueprint/blob/main/CONTRIBUTING.md) - [x] I have followed the code style of the project - [x] I have added tests to cover my changes (where appropriate) - [x] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.
1 parent a42b0da commit fae5902

File tree

12 files changed

+1139
-111
lines changed

12 files changed

+1139
-111
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
@@ -15,9 +15,8 @@ def __init__(self, page: Page):
1515
"button", name="Suitable for Endoscopic Test"
1616
)
1717
self.calendar_button = self.page.get_by_role("button", name="Calendar")
18-
self.test_type_dropdown = self.page.locator("#UI_EXT_TEST_TYPE_2233")
19-
self.test_type_dropdown_2 = self.page.locator("#UI_EXT_TEST_TYPE_4325")
20-
self.advance_checkbox = self.page.get_by_label(
18+
self.test_type_dropdown = self.page.locator("[id^='UI_EXT_TEST_TYPE_']")
19+
self.advance_checkbox_label = self.page.get_by_label(
2120
"There are some events available which should only be used in exceptional circumstances. If you wish to see them, check this box"
2221
)
2322
self.invite_for_diagnostic_test_button = self.page.get_by_role(
@@ -47,7 +46,7 @@ def __init__(self, page: Page):
4746
self.amend_diagnosis_date_button = self.page.get_by_role(
4847
"button", name="Amend Diagnosis Date"
4948
)
50-
self.advance_checkbox_v2 = self.page.get_by_role("checkbox")
49+
self.advance_checkbox_label_v2 = self.page.get_by_role("checkbox")
5150
self.subsequent_assessment_appointment_required_dropdown = (
5251
self.page.get_by_role("combobox")
5352
)
@@ -73,6 +72,9 @@ def __init__(self, page: Page):
7372
self.cancel_diagnostic_test_button = self.page.get_by_role(
7473
"button", name="Cancel Diagnostic Test"
7574
)
75+
self.post_investigation_appointment_required_button = self.page.get_by_role(
76+
"button", name="Post-investigation Appointment Required"
77+
)
7678

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

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

147145
def check_advance_checkbox(self) -> None:
148146
"""Selects the 'Advance FOBT' checkbox"""
149-
self.advance_checkbox.check()
147+
self.advance_checkbox_label.check()
150148

151149
def click_amend_diagnosis_date_button(self) -> None:
152150
"""Checks the 'Advance FOBT' checkbox and clicks the 'Amend Diagnosis Date' button."""
153-
self.advance_checkbox_v2.check()
151+
self.advance_checkbox_label_v2.check()
154152
self.click(self.amend_diagnosis_date_button)
155153

156154
def click_and_select_subsequent_assessment_appointment_required(
@@ -193,3 +191,7 @@ def click_not_suitable_for_diagnostic_tests_button(self) -> None:
193191
def click_cancel_diagnostic_test_button(self) -> None:
194192
"""Click the 'Cancel Diagnostic Test' button."""
195193
self.safe_accept_dialog(self.cancel_diagnostic_test_button)
194+
195+
def click_post_investigation_appointment_required_button(self) -> None:
196+
"""Click the 'Post-investigation Appointment Required' button."""
197+
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)