# Subject/Title: LDT -2973 Heparin - SW - 02 - Q&R - 15: SIT - Software Integration Tests - Squish Qt # Functionalities: Testing all functionalities of Heparin in the main treatment screen # # Steps: # 1 Heparin: # Consists of the Prescription Rx parameters for Heparing and the menu tab inside of main treatment # # Test the confirmed prescription Rx matches the left container in the heparin page. Right container consists of FW messages of the Heparin data and displaying the status of different heparin states (HEPARING_STATE_DISPENSING, HEPARING_STATE_PAUSED, HEPARING_STATE_COMPLETED) # # Test also scenarion in prescription Rx if user sets all heparin to "OFF" then when treatment starts al the data should show empty "- -" import names from leahi_dialin.ui import utils from configuration import utility from configuration import config from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.ui_defs import TXStates from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates td =TD_Messaging() heparin_off = { "Heparin Type" :"OFF", "Dispensing Rate" :"OFF", "Bolus Volume" :"OFF", "Stop Time" :"OFF"} heparin_values = { "Heparin Type" :"Unfractionated 1,000 IU/mL", "Dispensing Rate" :"0.5", "Bolus Volume" :"0.4", "Stop Time" :"105"} PAUSE = 'Pause' ACTIVE = 'Active' RESUME = 'Resume' COMPLETE = 'Complete' HEPARIN = "Heparin" def verify_heparin_precription_parameters(heparin_value): test.startSection("Verify prescription rx parameters in heparin page") column = waitForObject(names.o_treatmentHeparin_Prescription_Column) # Get a list of the children to use with zip() children = object.children(column) # Using zip() to iterate through children and the dictionary's items for child, (key, expected_value) in zip(children, heparin_value.items()): value = utility.findObjectById(child, "_value") if value: test.compare(str(value.text), expected_value, " Comparison of Heparin Prescription '" + key + "'", ) test.endSection() def verify_status_heparinStates(heparin_state,buttonState,status): test.startSection("Verify the heparin states in Heparin page") td.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , heparin_state # Heparin state ) #check the pause button Button = waitForObject(names.o_treatmentHeparin_heparinButton_TouchRect) value = utility.findObjectById(Button, "_text") test.compare(buttonState, value.text,"Button text should be ->"+str(buttonState)) statusValue = waitForObject(names.o_treatmentHeparin_status_Rectangle) statustext = utility.findObjectById(statusValue,'_statusText') test.compare(status, statustext.text,"Status text should be ->"+str(status)) test.endSection() def change_treatmentstates(state): test.startSection("Change the treatment paramters") td.td_tx_state( state, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0) test.endSection() def verify_create_treatment_parameters_Heparin_OFF(): test.startSection("Pre treatment parameters") mouseClick(waitForObject(names.o_PatientIDEntry_TextEntry)) waitForObject(names.o_PatientIDEntry_TextEntry).text ="abcd" utility.set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 50) utility.set_value_based_on_target(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster, 50) utility.set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 60) mouseClick(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster) mouseClick(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster) utility.set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,37.5) utility.set_value_based_on_target(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, 200) utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,utility.ACID_CONCENTRATE,2) utility.select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,utility.DIALYZER_TYPE,2) utility.select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,utility.VITALS,1) utility.select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,utility.BICARBONATE,0) mouseClick(waitForObject(names.o_PreTreatmentButtom)) td.td_Treatment_Parameters_Validation( vAccepted = 1, vBloodFlowRateRejectReason = 0, vDialysateFlowRateRejectReason = 0, vTreatmentDurationRejectReason = 0, vSalineBolusVolumeRejectReason = 0, vHeparinStopTimeRejectReason = 0, vHeparinTypeRejectReason = 0, vAcidConcentrateRejectReason = 0, vBicarbonateConcentrateRejectReason = 0, vDialyzerTypeRejectReason = 0, vBloodPressureMeasureIntervalRejectReason = 0, vRinsebackFlowRateRejectReason = 0, vRinsebackVolumeRejectReason = 0, vArterialPressureLimitWindowRejectReason = 0, vVenousPressureLimitWindowRejectReason = 0, vVenousPressureLimitAsymtrcRejectReason = 0, vTrancembrncPressureLimitWindowRejectReason = 0, vDialysateTempRejectReason = 0, vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) confirmButton = waitForObject(names.o_PreTreatmentButtom) mouseClick(waitForObject(confirmButton)) td.td_operation_mode(TDOpModes.MODE_PRET.value, 0) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) td.td_operation_mode(TDOpModes.MODE_STAN.value) # verify Standby screen test.verify(waitForObjectExists(names.o_standByScreen_MainHome), "In Standby") change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) test.startSection("Check the heparin values in Heparin page") heparin = utility.setObjectText(text=HEPARIN, obj=names.o_listView_Item) mouseClick(waitForObject(heparin)) #check the off values verify_heparin_precription_parameters(heparin_off) test.endSection() test.startSection("Verify the heparin state is off state") td.td_operation_mode(TDOpModes.MODE_STAN.value) td.td_operation_mode(TDOpModes.MODE_TPAR.value) verify_create_treatment_parameters_Heparin_OFF() change_treatmentstates(TDTreatmentStates.TREATMENT_PAUSED_STATE.value) change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) heparin = utility.setObjectText(text=HEPARIN, obj=names.o_listView_Item) mouseClick(waitForObject(heparin)) verify_heparin_precription_parameters(heparin_off) test.endSection() test.startSection("Verify prescription rx parameters in heparin page") td.td_operation_mode(TDOpModes.MODE_STAN.value) td.td_operation_mode(TDOpModes.MODE_TPAR.value) utility.verify_create_treatment_parameters() change_treatmentstates(TDTreatmentStates.TREATMENT_PAUSED_STATE.value) change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) heparin = utility.setObjectText(text=HEPARIN, obj=names.o_listView_Item) mouseClick(waitForObject(heparin)) verify_heparin_precription_parameters(heparin_values) test.endSection() test.startSection("Verify the Heparin states") td.td_heparin(target = 0.4 , cumulative = 0.8 , time_remaining = 2646 ) verify_status_heparinStates(4,PAUSE,ACTIVE) pauseButton = waitForObject(names.o_treatmentHeparin_heparinButton_TouchRect) pauseText = utility.findObjectById(pauseButton, "_text") mouseClick(pauseText) verify_status_heparinStates(2,RESUME,PAUSE) td.td_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 5 # Heparin Complete state ) status = waitForObject(names.o_treatmentHeparin_status_Rectangle) statustext = utility.findObjectById(status,'_statusText') test.compare(COMPLETE, statustext.text,"Status text should be ->"+str(COMPLETE)) test.endSection() utils.tstDone()