# 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: # Heparin: # 1 Navigate to create treatement and set Heparin dispensing, Heparin bolus and stop values to OFF state # And Verify the values in heparin page # 2 Navigate to create treatement and set Heparin dispensing, Heparin bolus and stop values to some state # And Verify the same parameter display in Heparin page # 3 In the Heparin page verify the different Heparin states # Paused State # Resume State # Completed state import names from leahi_dialin.ui import utils from configuration import utility,config,navigation 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() 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 parameter") 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") navigation.navigation_pageIndicator_step(config.CREATERX) mouseClick(waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry)) waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_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, 100) utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,config.ACID_CONCENTRATE,2) utility.select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,config.DIALYZER_TYPE,2) utility.select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,config.VITALS,1) utility.select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,config.BICARBONATE,0) Validatebutton = utility.setObjectText(obj = names.o_preTreatmentStack_Text, text =config.VALIDATE) mouseClick(waitForObject(Validatebutton)) 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, vTransmembranePressureLimitWindowRejectReason= 0, vDialysateTempRejectReason = 0, vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) confirmButton = utility.setObjectText(obj = names.o_preTreatmentStack_Text, text = config.CONFIRM) mouseClick(waitForObject(confirmButton)) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) test.startSection("Verify the heparin state is off state") td.td_operation_mode(TDOpModes.MODE_STAN.value) mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) td.td_operation_mode(TDOpModes.MODE_PRET.value) td.td_blood_set_auto_load_response(vRejectionReason = 0) verify_create_treatment_parameters_Heparin_OFF() change_treatmentstates(TDTreatmentStates.TREATMENT_PAUSED_STATE.value) change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) waitForObject(names.o_listView_Item,1000) heparin = utility.setObjectText(text=config.HEPARIN, obj=names.o_listView_Item) mouseClick(waitForObject(heparin)) verify_heparin_precription_parameters(config.heparin_off) test.endSection() test.startSection("Verify prescription rx parameters in heparin page") td.td_operation_mode(TDOpModes.MODE_STAN.value) mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) td.td_operation_mode(TDOpModes.MODE_PRET.value) td.td_blood_set_auto_load_response(vRejectionReason = 0) utility.verify_create_treatment_parameters() change_treatmentstates(TDTreatmentStates.TREATMENT_PAUSED_STATE.value) change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) waitForObject(names.o_listView_Item,1000) heparin = utility.setObjectText(text=config.HEPARIN, obj=names.o_listView_Item) mouseClick(waitForObject(heparin)) verify_heparin_precription_parameters(config.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,config.PAUSE,config.ACTIVE) pauseButton = waitForObject(names.o_treatmentHeparin_heparinButton_TouchRect) pauseText = utility.findObjectById(pauseButton, "_text") mouseClick(pauseText) verify_status_heparinStates(2,config.RESUME,config.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(config.COMPLETE, statustext.text,"Status text should be ->"+str(config.COMPLETE)) test.endSection() utils.tstDone()