|
19 | 19 | YesNoDrugOptions, |
20 | 20 | AntibioticsAdministeredDrugTypeOptions, |
21 | 21 | OtherDrugsAdministeredDrugTypeOptions, |
| 22 | + EndoscopeNotInsertedOptions, |
22 | 23 | ) |
23 | 24 | from classes.user import User |
24 | 25 | from classes.subject import Subject |
@@ -2426,6 +2427,178 @@ def test_check_dropdown_lists_and_default_field_values_in_endoscopy_information_ |
2426 | 2427 | LogoutPage(page).log_out() |
2427 | 2428 |
|
2428 | 2429 |
|
| 2430 | +@pytest.mark.regression |
| 2431 | +@pytest.mark.vpn_required |
| 2432 | +@pytest.mark.investigation_dataset_tests |
| 2433 | +@pytest.mark.bcss_additional_tests |
| 2434 | +@pytest.mark.colonoscopy_dataset_tests |
| 2435 | +def test_validation_of_scope_id_field_in_endoscopy_information_section( |
| 2436 | + page: Page, |
| 2437 | +) -> None: |
| 2438 | + """ |
| 2439 | + Scenario: Check the validation of the Scope ID field in the Endoscopy Information section in an incomplete Colonoscopy investigation dataset |
| 2440 | + Scope ID can't contain invalid characters. This validation is both immediate and on save. |
| 2441 | + """ |
| 2442 | + nhs_no = get_subject_with_new_colonoscopy_investigation_dataset() |
| 2443 | + UserTools.user_login(page, "Screening Centre Manager at BCS001") |
| 2444 | + BasePage(page).go_to_screening_subject_search_page() |
| 2445 | + search_subject_episode_by_nhs_number(page, nhs_no) |
| 2446 | + SubjectScreeningSummaryPage(page).click_datasets_link() |
| 2447 | + SubjectDatasetsPage(page).click_investigation_show_datasets() |
| 2448 | + |
| 2449 | + InvestigationDatasetsPage(page).bowel_cancer_screening_page_title_contains_text( |
| 2450 | + "Investigation Datasets" |
| 2451 | + ) |
| 2452 | + InvestigationDatasetsPage(page).click_show_endoscopy_information() |
| 2453 | + |
| 2454 | + InvestigationDatasetsPage(page).assert_dialog_text( |
| 2455 | + 'Certain characters may not be used in the Scope ID field. Please remove the following: <>,",&,¬,£' |
| 2456 | + ) |
| 2457 | + DatasetFieldUtil(page).populate_input_locator_for_field("Scope ID", '<> " & ¬ £') |
| 2458 | + InvestigationDatasetsPage(page).assert_dialog_text( |
| 2459 | + 'Certain characters may not be used in the Scope ID field. Please remove the following: <>,",&,¬,£' |
| 2460 | + ) |
| 2461 | + InvestigationDatasetsPage(page).click_save_dataset_button() |
| 2462 | + |
| 2463 | + LogoutPage(page).log_out() |
| 2464 | + |
| 2465 | + |
| 2466 | +@pytest.mark.regression |
| 2467 | +@pytest.mark.vpn_required |
| 2468 | +@pytest.mark.investigation_dataset_tests |
| 2469 | +@pytest.mark.bcss_additional_tests |
| 2470 | +@pytest.mark.colonoscopy_dataset_tests |
| 2471 | +def test_behaviour_of_edoscope_inserted_fields_in_endoscopy_information_section( |
| 2472 | + page: Page, |
| 2473 | +) -> None: |
| 2474 | + """ |
| 2475 | + Scenario: Check the behaviour of the Endoscope Inserted fields in the Endoscopy Information section in an incomplete Colonoscopy investigation dataset |
| 2476 | + """ |
| 2477 | + nhs_no = get_subject_with_new_colonoscopy_investigation_dataset() |
| 2478 | + UserTools.user_login(page, "Screening Centre Manager at BCS001") |
| 2479 | + BasePage(page).go_to_screening_subject_search_page() |
| 2480 | + search_subject_episode_by_nhs_number(page, nhs_no) |
| 2481 | + SubjectScreeningSummaryPage(page).click_datasets_link() |
| 2482 | + SubjectDatasetsPage(page).click_investigation_show_datasets() |
| 2483 | + |
| 2484 | + InvestigationDatasetsPage(page).bowel_cancer_screening_page_title_contains_text( |
| 2485 | + "Investigation Datasets" |
| 2486 | + ) |
| 2487 | + |
| 2488 | + logging.info("STEP: By default Endoscope Inserted = Yes") |
| 2489 | + InvestigationDatasetsPage(page).click_show_endoscopy_information() |
| 2490 | + |
| 2491 | + DatasetFieldUtil(page).assert_radio_to_right_is_selected( |
| 2492 | + "Endoscope Inserted", "Yes" |
| 2493 | + ) |
| 2494 | + sections_to_check = [ |
| 2495 | + "Failure Information", |
| 2496 | + "Polyp Information", |
| 2497 | + "Colorectal Cancer Information", |
| 2498 | + "Complication Information", |
| 2499 | + "Other Findings", |
| 2500 | + ] |
| 2501 | + InvestigationDatasetsPage(page).is_dataset_section_on_page(sections_to_check) |
| 2502 | + |
| 2503 | + logging.info( |
| 2504 | + "STEP: Changing Endoscope Inserted to No removes most fields and sections" |
| 2505 | + ) |
| 2506 | + |
| 2507 | + InvestigationDatasetsPage(page).check_endoscope_inserted_no() |
| 2508 | + DatasetFieldUtil(page).assert_radio_to_right_is_selected("Endoscope Inserted", "No") |
| 2509 | + DatasetFieldUtil(page).assert_cell_to_right_has_expected_text( |
| 2510 | + "Why Endoscope Not Inserted", "" |
| 2511 | + ) |
| 2512 | + dropdown_values = [ |
| 2513 | + "Clinical reason on PR", |
| 2514 | + "Consent refused", |
| 2515 | + "Equipment failure", |
| 2516 | + "No bowel preparation", |
| 2517 | + "Patient unsuitable", |
| 2518 | + "Service interruption", |
| 2519 | + "Solid stool on PR", |
| 2520 | + "Unscheduled attendance time", |
| 2521 | + ] |
| 2522 | + DatasetFieldUtil(page).assert_select_to_right_has_values( |
| 2523 | + "Why Endoscope Not Inserted", dropdown_values |
| 2524 | + ) |
| 2525 | + field_names = [ |
| 2526 | + "Procedure type", |
| 2527 | + "Bowel preparation quality", |
| 2528 | + "Comfort during examination", |
| 2529 | + "Comfort during recovery", |
| 2530 | + "Intended extent of examination", |
| 2531 | + "Endoscopist defined extent", |
| 2532 | + "Scope imager used", |
| 2533 | + "Retroverted view", |
| 2534 | + "Start of intubation time", |
| 2535 | + "Start of extubation time", |
| 2536 | + "End time of procedure", |
| 2537 | + "Withdrawal time", |
| 2538 | + "Scope ID", |
| 2539 | + "Detection Assistant (AI) Used?", |
| 2540 | + "Insufflation", |
| 2541 | + "Outcome at time of procedure", |
| 2542 | + "Late outcome", |
| 2543 | + ] |
| 2544 | + InvestigationDatasetsPage(page).are_fields_on_page( |
| 2545 | + "Endoscopy Information", None, field_names, False |
| 2546 | + ) |
| 2547 | + sections_to_check = [ |
| 2548 | + "Failure Information", |
| 2549 | + "Complication Information", |
| 2550 | + ] |
| 2551 | + InvestigationDatasetsPage(page).is_dataset_section_on_page(sections_to_check, False) |
| 2552 | + |
| 2553 | + logging.info( |
| 2554 | + "STEP: For most Why Endoscope Not Inserted values, polyps, cancers or other findings cannot be recorded" |
| 2555 | + ) |
| 2556 | + |
| 2557 | + DatasetFieldUtil(page).populate_select_locator_for_field( |
| 2558 | + "Why Endoscope Not Inserted", EndoscopeNotInsertedOptions.EQUIPMENT_FAILURE |
| 2559 | + ) |
| 2560 | + DatasetFieldUtil(page).assert_cell_to_right_has_expected_text( |
| 2561 | + "Why Endoscope Not Inserted", "Equipment failure" |
| 2562 | + ) |
| 2563 | + sections_to_check = [ |
| 2564 | + "Polyp Information", |
| 2565 | + "Colorectal Cancer Information", |
| 2566 | + "Other Findings", |
| 2567 | + ] |
| 2568 | + InvestigationDatasetsPage(page).is_dataset_section_on_page(sections_to_check, False) |
| 2569 | + |
| 2570 | + logging.info( |
| 2571 | + "STEP: Why Endoscope Not Inserted values 'Clinical reason on PR' does allow polyps, cancers or other findings to be recorded" |
| 2572 | + ) |
| 2573 | + |
| 2574 | + DatasetFieldUtil(page).populate_select_locator_for_field( |
| 2575 | + "Why Endoscope Not Inserted", EndoscopeNotInsertedOptions.CLINICAL_REASON_ON_PR |
| 2576 | + ) |
| 2577 | + DatasetFieldUtil(page).assert_cell_to_right_has_expected_text( |
| 2578 | + "Why Endoscope Not Inserted", "Clinical reason on PR" |
| 2579 | + ) |
| 2580 | + InvestigationDatasetsPage(page).is_dataset_section_on_page(sections_to_check) |
| 2581 | + |
| 2582 | + logging.info( |
| 2583 | + "STEP: Endoscope Inserted can only be changed back to Yes if there is no Why Endoscope Not Inserted value" |
| 2584 | + ) |
| 2585 | + |
| 2586 | + InvestigationDatasetsPage(page).assert_dialog_text( |
| 2587 | + "You cannot change 'Endoscope inserted' to 'Yes' as details have been entered for Why Endoscope Not Inserted." |
| 2588 | + ) |
| 2589 | + InvestigationDatasetsPage(page).check_endoscope_inserted_yes() |
| 2590 | + |
| 2591 | + DatasetFieldUtil(page).populate_select_locator_for_field( |
| 2592 | + "Why Endoscope Not Inserted", "" |
| 2593 | + ) |
| 2594 | + InvestigationDatasetsPage(page).check_endoscope_inserted_yes() |
| 2595 | + DatasetFieldUtil(page).assert_radio_to_right_is_selected( |
| 2596 | + "Endoscope Inserted", "Yes" |
| 2597 | + ) |
| 2598 | + |
| 2599 | + LogoutPage(page).log_out() |
| 2600 | + |
| 2601 | + |
2429 | 2602 | # Helper Functions |
2430 | 2603 |
|
2431 | 2604 |
|
|
0 commit comments