Index: suite_leahi/tst_blood_prime/test.py =================================================================== diff -u -r62cc0c546a8dcad24ce124e06f01ee2187f78d41 -r66467a5547210eaacdae92fba918d52fc28ca20c --- suite_leahi/tst_blood_prime/test.py (.../test.py) (revision 62cc0c546a8dcad24ce124e06f01ee2187f78d41) +++ suite_leahi/tst_blood_prime/test.py (.../test.py) (revision 66467a5547210eaacdae92fba918d52fc28ca20c) @@ -13,15 +13,17 @@ import names, re -from configuration import utility, config -from leahi_dialin.ui import utils -from leahi_dialin.ui.td_messaging import TD_Messaging -from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates -from leahi_dialin.common.ui_defs import TXStates -from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions -from leahi_dialin.protocols import CAN -from leahi_dialin.utils import conversions +from configuration import utility, config, application_init +from leahi_dialin.ui import utils +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates +from leahi_dialin.common.ui_defs import TXStates +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN +from leahi_dialin.utils import conversions +from configuration.getrejectiontext import ScopedRejectionRepository + td_simulator = TD_Messaging() can_interface = td_simulator.can_interface bloodFlowrate = None @@ -325,8 +327,17 @@ if object.exists(pressure_text_obj(tmp_high)): test.fail("Trancememberance value {} should not exists".format(tmp_high)) test.endSection() + +# verify start bolus button enabled or disabled state +def verify_start_bolus_button_state(expected_state, message): + """Helper function to verify the enabled/disabled state using test.compare.""" + + start_bolus_button = findObject(names.startFluidButton) + current_state = start_bolus_button.enabled + test.compare(current_state, expected_state, message) + def test_blood_prime_saline_delivery(): """ Verify the Different Saline States, ProgressBar, Start and Stop button @@ -350,6 +361,16 @@ config.TOTAL_FLUID_DELIVERED, "Testing 'Total Saline Delivered' text", ) + + # enable start bolus button + td_simulator.td_saline( + 0, # target_volume + 0, # bolus_volume + 0, # cumulative_volume + 1 # bolus_permitted + ) + + verify_start_bolus_button_state(config.ENABLED, "Comparison of Start Bolus Button Enabled State") # verify send start bolus req message mouseClick( @@ -390,10 +411,10 @@ # verify saline data bolusValueInTest = 75 td_simulator.td_saline( - 100, # target_volume - 150, # cumulative_volume - bolusValueInTest, # bolus_volume - 0, + 100 , # target_volume + bolusValueInTest, # bolus_volume + 150 , # cumulative_volume + 1 # bolus_permitted ) # verify saline text @@ -542,18 +563,22 @@ "Verifying FW received Pause State of Blood Flow Rate in Blood Priming screen", ) - td_simulator.td_blood_prime_cmd_response(0, 2) - blood_priming_reject_notification = utility.get_object_from_names( - names.o_TreatmentBloodPrime_NotificationBar - ) - blood_priming_reject_notification_text = str(blood_priming_reject_notification.text) - digit = re.sub(r"^.*?\[(\d+)\].*$", r"\1", blood_priming_reject_notification_text) + # Comparison of Rejection Reasons + conf_path = application_init.configuration_folder_path() + "Alarms/Rejections.conf" + repo = ScopedRejectionRepository(path=conf_path) + for rejection_reason in range(1, 60): + td_simulator.td_blood_prime_cmd_response(0, rejection_reason) + REJECT_TEXT = repo.get(str(rejection_reason), "Title") + blood_priming_reject_notification = utility.get_object_from_names( + names.o_TreatmentBloodPrime_NotificationBar + ) + blood_priming_reject_notification_text = str(blood_priming_reject_notification.text) + test.compare( + blood_priming_reject_notification_text, + "[" + str(rejection_reason) + "] " + REJECT_TEXT, + f"Rejection reason number comparison for reason {rejection_reason}", + ) - 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 {blood_priming_reject_notification_text}") - td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_BLOOD_PRIME_STATE.value, 2, 0, 0, 0, 0, 0, 0, 0, 0 )