Index: suite_leahi/tst_service_institutional/test.py =================================================================== diff -u -rad95767c13bdee2e3577f52712e7c7366a1194df -r279e768763ca90eadc690f1c922889f8969e5e6f --- suite_leahi/tst_service_institutional/test.py (.../test.py) (revision ad95767c13bdee2e3577f52712e7c7366a1194df) +++ suite_leahi/tst_service_institutional/test.py (.../test.py) (revision 279e768763ca90eadc690f1c922889f8969e5e6f) @@ -30,7 +30,7 @@ from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes, TDStandbyStates -td_simulator = TD_Messaging() +td_simulator = TD_Messaging() INSTITUTIONAL_CONFIGURATIONS = { "vBloodFlowMin": 80, "vBloodFlowMax": 210, @@ -139,7 +139,7 @@ 'vChlorineWaterSampleCheckMin': 15, 'vChlorineWaterSampleCheckMax': 480, 'vChlorineWaterSampleCheckDef': 140, - 'vWaterSampleTestResultRequiredDef': 0, + 'vWaterSampleTestResultRequiredDef': 1, } ADVANCED_INSTITUTIONAL_SETTINGS_PER_ROW = [ @@ -154,7 +154,6 @@ ] ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS = { - "vAccepted": 1, "vBloodFlowMinReason": 1, "vBloodFlowMaxReason": 1, "vBloodFlowDefReason": 1, @@ -215,12 +214,10 @@ "vSubVolumeDefReason": 0 } - ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS = { - "vAccepted": 1, - "vMinRORejectionRatioAlarmMaxRejectionReason": 0, - "vMinRORejectionRatioAlarmMinRejectionReason": 0, - "vMinRORejectionRatioAlarmDefRejectionReason": 0, + "vMinRORejectionRatioAlarmMaxRejectionReason": 1, + "vMinRORejectionRatioAlarmMinRejectionReason": 1, + "vMinRORejectionRatioAlarmDefRejectionReason": 1, "vDisinfectionFrequencyMinRejectionReason": 0, "vDisinfectionFrequencyMaxRejectionReason": 0, "vDisinfectionFrequencyDefRejectionReason": 0, @@ -242,11 +239,10 @@ "vWaterSampleTestResultRequiredDefRejectionReason": 0 } - ADVANCED_INSTITUTIONAL_SETTINGS_PARAMETER_RANGE = { - "vMinRORejectionRatioAlarmMin" : [0], - "vMinRORejectionRatioAlarmMax" : [0], - "vMinRORejectionRatioAlarmDef" : [0], + "vMinRORejectionRatioAlarmMin" : [2], + "vMinRORejectionRatioAlarmMax" : [8], + "vMinRORejectionRatioAlarmDef" : [3], } MINIMUM_RO_REJECTION_RATIO_ALARM_MIN = "vMinRORejectionRatioAlarmMin" MINIMUM_RO_REJECTION_RATIO_ALARM_MAX = "vMinRORejectionRatioAlarmMax" @@ -266,6 +262,11 @@ BLOOD_FLOW_RATE_MIN = "vBloodFlowMin" BLOOD_FLOW_RATE_MAX = "vBloodFlowMax" BLOOD_FLOW_RATE_DEF = "vBloodFlowDef" +INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_VALUES = { + "vBloodFlowMin": 100, + "vBloodFlowMax": 200, + "vBloodFlowDef": 150, + } def scroll_to_next_rows(): @@ -421,7 +422,7 @@ ), ) td_simulator.td_advanced_institutional_response( - vRejectionReason=1, **ADVANCED_INSTITUTIONAL_SETTINGS + vRejectionReason=0, **ADVANCED_INSTITUTIONAL_SETTINGS ) for row_index in range(0, 7): @@ -448,7 +449,9 @@ str(expected_value), f"Comparison of Heparin Prescription '{key}' in Row {row_index}", ) - + td_simulator.td_advanced_institutional_response( + vRejectionReason=1, **ADVANCED_INSTITUTIONAL_SETTINGS + ) advanced_reject_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 ) @@ -491,14 +494,15 @@ test.compare(2, digit_int, f"Rejection reason number comparison for reason {2}") test.log(f"Rejection reason text is {advanced_reject_notification_text}") - confirm_button = utility.get_object_from_names( - names.o_SettingsAdvancedInstitutional_ConfirmButton, - "Error Missing Confirm Button", - 2000, - ) - td_simulator.td_Adjust_Advanced_Institutional_Records( + + td_simulator.td_Adjust_Advanced_Institutional_Records( vAccepted = 1, **ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS ) + confirm_button = utility.get_object_from_names( + names.o_SettingsAdvancedInstitutional_ConfirmButton, + "Error Missing Confirm Button", + 2000, + ) if confirm_button is not None: mouseClick(confirm_button) @@ -534,10 +538,7 @@ if advanced_modes_option is not None: mouseClick(advanced_modes_option) - - td_simulator.td_advanced_institutional_response( - vRejectionReason=2, **ADVANCED_INSTITUTIONAL_SETTINGS - ) + for ( minimum_ro_rejection_ratio_alarm ) in ADVANCED_INSTITUTIONAL_SETTINGS_PARAMETER_RANGE[ @@ -564,22 +565,27 @@ utility.set_value_based_on_target( names.o_SettingsAdvancedInstitutional_min_ValueAdjuster, minimum_ro_rejection_ratio_alarm ) + + confirm_button = utility.get_object_from_names( + names.o_SettingsAdvancedInstitutional_ConfirmButton, + "Error Missing Confirm Button", + 2000, + ) + if confirm_button is not None: + mouseClick(confirm_button) - advanced_reject_notification = utility.get_object_from_names( + advanced_confirm_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 ) - advanced_reject_notification_text = str(advanced_reject_notification.text) - digit = re.sub(r"^.*?\[(\d+)\].*$", r"\1", advanced_reject_notification_text) + test.compare( + advanced_confirm_notification.text, + config.ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, + f"Confirm Advanced Institutional Settings Notification Text", + ) - if digit: - digit_int = int(float(digit)) - test.compare(2, digit_int, f"Rejection reason number comparison for reason {2}") - test.log(f"Rejection reason text is {advanced_reject_notification_text}") - - td_simulator.td_Adjust_Advanced_Institutional_Records( + td_simulator.td_Adjust_Advanced_Institutional_Records(vAccepted = 0, **ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS ) - confirm_button = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_ConfirmButton, "Error Missing Confirm Button", @@ -593,8 +599,8 @@ ) test.compare( advanced_confirm_notification.text, - config.ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, - f"Confirm Advanced Institutional Settings Notification Text", + config.ERROR_ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, + f"Confirm Advanced Institutional Settings Error Notification Text", ) back_button = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_BackButton, @@ -633,10 +639,12 @@ "{} screen is displayed and Comparison of Institutional Configurations Screen Title text".format( config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT ), - ) + ) + td_simulator.td_institutional_response( - vRejectionReason=2, **INSTITUTIONAL_CONFIGURATIONS + vRejectionReason=0, **INSTITUTIONAL_CONFIGURATIONS ) + for ( blood_flow_rate_default ) in INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE[BLOOD_FLOW_RATE_DEF]: @@ -657,15 +665,8 @@ utility.set_value_based_on_target( names.o_SettingsInstitutional_max_ValueAdjuster, blood_flow_rate_maximum ) - - for ( - blood_flow_rate_default - ) in INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE[BLOOD_FLOW_RATE_DEF]: - utility.set_value_based_on_target( - names.o_SettingsInstitutional_def_ValueAdjuster, blood_flow_rate_default - ) - - td_simulator.td_Adjust_Institutional_Records( + + td_simulator.td_Adjust_Institutional_Records(vAccepted = 1, **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) @@ -676,7 +677,7 @@ ) if confirm_button is not None: mouseClick(confirm_button) - + institutional_confirm_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar, timeout_ms=3000 ) @@ -685,21 +686,28 @@ config.INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Institutional Configurations Notification Text", ) - td_simulator.td_institutional_response( - vRejectionReason=2, **INSTITUTIONAL_CONFIGURATIONS + + td_simulator.td_Adjust_Institutional_Records(vAccepted = 0, + **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) - institutional_reject_notification = utility.get_object_from_names( + + confirm_button = utility.get_object_from_names( + names.o_SettingsInstitutional_ConfirmButton, + "Error Missing Confirm Button", + 2000, + ) + if confirm_button is not None: + mouseClick(confirm_button) + + institutional_confirm_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar, timeout_ms=3000 ) - institutional_reject_notification_text = str(institutional_reject_notification.text) + test.compare( + institutional_confirm_notification.text, + config.ERROR_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, + f"Confirm Institutional Configurations Error Notification Text", + ) - digit = re.sub(r"^.*?\[(\d+)\].*$", r"\1", institutional_reject_notification_text) - - if digit: - digit_int = int(float(digit)) - test.compare(2, digit_int, f"Rejection reason number comparison for reason {2}") - test.log(f"Rejection reason text is {institutional_reject_notification_text}") - back_button = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_BackButton, "Error Missing Back Button", @@ -774,7 +782,10 @@ config.INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Institutional Configurations Notification Text", ) + combined_configs = {**INSTITUTIONAL_CONFIGURATIONS, **INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_VALUES} + td_simulator.td_institutional_response(vRejectionReason=0, **combined_configs) + back_button = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_BackButton, "Error Missing Back Button", @@ -794,8 +805,6 @@ td_simulator.td_operation_mode(TDOpModes.MODE_PRET.value) td_simulator.td_blood_set_auto_load_response(vRejectionReason = 0) navigation.navigation_pageIndicator_step(config.CREATERX) - mouseClick(waitForObject(names.o_PreTreatmentSampleStack_button_TouchRect, 2000)) - mouseClick(waitForObject(names.o_preTreatmentStack_confirmButton_ConfirmButton, 2000)) mouseClick(waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry, 2000)) waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry, 2000).text ="abcd" mouseClick(waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 2000)) @@ -807,8 +816,8 @@ "Comparison of Default Blood Flow Value", ) utility.set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 100) - left_arrow = waitForObject(names.o_PreTreatmentCreate_leftArrow_IconButton, 2000) - if left_arrow.enabled is not config.ENABLED: + left_arrow = findObject(names.o_PreTreatmentCreate_leftArrow_IconButton) + if not left_arrow.enabled: parent_obj = waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 2000) minimum_value = utility.findObjectById(parent_obj, "_text") test.compare( @@ -817,8 +826,8 @@ "Comparison of Default Blood Flow Value", ) utility.set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 200) - right_arrow = waitForObject(names.o_PreTreatmentCreate_rightArrow_IconButton, 2000) - if right_arrow.enabled is not config.ENABLED: + right_arrow = findObject(names.o_PreTreatmentCreate_rightArrow_IconButton) + if not right_arrow.enabled: parent_obj = waitForObject(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 2000) maxmum_value = utility.findObjectById(parent_obj, "_text") test.compare( @@ -828,7 +837,6 @@ ) test.endSection() - def main(): utils.tstStart(__file__) startApplication(utility.aut("-q"))