Skip to content

Commit a42b0da

Browse files
Adding scenario 9 (#139)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> Adding scenario 9 from fobtregressiontests.feature ## Context <!-- Why is this change required? What problem does it solve? --> Adding scenario 9 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 eb47649 commit a42b0da

File tree

10 files changed

+450
-17
lines changed

10 files changed

+450
-17
lines changed

classes/date/has_user_dob_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def by_description(cls, description: str) -> Optional["HasUserDobUpdate"]:
3232
Optional[HasUserDobUpdate]: The matching enum member, or None if not found.
3333
"""
3434
for item in cls:
35-
if item.value == description:
35+
if item.value.lower() == description.lower():
3636
return item
3737
return None
3838

classes/repositories/subject_repository.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def get_active_gp_practice_in_hub_and_sc(
153153
)
154154
if df.empty:
155155
return None
156-
return df.iloc[0]["gp_code"]
156+
return df["gp_code"].iloc[0]
157157

158158
def get_inactive_gp_practice(self) -> Optional[str]:
159159
"""
@@ -171,7 +171,7 @@ def get_inactive_gp_practice(self) -> Optional[str]:
171171
df = self.oracle_db.execute_query(query)
172172
if df.empty:
173173
return None
174-
return df.iloc[0]["gp_code"]
174+
return df["gp_code"].iloc[0]
175175

176176
def get_latest_gp_practice_for_subject(self, nhs_number: str) -> Optional[str]:
177177
"""
@@ -195,7 +195,7 @@ def get_latest_gp_practice_for_subject(self, nhs_number: str) -> Optional[str]:
195195
df = self.oracle_db.execute_query(query, {"nhs_number": nhs_number})
196196
if df.empty:
197197
return None
198-
return df.iloc[0]["gp_code"]
198+
return df["gp_code"].iloc[0]
199199

200200
def get_matching_subject(
201201
self, criteria: dict, subject: Subject, user: User

classes/screening/has_unprocessed_sspi_updates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def by_description(cls, description: str) -> Optional["HasUnprocessedSSPIUpdates
3232
Optional[HasUnprocessedSSPIUpdates]: The matching enum member, or None if not found.
3333
"""
3434
for item in cls:
35-
if item.value == description:
35+
if item.value.lower() == description.lower():
3636
return item
3737
return None
3838

pages/screening_subject_search/advance_fobt_screening_episode_page.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ def __init__(self, page: Page):
7070
self.not_suitable_for_diagnostic_tests_button = self.page.get_by_role(
7171
"button", name="Not Suitable for Diagnostic Tests"
7272
)
73+
self.cancel_diagnostic_test_button = self.page.get_by_role(
74+
"button", name="Cancel Diagnostic Test"
75+
)
7376

7477
def click_suitable_for_endoscopic_test_button(self) -> None:
7578
"""Click the 'Suitable for Endoscopic Test' button."""
@@ -105,15 +108,21 @@ def get_latest_event_status_cell(self, latest_event_status: str) -> Locator:
105108

106109
def verify_latest_event_status_value(self, latest_event_status: str) -> None:
107110
"""Verify that the latest event status value is visible."""
108-
logging.info(f"Verifying subject has the status: {latest_event_status}")
111+
logging.info(
112+
f"[UI ASSERTION] Verifying subject has the status: {latest_event_status}"
113+
)
109114
latest_event_status_cell = self.get_latest_event_status_cell(
110115
latest_event_status
111116
)
112117
try:
113118
expect(latest_event_status_cell).to_be_visible()
114-
logging.info(f"Subject has the status: {latest_event_status}")
119+
logging.info(
120+
f"[UI ASSERTION COMPLETE] Subject has the status: {latest_event_status}"
121+
)
115122
except Exception:
116-
pytest.fail(f"Subject does not have the status: {latest_event_status}")
123+
raise AssertionError(
124+
f"[UI ASSERTION FAILED] Subject does not have the status: {latest_event_status}"
125+
)
117126

118127
def click_record_other_post_investigation_contact_button(self) -> None:
119128
"""Click the 'Record other post-investigation contact' button."""
@@ -180,3 +189,7 @@ def click_waiting_decision_to_proceed_with_diagnostic_test(self) -> None:
180189
def click_not_suitable_for_diagnostic_tests_button(self) -> None:
181190
"""Click the 'Not Suitable for Diagnostic Tests' button."""
182191
self.safe_accept_dialog(self.not_suitable_for_diagnostic_tests_button)
192+
193+
def click_cancel_diagnostic_test_button(self) -> None:
194+
"""Click the 'Cancel Diagnostic Test' button."""
195+
self.safe_accept_dialog(self.cancel_diagnostic_test_button)

pages/screening_subject_search/contact_with_patient_page.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(self, page: Page):
2424
self.discussion_record_text_field = self.page.locator("#UI_COMMENT_ID")
2525
self.outcome_dropdown = self.page.locator("#UI_OUTCOME")
2626
self.save_button = self.page.get_by_role("button", name="Save")
27+
self.patient_contacted_dropdown = self.page.locator("#UI_PATIENT_CONTACTED")
2728

2829
def select_direction_dropdown_option(self, direction: str) -> None:
2930
"""
@@ -79,7 +80,12 @@ def select_outcome_dropdown_option(self, outcome: str) -> None:
7980
Select an option from the 'Outcome' dropdown by its label.
8081
8182
Args:
82-
outcome (str): The label of the outcome option to select.
83+
outcome (str): The label of the outcome option to select.
84+
Can be one of the following:
85+
- 'Suitable for Endoscopic Test'
86+
- 'Suitable for Radiological Test'
87+
- 'Close Episode - Patient Choice'
88+
- 'SSP Appointment Required'
8389
"""
8490
self.outcome_dropdown.select_option(label=outcome)
8591

@@ -102,3 +108,37 @@ def record_post_investigation_appointment_not_required(self) -> None:
102108
"Post-investigation Appointment Not Required"
103109
)
104110
self.click_save_button()
111+
112+
def select_patient_contacted_dropdown_option(self, option: str) -> None:
113+
"""
114+
Select an option from the 'Patient Contacted' dropdown by its label.
115+
116+
Args:
117+
option (str): The label of the patient contacted option to select.
118+
Options can be 'Yes' or 'No'.
119+
"""
120+
self.patient_contacted_dropdown.select_option(label=option)
121+
122+
def record_contact(self, outcome: str, patient_contacted: str = "Yes") -> None:
123+
"""
124+
Records contact with the patient.
125+
Args:
126+
outcome (str): The outcome of the contact. Options include:
127+
- 'Suitable for Endoscopic Test'
128+
- 'Suitable for Radiological Test'
129+
- 'Close Episode - Patient Choice'
130+
- 'SSP Appointment Required'
131+
patient_contacted (str): Indicates if the patient was contacted. Default is 'Yes'. Options include:
132+
- 'Yes'
133+
- 'No'
134+
"""
135+
self.select_direction_dropdown_option("To patient")
136+
self.select_caller_id_dropdown_index_option(1)
137+
self.click_calendar_button()
138+
CalendarPicker(self.page).v1_calender_picker(datetime.today())
139+
self.enter_start_time("11:00")
140+
self.enter_end_time("12:00")
141+
self.enter_discussion_record_text("TEST AUTOMATION")
142+
self.select_patient_contacted_dropdown_option(patient_contacted)
143+
self.select_outcome_dropdown_option(outcome)
144+
self.click_save_button()

