Skip to content

Commit f9982c1

Browse files
committed
Added record_diagnosis_date_with_reason method
wip
1 parent d4fb3d9 commit f9982c1

File tree

4 files changed

+55
-73
lines changed

4 files changed

+55
-73
lines changed

pages/base_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def assert_dialog_text(self, expected_text: str, accept: bool = False) -> None:
256256
If no dialog appears, logs an error.
257257
Args:
258258
expected_text (str): The text that should be present in the dialog.
259-
accept (bool): Set to True if you want to accept the dialog, by deafult is is set to False.
259+
accept (bool): Set to True if you want to accept the dialog, by default is is set to False.
260260
"""
261261
self._dialog_assertion_error = None
262262

@@ -265,7 +265,7 @@ def handle_dialog(dialog: Dialog, accept: bool = False):
265265
Handles the dialog and asserts that the dialog contains the expected text.
266266
Args:
267267
dialog (Dialog): the playwright dialog object
268-
accept (bool): Set to True if you want to accept the dialog, by deafult is is set to False.
268+
accept (bool): Set to True if you want to accept the dialog, by default is is set to False.
269269
"""
270270
logging.info(f"Dialog appeared with message: {dialog.message}")
271271
actual_text = dialog.message

pages/screening_practitioner_appointments/appointment_detail_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, page: Page):
1515
self.calendar_button = self.page.get_by_role("button", name="Calendar")
1616
self.save_button = self.page.get_by_role("button", name="Save")
1717
self.cancel_radio = self.page.get_by_role("radio", name="Cancel")
18-
self.reason_for_cancellation_dropwdown = self.page.get_by_label(
18+
self.reason_for_cancellation_dropdown = self.page.get_by_label(
1919
"Reason for Cancellation"
2020
)
2121

@@ -84,7 +84,7 @@ def select_reason_for_cancellation_option(self, option: str) -> None:
8484
option: The reason for cancellation to select.
8585
The options are in the ReasonForCancellationOptions class
8686
"""
87-
self.reason_for_cancellation_dropwdown.select_option(value=option)
87+
self.reason_for_cancellation_dropdown.select_option(value=option)
8888

8989

9090
class ReasonForCancellationOptions(StrEnum):

pages/screening_subject_search/record_diagnosis_date_page.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,19 @@ def get_alert_message(self) -> str:
4141
return self.alert_message.inner_text()
4242
else:
4343
return ""
44+
45+
def record_diagnosis_date_with_reason(self, date: datetime, reason_text: str) -> None:
46+
"""
47+
Records a diagnosis date and selects a reason before saving.
48+
49+
Args:
50+
date (datetime): The diagnosis date to enter.
51+
reason_text (str): The visible text of the reason to select.
52+
"""
53+
self.enter_date_in_diagnosis_date_field(date)
54+
55+
reason_dropdown = self.page.locator("#DIAGNOSIS_REASON") # Replace with actual ID
56+
reason_dropdown.select_option(label=reason_text)
57+
58+
self.safe_accept_dialog(self.save_button)
59+

tests/regression/regression_tests/fobt_regression_tests/test_scenario_4.py

Lines changed: 35 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@
2626
AppointmentDetailPage,
2727
ReasonForCancellationOptions,
2828
)
29+
from pages.screening_subject_search.advance_fobt_screening_episode_page import (
30+
AdvanceFOBTScreeningEpisodePage,
31+
)
32+
from pages.screening_subject_search.record_diagnosis_date_page import (
33+
RecordDiagnosisDatePage,
34+
)
2935

3036

3137
@pytest.mark.wip
38+
@pytest.mark.usefixtures("setup_org_and_appointments")
3239
@pytest.mark.vpn_required
3340
@pytest.mark.regression
3441
@pytest.mark.fobt_regression_tests
@@ -294,41 +301,25 @@ def test_scenario_4(page: Page) -> None:
294301
)
295302

296303
# And there is a "A183" letter batch for my subject with the exact title "Practitioner Clinic 1st Appointment"
297-
batch_processing(
298-
page,
299-
"A183",
300-
"Practitioner Clinic 1st Appointment",
301-
"A183 1st Colonoscopy Assessment Appointment Requested",
302-
True,
303-
)
304-
305-
# And there is a "A183" letter batch for my subject with the exact title "GP Result (Abnormal)"
306-
batch_processing(
307-
page,
308-
"A183",
309-
"GP Result (Abnormal)",
310-
"A183 1st Colonoscopy Assessment Appointment Requested",
311-
True,
312-
)
313-
314304
# When I process the open "A183 - Practitioner Clinic 1st Appointment" letter batch for my subject
315305
# Then my subject has been updated as follows:
316306
batch_processing(
317307
page,
318308
"A183",
319309
"Practitioner Clinic 1st Appointment",
320-
"A25 1st Colonoscopy Assessment Appointment Booked, letter sent",
321-
False,
310+
"A25 - 1st Colonoscopy Assessment Appointment Booked, letter sent",
311+
True,
322312
)
323313

314+
# And there is a "A183" letter batch for my subject with the exact title "GP Result (Abnormal)"
324315
# When I process the open "A183 - GP Result (Abnormal)" letter batch for my subject
325316
# Then my subject has been updated as follows:
326317
batch_processing(
327318
page,
328319
"A183",
329320
"GP Result (Abnormal)",
330-
"A167 GP Abnormal FOBT Result Sent",
331-
False,
321+
"A167 - GP Abnormal FOBT Result Sent",
322+
True,
332323
)
333324

334325
# When I switch users to BCSS "England" as user role "Screening Centre Manager"
@@ -366,15 +357,10 @@ def test_scenario_4(page: Page) -> None:
366357
page,
367358
"J4",
368359
"Appointment Cancellation (Patient to Consider)",
369-
"J22 Appointment Cancellation letter sent (Patient to Consider)",
360+
"J22 - Appointment Cancellation letter sent (Patient to Consider)",
370361
False,
371362
)
372363

373-
# # TODO: But there is no "J22" letter batch for my subject with the exact title "Subject Discharge (Refused Appointment)"
374-
# batch_processing.assert_batch_absence(
375-
# nhs_no, "J22", "Subject Discharge (Refused Appointment)"
376-
# )
377-
378364
# When I switch users to BCSS "England" as user role "Hub Manager"
379365
LogoutPage(page).log_out(close_page=False)
380366
BasePage(page).go_to_log_in_page()
@@ -404,22 +390,14 @@ def test_scenario_4(page: Page) -> None:
404390
)
405391

406392
# And there is a "J20" letter batch for my subject with the exact title "Practitioner Clinic 1st Appt Cancelled (Patient To Reschedule)"
407-
batch_processing(
408-
page,
409-
"J20",
410-
"Practitioner Clinic 1st Appt Cancelled (Patient To Reschedule)",
411-
"J20 Appointment Requested (Patient to Reschedule Letter)",
412-
True,
413-
)
414-
415393
# When I process the open "J20" letter batch for my subject
416394
# Then my subject has been updated as follows:
417395
batch_processing(
418396
page,
419397
"J20",
420398
"Practitioner Clinic 1st Appt Cancelled (Patient To Reschedule)",
421-
"A25 1st Colonoscopy Assessment Appointment Booked, letter sent",
422-
False,
399+
"A25 - 1st Colonoscopy Assessment Appointment Booked, letter sent",
400+
True,
423401
)
424402

425403
# When I switch users to BCSS "England" as user role "Screening Centre Manager"
@@ -452,30 +430,13 @@ def test_scenario_4(page: Page) -> None:
452430
)
453431

454432
# And there is a "J24" letter batch for my subject with the exact title "Subject Discharge (Screening Centre)"
455-
batch_processing(
456-
page,
457-
"J24",
458-
"Subject Discharge (Screening Centre)",
459-
"J24 Screening Centre Discharge Patient",
460-
True,
461-
)
462-
463433
# When I process the open "J24 - Subject Discharge (Screening Centre)" letter batch for my subject
464434
# Then my subject has been updated as follows:
465435
batch_processing(
466436
page,
467437
"J24",
468438
"Subject Discharge (Screening Centre)",
469-
"J25 Patient discharge sent (Screening Centre discharge patient)",
470-
False,
471-
)
472-
473-
# And there is a "J25" letter batch for my subject with the exact title "GP Discharge (Discharged By Screening Centre)"
474-
batch_processing(
475-
page,
476-
"J25",
477-
"GP Discharge (Discharged By Screening Centre)",
478-
"J25 Patient discharge sent (Screening Centre discharge patient)",
439+
"J25 - Patient discharge sent (Screening Centre discharge patient)",
479440
True,
480441
)
481442

@@ -484,25 +445,30 @@ def test_scenario_4(page: Page) -> None:
484445
BasePage(page).go_to_log_in_page()
485446
UserTools.user_login(page, "Hub Manager State Registered at BCS01")
486447

448+
# And there is a "J25" letter batch for my subject with the exact title "GP Discharge (Discharged By Screening Centre)"
487449
# And I process the open "J25" letter batch for my subject
488450
# Then my subject has been updated as follows:
489451
batch_processing(
490452
page,
491453
"J25",
492454
"GP Discharge (Discharged By Screening Centre)",
493-
"P202 Waiting Completion of Outstanding Events",
455+
"P202 - Waiting Completion of Outstanding Events",
494456
False,
495457
)
496458

497459
# When I view the subject
498460
screening_subject_page_searcher.navigate_to_subject_summary_page(page, nhs_no)
499461

500-
# # TODO: And I select the advance episode option for "Record Diagnosis Date"
501-
# # And I select Diagnosis Date Reason "Patient choice"
462+
# And I select the advance episode option for "Record Diagnosis Date"
463+
AdvanceFOBTScreeningEpisodePage(page).click_record_diagnosis_date_button()
464+
465+
# # TODO: And I select Diagnosis Date Reason "Patient choice"
466+
RecordDiagnosisDatePage(page).record_diagnosis_date_with_reason(
467+
date=datetime.now(), reason_text="Patient Choice"
468+
)
469+
502470
# # And I save Diagnosis Date Information
503-
# CallAndRecallUtils().record_diagnosis_date(
504-
# nhs_no, reason="Patient choice", has_diagnosis_date=False
505-
# )
471+
RecordDiagnosisDatePage(page).click_save_button()
506472

507473
# Then my subject has been updated as follows:
508474
subject_assertion(
@@ -511,29 +477,29 @@ def test_scenario_4(page: Page) -> None:
511477
"calculated FOBT due date": "2 years from latest J25 event",
512478
"calculated lynch due date": "Unchanged",
513479
"calculated surveillance due date": "Unchanged",
514-
"ceased confirmation date": None,
515-
"ceased confirmation details": None,
516-
"ceased confirmation user ID": None,
517-
"clinical reason for cease": None,
480+
"ceased confirmation date": "Null",
481+
"ceased confirmation details": "Null",
482+
"ceased confirmation user ID": "Null",
483+
"clinical reason for cease": "Null",
518484
"latest episode accumulated result": "Definitive abnormal FOBT outcome",
519485
"latest episode diagnosis date reason": "Patient choice",
520486
"latest episode has diagnosis date": "No",
521487
"latest episode includes event status": "A52 No diagnosis date recorded",
522488
"latest episode recall calculation method": "Date of last patient letter",
523489
"latest episode recall episode type": "FOBT Screening",
524-
"latest episode recall surveillance type": None,
490+
"latest episode recall surveillance type": "Null",
525491
"latest episode status": "Closed",
526492
"latest episode status reason": "Discharged",
527493
"latest event status": "J26 GP Discharge letter sent (Discharge by Screening centre)",
528-
"lynch due date": None,
494+
"lynch due date": "Null",
529495
"lynch due date date of change": "Unchanged",
530496
"lynch due date reason": "Unchanged",
531-
"screening due date": None,
497+
"screening due date": "Null",
532498
"screening due date date of change": "Today",
533499
"screening due date reason": "Awaiting failsafe",
534500
"screening status": "Recall",
535501
"screening status reason": "Recall",
536-
"surveillance due date": None,
502+
"surveillance due date": "Null",
537503
"surveillance due date reason": "Unchanged",
538504
"surveillance due date date of change": "Unchanged",
539505
},

0 commit comments

Comments
 (0)