# 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 from squish import * 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 ="Patient ID" parent_obj = waitForObject(names.o_PreTreatmentCreate_leftColumn_Column) blood_flow_rate = utility.findObjectById(parent_obj, "_bloodFlowRate") utility.set_value_based_on_target(blood_flow_rate, 60) dialysate_flow_rate = utility.findObjectById(parent_obj, "_dialysateFlowRate") utility.set_value_based_on_target(dialysate_flow_rate, 75) duration = utility.findObjectById(parent_obj,"_duration") utility.set_value_based_on_target(duration, 75) right_obj = waitForObject(names.o_PreTreatmentCreate_rightColumn_Column) ultrafiltration_volume = utility.findObjectById(right_obj,"_ufVolume") utility.set_value_based_on_target(ultrafiltration_volume,0.10) heparin_rx = utility.findObjectById(right_obj,"_heparinRx") heparin_right_arrow = utility.findObjectById(heparin_rx, "_rightArrow") mouseClick(heparin_right_arrow) heparin_obj = waitForObject(names.o_LabelUnitValueAdjuster_LabelUnitValueAdjuster) heparin_bolus = utility.findObjectById(heparin_obj,"_heparinBolusVolume") heparin_bolus_right_arrow = utility.findObjectById(heparin_bolus,"_rightArrow") mouseClick(heparin_bolus_right_arrow) heparin_dispensing = waitForObject(names.o_heparinDispensingRate_LabelUnitValueAdjuster) heparin_dispensing_rignt_arrow = utility.findObjectById(heparin_dispensing,"_rightArrow") mouseClick(heparin_dispensing_rignt_arrow) mouseClick(waitForObject(names.o_confirmButton_ConfirmButton)) 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_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,config.BICARBONATE,0) Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) mouseClick(waitForObject(Nextbutton)) utility.set_value_based_on_target(names.o_PreTreatmentCreate_sodium_LabelUnitValueAdjuster, 139) utility.set_value_based_on_target(names.o_PreTreatmentCreate_bicarbonate_LabelUnitValueAdjuster, 35) utility.set_value_based_on_target(names.o_PreTreatmentCreate_fluidBolusVolume_LabelUnitValueAdjuster,300) utility.set_value_based_on_target(names.o_PreTreatmentCreate_primeRinsebackVolume_LabelUnitValueAdjuster,310) confirm_button = waitForObjectExists(names.o_preTreatmentStack_confirmButton_ConfirmButton) mouseClick(confirm_button) td.td_Treatment_Parameters_Validation( vAccepted = 1, vTreatmentModalityRejectReason = 1, vHDFTreatmentModeRejectReason = 0, vBloodFlowRateRejectReason = 0, vDialysateFlowRateRejectReason = 0, vTreatmentDurationRejectReason = 0, vHeparinDeliveryDurationRejectReason = 0, vHeparinTypeRejectReason = 0, vDryBicarbCartSizeRejectReason = 0, vSodiumRejectReason = 0, vBicarbonateRejectReason = 0, vDialyzerTypeRejectReason = 0, vFluidBolusVolumeRejectReason = 0, vBloodPressureMeasureIntervalRejecteason = 0, vRinsebackVolumeRejectReason = 0, vHepatitusBStatusRejectReason = 0, vAcidConcentrateIndextRejectReason = 0, vSubstitutionFluidVolumeRejecteason = 0, vHeparinBolusVolumeRejectReason = 0, vHeparinDispensingRateRejecteason = 0, vDialysateTempRejectReason = 0, vAcidConcentrateConversionFactorRejectReason = 0, vUFPreWeightRejectReason = 0, vUFEstimatedTargetWeightRejectReason = 0, vUFVolumeRejectReason = 0 ) test.endSection() def main(): utils.tstStart(__file__) startApplication(utility.aut("-q")) test.startSection("Verify the heparin state is off state") td.td_operation_mode(TDOpModes.MODE_STAN.value) hemodialysis = waitForObject(names.o_createHDTreatment_TouchRect) hemodialysis_btn = utility.findChildByText(hemodialysis, "Hemodialysis") mouseClick(hemodialysis_btn) td.td_Treatment_Parameters_CreateRx(vRejectionReason =0) td.td_operation_mode(TDOpModes.MODE_PRET.value, 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,2000) 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) hemodialysis = waitForObject(names.o_createHDTreatment_TouchRect) hemodialysis_btn = utility.findChildByText(hemodialysis, "Hemodialysis") mouseClick(hemodialysis_btn) td.td_Treatment_Parameters_CreateRx(vRejectionReason =0) td.td_operation_mode(TDOpModes.MODE_PRET.value, 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()