Skip to content

Commit f3ea6b0

Browse files
refactoring util to add more dictionaries
1 parent 90b9572 commit f3ea6b0

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

tests/regression/regression_tests/fobt_regression_tests/test_scenario_8.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ def test_scenario_8(page: Page) -> None:
533533
"extracolonic_summary_code": ExtracolonicSummaryCodeOptions.E4_IMPORTANT_REQUIRES_ACTION,
534534
}
535535

536+
suspected_findings = {
537+
"extracolonic summary code": ExtracolonicSummaryCodeOptions.E4_IMPORTANT_REQUIRES_ACTION,
538+
}
539+
536540
# # And I set the following radiology failure reasons within the Investigation Dataset for this subject:
537541
# # | No failure reasons | NOTE - this can be left as default - there is only one option
538542

@@ -546,6 +550,7 @@ def test_scenario_8(page: Page) -> None:
546550
contrast_tagging_and_drug=contrast_tagging_and_drug,
547551
tagging_agent_given_drug_information=tagging_agent_given_drug_information,
548552
radiology_information=radiology_information,
553+
suspected_findings = suspected_findings,
549554
)
550555

551556
# Then my subject has been updated as follows:

utils/investigation_dataset.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ def complete_dataset_with_args(
337337
contrast_tagging_and_drug: Optional[dict] = None,
338338
tagging_agent_given_drug_information: Optional[dict] = None,
339339
radiology_information: Optional[dict] = None,
340+
suspected_findings: Optional[dict] = None,
340341
extracolonic_summary_code: Optional[str] = None,
341342
intracolonic_summary_code: Optional[str] = None,
342343
) -> None:
@@ -355,6 +356,7 @@ def complete_dataset_with_args(
355356
contrast_tagging_and_drug (Optional[dict]): Contrast, tagging agent, and drug information.
356357
tagging_agent_given_drug_information (Optional[dict]): Tagging agent drug types and doses.
357358
radiology_information (Optional[dict]): Radiology section fields.
359+
suspected_findings (Optional[dict])
358360
extracolonic_summary_code (Optional[str]): Extracolonic summary code value.
359361
intracolonic_summary_code (Optional[str]): Intracolonic summary code value.
360362
"""
@@ -420,21 +422,31 @@ def complete_dataset_with_args(
420422
"#UI_INTRACOLONIC_SUMMARY_CODE", intracolonic_summary_code
421423
)
422424

423-
# Extracolonic Summary Code
424-
if radiology_information["extracolonic_summary_code"]:
425-
self.investigation_datasets_pom.click_show_suspected_findings_details()
426-
427-
dropdown = self.page.locator("#UI_EXTRACOLONIC_SUMMARY_CODE")
428-
dropdown.wait_for(state="visible")
429-
self.page.wait_for_function("document.querySelector('#UI_EXTRACOLONIC_SUMMARY_CODE').options.length > 1")
430-
431-
dropdown.select_option(value=radiology_information["extracolonic_summary_code"])
425+
# Suspected Fndings
426+
if suspected_findings is not None:
427+
logging.info("Filling out suspected findings")
428+
self.fill_out_suspected_findings(suspected_findings)
432429

433430
# Save the dataset
434431
logging.info("Saving the investigation dataset")
435432
self.investigation_datasets_pom.check_dataset_complete_checkbox()
436433
self.investigation_datasets_pom.click_save_dataset_button()
437434

435+
def fill_out_suspected_findings(self, suspected_findings: dict) -> None:
436+
""" """
437+
self.investigation_datasets_pom.click_show_suspected_findings_details()
438+
439+
if suspected_findings["extracolonic summary code"]:
440+
dropdown = self.page.locator("#UI_EXTRACOLONIC_SUMMARY_CODE")
441+
dropdown.wait_for(state="visible")
442+
self.page.wait_for_function(
443+
"document.querySelector('#UI_EXTRACOLONIC_SUMMARY_CODE').options.length > 1"
444+
)
445+
446+
dropdown.select_option(
447+
value=suspected_findings["extracolonic summary code"]
448+
)
449+
438450
def fill_out_general_information(self, general_information: dict) -> None:
439451
"""
440452
Populates the General Information section of the Investigation Dataset form.

0 commit comments

Comments
 (0)