Skip to content

Commit 493ae29

Browse files
authored
Feature/bcss 21309 fobt regression scenario 6 (#137)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> Migration of fobt regression tests scenario 6 from selenium to playwright plus updates to any POMs / Utils as required ## Context <!-- Why is this change required? What problem does it solve? --> This is part of the selenium to playwright migration work ## 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 52ecc12 commit 493ae29

File tree

11 files changed

+704
-74
lines changed

11 files changed

+704
-74
lines changed

pages/datasets/colonoscopy_dataset_page.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
from enum import Enum
44

55

6+
class FitForColonoscopySspOptions(Enum):
7+
YES = "17058"
8+
NO = "17059"
9+
UNABLE_TO_ASSESS = "17954"
10+
11+
612
class ColonoscopyDatasetsPage(BasePage):
713
"""Colonoscopy Datasets Page locators, and methods for interacting with the page"""
814

@@ -44,16 +50,19 @@ def select_asa_grade_option(self, option: str) -> None:
4450
"""
4551
self.select_asa_grade_dropdown.select_option(option)
4652

47-
def select_fit_for_colonoscopy_option(self, option: str) -> None:
53+
def select_fit_for_colonoscopy_option(
54+
self, option: FitForColonoscopySspOptions
55+
) -> None:
4856
"""
49-
This method is designed to select a specific option from the colonoscopy dataset page, Fit for Colonoscopy (SSP) dropdown menu.
57+
Selects a specific option from the 'Fit for Colonoscopy (SSP)' dropdown.
58+
5059
Args:
51-
option (str): The option to be selected. This should be a string that matches one of the available options in the dropdown menu.
52-
Valid options are: "YES", "NO", or "UNABLE_TO_ASSESS".
60+
option (FitForColonoscopySspOptions): Enum member representing the desired option.
61+
5362
Returns:
5463
None
5564
"""
56-
self.select_fit_for_colonoscopy_dropdown.select_option(option)
65+
self.select_fit_for_colonoscopy_dropdown.select_option(option.value)
5766

5867
def click_dataset_complete_radio_button_yes(self) -> None:
5968
"""Clicks the 'Yes' radio button for the dataset complete option."""
@@ -72,9 +81,3 @@ class AsaGradeOptions(Enum):
7281
MORIBUND = "17013"
7382
NOT_APPLICABLE = "17014"
7483
NOT_KNOWN = "17015"
75-
76-
77-
class FitForColonoscopySspOptions(Enum):
78-
YES = "17058"
79-
NO = "17059"
80-
UNABLE_TO_ASSESS = "17954"

pages/screening_subject_search/advance_fobt_screening_episode_page.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ def __init__(self, page: Page):
1717
self.calendar_button = self.page.get_by_role("button", name="Calendar")
1818
self.test_type_dropdown = self.page.locator("#UI_EXT_TEST_TYPE_2233")
1919
self.test_type_dropdown_2 = self.page.locator("#UI_EXT_TEST_TYPE_4325")
20-
self.advance_checkbox = self.page.get_by_label("There are some events available which should only be used in exceptional circumstances. If you wish to see them, check this box")
20+
self.advance_checkbox = self.page.get_by_label(
21+
"There are some events available which should only be used in exceptional circumstances. If you wish to see them, check this box"
22+
)
2123
self.invite_for_diagnostic_test_button = self.page.get_by_role(
2224
"button", name="Invite for Diagnostic Test >>"
2325
)
@@ -42,12 +44,23 @@ def __init__(self, page: Page):
4244
self.record_contact_with_patient_button = self.page.get_by_role(
4345
"button", name="Record Contact with Patient"
4446
)
47+
self.suitable_for_radiological_test_button = self.page.get_by_role(
48+
"button", name="Suitable for Radiological Test"
49+
)
50+
self.decision_not_to_continue_with_diagnostic_test_button = (
51+
self.page.get_by_role(
52+
"button", name="Decision not to Continue with Diagnostic Test"
53+
)
54+
)
55+
self.waiting_decision_to_proceed_with_diagnostic_test_button = (
56+
self.page.get_by_role(
57+
"button", name="Waiting Decision to Proceed with Diagnostic Test"
58+
)
59+
)
4560

4661
def click_suitable_for_endoscopic_test_button(self) -> None:
4762
"""Click the 'Suitable for Endoscopic Test' button."""
48-
AdvanceFOBTScreeningEpisodePage(self.page).safe_accept_dialog(
49-
self.suitable_for_endoscopic_test_button
50-
)
63+
self.safe_accept_dialog(self.suitable_for_endoscopic_test_button)
5164

5265
def click_calendar_button(self) -> None:
5366
"""Click the calendar button to open the calendar picker."""
@@ -63,19 +76,15 @@ def select_test_type_dropdown_option_2(self, text: str) -> None:
6376

6477
def click_invite_for_diagnostic_test_button(self) -> None:
6578
"""Click the 'Invite for Diagnostic Test' button."""
66-
AdvanceFOBTScreeningEpisodePage(self.page).safe_accept_dialog(
67-
self.invite_for_diagnostic_test_button
68-
)
79+
self.safe_accept_dialog(self.invite_for_diagnostic_test_button)
6980

7081
def click_attend_diagnostic_test_button(self) -> None:
7182
"""Click the 'Attend Diagnostic Test' button."""
7283
self.click(self.attend_diagnostic_test_button)
7384

7485
def click_other_post_investigation_button(self) -> None:
7586
"""Click the 'Other Post-investigation' button."""
76-
AdvanceFOBTScreeningEpisodePage(self.page).safe_accept_dialog(
77-
self.other_post_investigation_button
78-
)
87+
self.safe_accept_dialog(self.other_post_investigation_button)
7988

8089
def get_latest_event_status_cell(self, latest_event_status: str) -> Locator:
8190
"""Get the cell containing the latest event status."""
@@ -116,3 +125,19 @@ def click_record_contact_with_patient_button(self) -> None:
116125
def check_advance_checkbox(self) -> None:
117126
"""Selects the 'Advance FOBT' checkbox"""
118127
self.advance_checkbox.check()
128+
129+
def click_suitable_for_radiological_test_button(self) -> None:
130+
"""Click the 'Suitable for Radiological Test' button."""
131+
self.safe_accept_dialog(self.suitable_for_radiological_test_button)
132+
133+
def click_decision_not_to_continue_with_diagnostic_test(self) -> None:
134+
"""Click the 'Decision not to Continue with Diagnostic Test' button."""
135+
self.safe_accept_dialog(
136+
self.decision_not_to_continue_with_diagnostic_test_button
137+
)
138+
139+
def click_waiting_decision_to_proceed_with_diagnostic_test(self) -> None:
140+
"""Click the 'Waiting Decision to Proceed with Diagnostic Test' button."""
141+
self.safe_accept_dialog(
142+
self.waiting_decision_to_proceed_with_diagnostic_test_button
143+
)

pages/screening_subject_search/reopen_fobt_screening_episode_page.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ def __init__(self, page: Page):
1212
self.reopen_to_book_an_assessment_button = self.page.get_by_role(
1313
"button", name="Reopen to book an assessment"
1414
)
15+
self.reopen_following_non_response_button = self.page.get_by_role(
16+
"button", name="Reopen following Non-Response"
17+
)
1518

1619
def click_reopen_to_book_an_assessment_button(self) -> None:
1720
"""Click the 'Reopen to book an assessment' button."""
1821
self.safe_accept_dialog(self.reopen_to_book_an_assessment_button)
22+
23+
def click_reopen_following_non_response_button(self) -> None:
24+
"""Click the 'Reopen following Non-Response' button."""
25+
self.safe_accept_dialog(self.reopen_following_non_response_button)

tests/regression/regression_tests/fobt_regression_tests/test_scenario_3.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from utils.batch_processing import batch_processing
99
from utils.fit_kit import FitKitGeneration, FitKitLogged
1010
from utils import screening_subject_page_searcher
11-
from utils.calendar_picker import CalendarPicker
1211
from utils.sspi_change_steps import SSPIChangeSteps
1312
from utils.appointments import book_appointments
1413
from pages.base_page import BasePage
@@ -22,9 +21,6 @@
2221
from pages.screening_subject_search.advance_fobt_screening_episode_page import (
2322
AdvanceFOBTScreeningEpisodePage,
2423
)
25-
from pages.screening_practitioner_appointments.book_appointment_page import (
26-
BookAppointmentPage,
27-
)
2824
from pages.screening_subject_search.record_diagnosis_date_page import (
2925
RecordDiagnosisDatePage,
3026
)

tests/regression/regression_tests/fobt_regression_tests/test_scenario_5.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pages.screening_subject_search.record_diagnosis_date_page import (
2222
RecordDiagnosisDatePage,
2323
)
24-
from utils.appointments import mark_appointment_as_dna
24+
from utils.appointments import AppointmentAttendance
2525

2626

2727
@pytest.mark.usefixtures("setup_org_and_appointments")
@@ -61,6 +61,7 @@ def test_scenario_5(page: Page) -> None:
6161
"""
6262

6363
summary_page = SubjectScreeningSummaryPage(page)
64+
attendance = AppointmentAttendance(page)
6465
logging.info(
6566
"[TEST START] Regression - Scenario: 5: DNA colonoscopy assessment twice"
6667
)
@@ -227,7 +228,7 @@ def test_scenario_5(page: Page) -> None:
227228
# And I view the event history for the subject's latest episode
228229
# And I view the latest practitioner appointment in the subject's episode
229230
# And The subject DNAs the practitioner appointment
230-
mark_appointment_as_dna(page, "Patient did not attend")
231+
attendance.mark_as_dna("Patient did not attend")
231232

232233
# And there is a "J11" letter batch for my subject with the exact title "Practitioner Clinic 1st Appointment Non Attendance (Patient)"
233234
# When I process the open "J11" letter batch for my subject
@@ -278,7 +279,7 @@ def test_scenario_5(page: Page) -> None:
278279
# And I view the event history for the subject's latest episode
279280
# And I view the latest practitioner appointment in the subject's episode
280281
# And The subject DNAs the practitioner appointment
281-
mark_appointment_as_dna(page, "Patient did not attend")
282+
attendance.mark_as_dna("Patient did not attend")
282283

283284
# Then my subject has been updated as follows:
284285
subject_assertion(

0 commit comments

Comments
 (0)