# Subject/Title: LDT-3946 Post-Treatment - SW - 02 - Foundation - Q&R # # Functionalities: Testing of Post-Treatment Foundation # # Steps: # 1 Handle patientDisconnectConfirmRequest and bloodSetAutoEject sent messages from UI # 2 Start Leahi Application, simulate TD standby mode and simulate TD Post Mode # and Navigate to Post-Treatment Screen and Compare Page Title text # 3 Click on Continue button in UI and Verify FW receives the request, Test Rejection Reason and Navigate to next screen # 4 Click on Auto Eject Button in UI And Verify FW receives the request, Test Rejection Reason # 5 Click on Continue button to Navigate to next screen # 6 Click on Skip button import names from configuration import config, utility, navigation, 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 from leahi_dialin.common.msg_defs import MsgIds from leahi_dialin.protocols import CAN from pathlib import Path td_simulator = TD_Messaging() can_interface = td_simulator.can_interface bloodSetAutoEject = False # handler for messages from UI to FW def handle_blood_set_auto_eject_request(message, timestamp=0.0): """ Called when the user requests to firmware from UI @return: None """ global bloodSetAutoEject bloodSetAutoEject = True def verify_values_tx_review(): blood_flow_prescribed_obj = waitForObject(names.o_PostTreatmentBase_bloodFlowDiaysate_ReviewContainer) blood_flow_prescribed_value_obj = utility.findChildByText(blood_flow_prescribed_obj, "Blood Flow Rate") blood_flow_prescribed_initial_value = utility.findObjectById(blood_flow_prescribed_value_obj, "_initial") test.compare(str(blood_flow_prescribed_initial_value.text),str(config.blood_flow_prescribed), "Blood flow prescribed value should be"+str(config.blood_flow_prescribed)) blood_flow_prescribed_actual_value = utility.findObjectById(blood_flow_prescribed_value_obj,"_actual") test.compare(str(blood_flow_prescribed_actual_value.text),str(config.blood_flow_actual), "Blood flow actual value should be"+ str(config.blood_flow_actual)) def main(): utils.tstStart(__file__) test.startSection("Post-Treatment Foundation") if can_interface is None: test.fail("CAN Interface is not available. Stopping tests.") return channel_id = CAN.CanChannels.ui_to_td_ch_id # Register Blood Set Auto Eject Request message_id = MsgIds.MSG_ID_UI_ADJUST_DISPOSABLES_REMOVAL_CONFIRM_REQUEST.value can_interface.register_receiving_publication_function( channel_id, message_id, handle_blood_set_auto_eject_request ) startApplication(utility.aut("-q")) td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value) td_simulator.td_operation_mode(TDOpModes.MODE_POST.value) post_treatment = utility.get_object_from_names(names.o_PostTreatmentStack_PostTreatmentStack) mouseClick(waitForObject(utility.findChildByText(post_treatment, config.CONTINUE), 3000)) td_simulator.td_patient_disconnect_confirm_response(vAccepted = 1, vRejectionReason = 0) mouseClick(waitForObject(utility.findChildByText(post_treatment, config.CONTINUE), 3000)) mouseClick(waitForObject(utility.findChildByText(post_treatment, config.AUTO_EJECT), 3000)) test.verify( waitFor(lambda: bloodSetAutoEject == True, 3000),"Testing UI -> TD message Auto Eject",) td_simulator.td_blood_set_auto_eject_response(vAccepted = 1, vRejectionReason = 0) td_simulator.td_post_tx_logs_response( vAccepted = 1, vRejectionReason = 0, vBloodFlowRate = config.blood_flow_prescribed, vBloodFlowRateActual = config.blood_flow_actual, vDialysateFlowRate = 80, vDialysateFlowRateActual = 90, vTreatmentDuration = 0, vTreatmentDurationActual = 0, vAcidConcentrateType = 0, vAcidConcentrateTypeActual = 20, vBicarbonateCartridgeSize = 30, vBicarbonateCartridgeSizeActual = 40, vPotassiumConcentration = 50, vPotassiumConcentrationActual = 10, vCalciumConcentration = 20, vCalciumConcentrationActual = 30, vBicarbonateConcentration = 40 , vBicarbonateConcentrationActual = 50, vSodiumConcentration = 60, vSodiumConcentrationActual = 70, vVitalsInterval = 5, vVitalsIntervalActual = 10, vDialyzerType = 0, vTreatmentStartEpoch = 0, vTreatmentEndEpoch = 0, vFluidBolusVolume = 0, vFluidBolusVolumeActual = 0, vHeparinType = 0, vHeparinDeliveryDuration = 0, vHeparinDeliveryDurationActual = 0, vTreatmentModality = 0, vTreatmentModalityActual = 0, vHDFOperatingMode = 0, vHDFOperatingModeActual = 0, vHepatitisStatus = 0, vDialysateTemperature = 10.0, vDialysateTemperatureActual = 11.0, vDialysateVolumeUsed = 12.0, vHeparinBolusVolume = 13.0, vHeparinBolusVolumeActual = 14.0, vHeparinDispenseRate = 15.0, vHeparinDispenseRateActual = 16.0, vHeparinDeliveredVolume = 17.0, vUFVolume = 18.0, vUFVolumeActual = 19.0, vUFVolumeTarget = 20.0, vUFRate = 21.0, vUFRateActual = 22.0, vUFRateTarget = 0, vSubstitutionVolume = 0, vSubstitutionVolumeActual = 0, vSubstitutionVolumeTarget = 0, vSubstitutionRate = 0, vSubstitutionRateActual = 0, vSubstitutionRateTarget = 0, vIsoUfVolume = 23.0, vIsoUfVolumeActual = 24.0, vIsoUfVolumeTarget = 25.0, vIsoUfRate = 26.0, vIsoUfRateActual = 27.0, vIsoUfRateTarget = 28.0, vWaterSampleTestResult = 0) verify_values_tx_review() utils.tstDone()