pages/screening_subject_search/patient_advised_of_diagnosis_page.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ def select_diagnosis_date_and_reason(self, date: datetime, reason: str) -> None:
2626
CalendarPicker(self.page).v2_calendar_picker(date)
2727
self.reason_dropdown.select_option(label=reason)
2828
self.click(self.save_button)
29+
30+
def select_diagnosis_reason(self, reason: str) -> None:
31+
"""
32+
Selects the diagnosis reason, then saves the form.
33+
Args:
34+
reason (str): The reason for the diagnosis.
35+
"""
36+
self.reason_dropdown.select_option(label=reason)
37+
self.click(self.save_button)

subject_criteria_builder/criteria.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3786,7 +3786,11 @@
37863786
{
37873787
"key": "LATEST_EPISODE_KIT_CLASS",
37883788
"value_source": "",
3789-
"notes": "Specify the kit class for the latest episode (e.g., 'FIT', 'GFOBT')."
3789+
"notes": "Specify the kit class for the latest episode (e.g., 'FIT', 'GFOBT').",
3790+
"allowed_values": [
3791+
"FIT",
3792+
"GFOBT"
3793+
]
37903794
},
37913795
{
37923796
"key": "LATEST_EPISODE_HAS_SIGNIFICANT_KIT_RESULT",

0 commit comments

Comments
 (0)