77from classes .repositories .subject_repository import SubjectRepository
88from utils .calendar_picker import CalendarPicker
99from utils .user_tools import UserTools
10- from utils .subject_assertion import subject_assertion
1110from utils import screening_subject_page_searcher
1211from utils .batch_processing import batch_processing
12+ from utils .subject_assertion import subject_assertion
1313from utils .fit_kit import FitKitLogged , FitKitGeneration
1414from utils .oracle .subject_selection_query_builder import SubjectSelectionQueryBuilder
1515from utils .appointments import book_appointments , book_post_investigation_appointment
2424 ReferralProcedureType ,
2525 ReasonForOnwardReferral ,
2626)
27+ from pages .screening_subject_search .advance_fobt_screening_episode_page import (
28+ AdvanceFOBTScreeningEpisodePage ,
29+ )
30+ from pages .screening_subject_search .attend_diagnostic_test_page import (
31+ AttendDiagnosticTestPage ,
32+ )
2733from pages .logout .log_out_page import LogoutPage
2834from pages .base_page import BasePage
2935from pages .screening_subject_search .episode_events_and_notes_page import (
3238from pages .screening_practitioner_appointments .appointment_detail_page import (
3339 AppointmentDetailPage ,
3440)
35- from pages .screening_subject_search .advance_fobt_screening_episode_page import (
36- AdvanceFOBTScreeningEpisodePage ,
37- )
38- from pages .screening_subject_search .attend_diagnostic_test_page import (
39- AttendDiagnosticTestPage ,
40- )
4141from pages .screening_subject_search .record_diagnosis_date_page import (
4242 RecordDiagnosisDatePage ,
4343)
5757 LateOutcomeOptions ,
5858 OutcomeAtTimeOfProcedureOptions ,
5959 YesNoOptions ,
60- EndoscopyLocationOptions ,
61- CompletionProofOptions ,
6260 PolypAccessOptions ,
6361 PolypClassificationOptions ,
62+ EndoscopyLocationOptions ,
63+ CompletionProofOptions ,
6464 PolypInterventionDeviceOptions ,
6565 PolypInterventionExcisionTechniqueOptions ,
6666 PolypInterventionModalityOptions ,
@@ -128,8 +128,6 @@ def test_scenario_16(page: Page) -> None:
128128 if user_role is None :
129129 raise ValueError ("The current user cannot be assigned to a UserRoleType" )
130130
131- user = User ().from_user_role_type (user_role )
132-
133131 # And there is a subject who meets the following criteria:
134132 query , bind_vars = SubjectSelectionQueryBuilder ().build_subject_selection_query (
135133 criteria = {
@@ -142,7 +140,7 @@ def test_scenario_16(page: Page) -> None:
142140 "subject has user dob updates" : "No" ,
143141 "subject hub code" : "User's hub" ,
144142 },
145- user = user ,
143+ user = User (). from_user_role_type ( user_role ) ,
146144 subject = Subject (),
147145 subjects_to_retrieve = 1 ,
148146 )
@@ -326,8 +324,8 @@ def test_scenario_16(page: Page) -> None:
326324 screening_subject_page_searcher .navigate_to_subject_summary_page (page , nhs_no )
327325
328326 # And I view the event history for the subject's latest episode
329- SubjectScreeningSummaryPage (page ).expand_episodes_list ()
330- SubjectScreeningSummaryPage (page ).click_first_fobt_episode_link ()
327+ SubjectScreeningSummaryPage (page = page ).expand_episodes_list ()
328+ SubjectScreeningSummaryPage (page = page ).click_first_fobt_episode_link ()
331329
332330 # And I view the latest practitioner appointment in the subject's episode
333331 EpisodeEventsAndNotesPage (page ).click_most_recent_view_appointment_link ()
@@ -346,7 +344,9 @@ def test_scenario_16(page: Page) -> None:
346344 )
347345
348346 # When I view the subject
349- screening_subject_page_searcher .navigate_to_subject_summary_page (page , nhs_no )
347+ screening_subject_page_searcher .navigate_to_subject_summary_page (
348+ nhs_no = nhs_no , page = page
349+ )
350350
351351 # And I edit the Colonoscopy Assessment Dataset for this subject
352352 SubjectScreeningSummaryPage (page ).click_datasets_link ()
@@ -365,8 +365,10 @@ def test_scenario_16(page: Page) -> None:
365365 screening_subject_page_searcher .navigate_to_subject_summary_page (page , nhs_no )
366366
367367 # And I advance the subject's episode for "Suitable for Endoscopic Test"
368- SubjectScreeningSummaryPage (page ).click_advance_fobt_screening_episode_button ()
369- AdvanceFOBTScreeningEpisodePage (page ).click_suitable_for_endoscopic_test_button ()
368+ SubjectScreeningSummaryPage (page = page ).click_advance_fobt_screening_episode_button ()
369+ AdvanceFOBTScreeningEpisodePage (
370+ page = page
371+ ).click_suitable_for_endoscopic_test_button ()
370372
371373 # Then my subject has been updated as follows:
372374 subject_assertion (
@@ -433,7 +435,7 @@ def test_scenario_16(page: Page) -> None:
433435 user = user ,
434436 subject = None ,
435437 )
436- df = OracleDB ().execute_query (query , None )
438+ df = OracleDB ().execute_query (query = query , parameters = None )
437439 person_name = (
438440 f"{ df ["person_family_name" ].iloc [0 ]} { df ["person_given_name" ].iloc [0 ]} "
439441 )
@@ -455,8 +457,8 @@ def test_scenario_16(page: Page) -> None:
455457 "comfort during examination" : ComfortOptions .NO_DISCOMFORT ,
456458 "comfort during recovery" : ComfortOptions .NO_DISCOMFORT ,
457459 "endoscopist defined extent" : EndoscopyLocationOptions .APPENDIX ,
458- "scope imager used" : YesNoOptions .YES ,
459460 "retroverted view" : YesNoOptions .NO ,
461+ "scope imager used" : YesNoOptions .YES ,
460462 "start of intubation time" : "09:00" ,
461463 "start of extubation time" : "09:30" ,
462464 "end time of procedure" : "10:00" ,
@@ -466,13 +468,13 @@ def test_scenario_16(page: Page) -> None:
466468 "late outcome" : LateOutcomeOptions .NO_COMPLICATIONS ,
467469 }
468470
469- # And I set the following completion proof values within the Investigation Dataset for this subject:
471+ # I set the following completion proof values within the Investigation Dataset for this subject:
470472 completion_information = {"completion proof" : CompletionProofOptions .VIDEO_APPENDIX }
471473
472- # And I set the following failure reasons within the Investigation Dataset for this subject:
474+ # I set the following failure reasons within the Investigation Dataset for this subject:
473475 failure_information = {"failure reasons" : FailureReasonsOptions .NO_FAILURE_REASONS }
474476
475- # And I add new polyps 1-3 with the following fields and values within the Investigation Dataset for this subject:
477+ # I add new polyps 1-3 with the following fields and values within the Investigation Dataset for this subject:
476478 polyp_information = [
477479 {
478480 "location" : EndoscopyLocationOptions .ANASTOMOSIS ,
@@ -497,7 +499,7 @@ def test_scenario_16(page: Page) -> None:
497499 },
498500 ]
499501
500- # And I add intervention 1 for polyps 1-3 with the following fields and values within the Investigation Dataset for this subject:
502+ # I add interventions 1 for polyps 1-3 with the following fields and values within the Investigation Dataset for this subject:
501503 polyp_intervention = [
502504 [
503505 {
@@ -528,7 +530,7 @@ def test_scenario_16(page: Page) -> None:
528530 ],
529531 ]
530532
531- # And I update histology details for polyps 1-3 with the following fields and values within the Investigation Dataset for this subject:
533+ # I update histology details for polyps 1-3 with the following fields and values within the Investigation Dataset for this subject:
532534 polyp_histology = [
533535 {
534536 "date of receipt" : datetime .today (),
@@ -573,27 +575,37 @@ def test_scenario_16(page: Page) -> None:
573575 )
574576
575577 # Then the Investigation Dataset result message is "LNPCP"
576- InvestigationDatasetsPage (page ).expect_text_to_be_visible ("LNPCP" )
578+ InvestigationDatasetsPage (page ).expect_text_to_be_visible (text = "LNPCP" )
577579
578580 # Then I confirm the Polyp Algorithm Size for Polyp 1 is 13
579- InvestigationDatasetsPage (page ).assert_polyp_algorithm_size (1 , "13" )
581+ InvestigationDatasetsPage (page ).assert_polyp_algorithm_size (
582+ polyp_number = 1 , expected_value = "13"
583+ )
580584
581585 # Then I confirm the Polyp Algorithm Size for Polyp 2 is 4
582- InvestigationDatasetsPage (page ).assert_polyp_algorithm_size (2 , "4" )
586+ InvestigationDatasetsPage (page ).assert_polyp_algorithm_size (
587+ polyp_number = 2 , expected_value = "4"
588+ )
583589
584590 # Then I confirm the Polyp Algorithm Size for Polyp 3 is 21
585- InvestigationDatasetsPage (page ).assert_polyp_algorithm_size (3 , "21" )
591+ InvestigationDatasetsPage (page ).assert_polyp_algorithm_size (
592+ polyp_number = 3 , expected_value = "21"
593+ )
586594
587595 # And I confirm the Polyp Category for Polyp 1 is "Advanced colorectal polyp"
588596 InvestigationDatasetsPage (page ).assert_polyp_category (
589- 1 , "Advanced colorectal polyp"
597+ polyp_number = 1 , expected_value = "Advanced colorectal polyp"
590598 )
591599
592600 # And I confirm the Polyp Category for Polyp 2 is "Premalignant polyp"
593- InvestigationDatasetsPage (page ).assert_polyp_category (2 , "Premalignant polyp" )
601+ InvestigationDatasetsPage (page ).assert_polyp_category (
602+ polyp_number = 2 , expected_value = "Premalignant polyp"
603+ )
594604
595605 # And I confirm the Polyp Category for Polyp 3 is "LNPCP"
596- InvestigationDatasetsPage (page ).assert_polyp_category (3 , "LNPCP" )
606+ InvestigationDatasetsPage (page ).assert_polyp_category (
607+ polyp_number = 3 , expected_value = "LNPCP"
608+ )
597609
598610 # And I confirm the Episode Result is "LNPCP"
599611 EpisodeRepository ().confirm_episode_result (nhs_no , "LNPCP" )
0 commit comments