|
| 1 | +# Create a new util that can populate the investigations dataset to get the following |
| 2 | +# results: |
| 3 | + |
| 4 | +# High risk |
| 5 | +# LNPCP |
| 6 | +# Normal |
| 7 | + |
| 8 | +# This needs to be done as there is a lot of repeat code between the three results |
| 9 | +# and we need 2 subjects with high risk and LNPCP results. |
| 10 | +# Also create any utils to reduce the amount of duplicated code |
| 11 | +# to as close to 0% as possible. |
| 12 | + |
| 13 | +# Update compartment 6 |
| 14 | + |
| 15 | +# Add utility guide |
| 16 | + |
| 17 | +# In the code I have added these comments to show the different actions: |
| 18 | +# This needs to be repeated for 1 subject, age does not matter - Normal Result |
| 19 | +# This needs to be repeated for two subjects, one old and one not - LNPCP Result |
| 20 | +# This needs to be repeated for two subjects, one old and one not - High Risk Result |
| 21 | + |
| 22 | +from pages.datasets.investigation_dataset_page import InvestigationDatasetsPage |
| 23 | +from playwright.sync_api import Page |
| 24 | +from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no |
| 25 | +from pages.screening_subject_search.subject_screening_summary_page import ( |
| 26 | + SubjectScreeningSummaryPage, |
| 27 | +) |
| 28 | +from pages.datasets.subject_datasets_page import SubjectDatasetsPage |
| 29 | + |
| 30 | +# This is used to navigate to the investigation datasets page |
| 31 | +def go_to_investigation_datasets_page(page: Page, nhs_no) -> None: |
| 32 | + """This is used to navigate to the investigation datasets page |
| 33 | + Args: |
| 34 | + page (Page): This is the playwright page object |
| 35 | + nhs_no (str): The NHS number of the subject |
| 36 | + """ |
| 37 | + verify_subject_event_status_by_nhs_no( |
| 38 | + page, nhs_no, "A323 - Post-investigation Appointment NOT Required" |
| 39 | + ) |
| 40 | + |
| 41 | + SubjectScreeningSummaryPage(page).click_datasets_link() |
| 42 | + SubjectDatasetsPage(page).click_investigation_show_datasets() |
| 43 | + |
| 44 | + |
| 45 | +# Populate investigation dataset to get HIGH RISK results |
| 46 | +def populate_investigation_dataset_high_risk(page: Page) -> None: |
| 47 | + """ |
| 48 | + This populates the investigation dataset to get HIGH RISK results |
| 49 | +
|
| 50 | + Args: |
| 51 | + page (Page): This is the playwright page object |
| 52 | + """ |
| 53 | + # default_investigation_dataset_forms(page) |
| 54 | + # InvestigationDatasetsPage(page).select_theraputic_procedure_type() |
| 55 | + # default_investigation_dataset_forms_continuation(page) |
| 56 | + # investigation_datasets_failure_reason(page) |
| 57 | + # polyps_for_high_risk_result(page) |
| 58 | + # save_investigation_dataset(page) |
| 59 | + # after_high_risk_result(page) |
| 60 | + InvestigationDatasetsPage(page).click_add_new_investigation_dataset_button() |
| 61 | + InvestigationDatasetsPage(page).select_investigation_dataset_type("High Risk") |
| 62 | + InvestigationDatasetsPage(page).click_save_button() |
| 63 | + |
| 64 | + |
| 65 | +# Populate investigation dataset to get LNPCP results |
| 66 | +def populate_investigation_dataset_lnpcp(page: Page) -> None: |
| 67 | + """ |
| 68 | + This populates the investigation dataset to get LNPCP results |
| 69 | +
|
| 70 | + Args: |
| 71 | + page (Page): This is the playwright page object |
| 72 | + """ |
| 73 | + # default_investigation_dataset_forms(page) |
| 74 | + # InvestigationDatasetsPage(page).select_theraputic_procedure_type() |
| 75 | + # default_investigation_dataset_forms_continuation(page) |
| 76 | + # investigation_datasets_failure_reason(page) |
| 77 | + # polyps_for_lnpcp_result(page) |
| 78 | + # save_investigation_dataset(page) |
| 79 | + # after_lnpcp_result(page) |
| 80 | + InvestigationDatasetsPage(page).click_add_new_investigation_dataset_button() |
| 81 | + InvestigationDatasetsPage(page).select_investigation_dataset_type("LNPCP") |
| 82 | + InvestigationDatasetsPage(page).click_save_button() |
| 83 | + |
| 84 | + |
| 85 | +# Populate investigation dataset to get NORMAL results |
| 86 | +def populate_investigation_dataset_normal(page: Page) -> None: |
| 87 | + """ |
| 88 | + This populates the investigation dataset to get NORMAL results |
| 89 | +
|
| 90 | + Args: |
| 91 | + page (Page): This is the playwright page object |
| 92 | + """ |
| 93 | + # default_investigation_dataset_forms(page) |
| 94 | + # InvestigationDatasetsPage(page).select_diagnostic_procedure_type() |
| 95 | + # default_investigation_dataset_forms_continuation(page) |
| 96 | + # InvestigationDatasetsPage(page).click_show_failure_information() |
| 97 | + # InvestigationDatasetsPage(page).select_failure_reasons_option( |
| 98 | + # FailureReasonsOptions.NO_FAILURE_REASONS |
| 99 | + # ) |
| 100 | + # save_investigation_dataset(page) |
| 101 | + # InvestigationDatasetsPage(page).expect_text_to_be_visible( |
| 102 | + # "Normal (No Abnormalities" |
| 103 | + # ) |
| 104 | + InvestigationDatasetsPage(page).click_add_new_investigation_dataset_button() |
| 105 | + InvestigationDatasetsPage(page).select_investigation_dataset_type("Normal") |
| 106 | + InvestigationDatasetsPage(page).click_save_button() |
0 commit comments