# -*- coding: utf-8 -*-" # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # file tst_treatment monitoring. # @author Akshay Rajaram Dhawan # @author Sai Chaitanya Ela # @author Shweta Policepatil # @author Amol Shinde # @date 07-02-2022 # This test contradicts verification of Main Treatment monitoring screen parameters components import names from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator from configuration import config from dialin.common.hd_defs import HDOpModes, HDStandbyStates, TreatmentStates BLOOD_PRIMING_TARGET_VALUE = 150 hd_simulator = HDSimulator() def test_blood_prime_value(expected_blood_prime_value): """ Tests to verify target values from blood prime section. @param: expected_blood_prime_value - expected blood prime value. @return: N/A """ # utils.waitForGUI(0.5) expected_blood_prime_value = str(expected_blood_prime_value) +" "+config.LIQUID_UNIT test.compare(expected_blood_prime_value, waitForObject(names.o_target_value).text) def verification_of_blood_prime_from_dialysis_state(): """ Tests for verification of blood prime UI section. @param N/A @return: N/A """ test.startSection("verification of blood prime values based on target value") test.compare(waitForObject(names.o_blood_priming).text, config.BLOOD_PRIMING_TEXT, "{} is visible".format(config.BLOOD_PRIMING_TEXT)) test.compare(waitForObject(names.o_blood_priming_value_by_default).text, config.BLOOD_PRIMING_DEFAULT_VALUE, "{} is verified".format(config.BLOOD_PRIMING_DEFAULT_VALUE)) for target_range in (BLOOD_PRIMING_TARGET_VALUE, config.BLOOD_PRIMING_TARGET_MAXIMUM+1): test.log("Selected target value should be -> " + str(target_range)) for current_range in range(0, config.BLOOD_PRIMING_RANGE): hd_simulator.cmd_send_treatment_blood_prime_data(target = target_range,current = current_range) test_blood_prime_value(expected_blood_prime_value = current_range) utils.waitForGUI(0.1) #For fetching the effect in UI test.endSection() def verification_of_monitoring_treatment_parameters(): """ Tests for monitoring treatment parameters. @param: N/A @return: N/A """ test.startSection("verification of treatment parameters") hd_simulator.cmd_set_treatment_states_data(sub_mode=HDStandbyStates.STANDBY_WAIT_FOR_DISINFECT_STATE.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=TreatmentStates.TREATMENT_START_STATE.value, rinseback_state=TreatmentStates.TREATMENT_START_STATE.value, recirculate_state=TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_end_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state=TreatmentStates.TREATMENT_START_STATE.value, dialysis_state=TreatmentStates.TREATMENT_START_STATE.value, bloodLeakZeoringState=0) test.log("Test for verifying components of Flows in Main Treatment ") test.compare(str(waitForObject(names.o_Flows).text), config.FLOWS_TEXT) test.compare(waitForObject(names.o_Flows).visible, True, "{} is visible".format(config.FLOWS_TEXT)) test.compare(str(waitForObject(names.o_Blood).text), config.BLOOD_TEXT) test.compare(waitForObject(names.o_Blood).visible, True, "{} is visible".format(config.BLOOD_TEXT)) test.compare(str(waitForObject(names.o_Blood_Unit).text), config.BLOOD_UNIT) test.compare(waitForObject(names.o_Blood_Unit).visible, True, "{} is visible".format(config.BLOOD_UNIT)) test.compare(str(waitForObject(names.o_Dialysate).text ), config.DIALYSATE_TEXT) test.compare(waitForObject(names.o_Dialysate).visible, True, "{} is visible".format(config.DIALYSATE_TEXT)) test.compare(str(waitForObject(names.o_Dialysate_Unit).text), config.BLOOD_UNIT) test.compare(waitForObject(names.o_Dialysate_Unit).visible, True, "{} is visible".format(config.BLOOD_UNIT)) test.log("Test for verifying components of Vitals in Main Treatment ") test.compare(str(waitForObject(names.o_Vitals).text ), config.VITALS_TEXT) test.compare(waitForObject(names.o_Vitals).visible, True, "{} is visible".format(config.VITALS_TEXT)) test.compare(str(waitForObject(names.o_BloodPressure_Unit).text), config.BLOOD_PRESSURE_TEXT) test.compare(waitForObject(names.o_BloodPressure_Unit).visible, True, "{} is visible".format(config.BLOOD_PRESSURE_TEXT)) test.compare(str(waitForObject(names.o_HeartRate_Unit).text), config.HEARTRATE_UNIT) test.compare(waitForObject(names.o_HeartRate_Unit).visible, True, "{} is visible".format(config.HEARTRATE_UNIT)) test.log("Test for verifying components of Pressure in Main Treatment ") test.compare(str(waitForObject(names.o_pressure).text ), config.PRESSURE_TEXT) test.compare(waitForObject(names.o_pressure).visible, True, "{} is visible".format(config.PRESSURE_TEXT)) test.compare(str(waitForObject(names.o_Arterial).text ), config.ARTEREAL_TEXT) test.compare(waitForObject(names.o_Arterial).visible, True, "{} is visible".format(config.ARTEREAL_TEXT)) test.compare(str(waitForObject(names.o_Venous).text ), config.VENOUS_TEXT) test.compare(waitForObject(names.o_Venous).visible, True, "{} is visible".format(config.VENOUS_TEXT)) test.log("Test for verifying components of Time Duration in Main Treatment ") test.compare(str(waitForObject(names.o_Timeremaining).text ), config.TIME_DURATION_TEXT) test.compare(waitForObject(names.o_Timeremaining).visible, True, "{} is visible".format(config.TIME_DURATION_TEXT)) test.log("Test for verifying components of Ultrafiltration Volume in Main Treatment ") test.compare(str(waitForObject(names.o_Ultrafiltration).text ), config.ULTRAFILTERATION_TEXT) test.compare(waitForObject(names.o_Ultrafiltration ).visible, True, "{} is visible".format(config.ULTRAFILTERATION_TEXT)) test.log("Test for verifying components of Saline Bolus in Main Treatment ") test.compare(str(waitForObject(names.o_SalineBolus).text ), config.SALINE_BOLUS) test.compare(waitForObject(names.o_SalineBolus).visible, True, "{} is visible".format(config.SALINE_BOLUS)) test.compare(str(waitForObject(names.o_VolumeDelivered).text ), config.VOLUME_DELIVERED) test.compare(waitForObject(names.o_VolumeDelivered).visible, True, "{} is visible".format(config.VOLUME_DELIVERED)) test.compare(str(waitForObject(names.o_VolumeDElivered_Unit).text ), "mL" ) test.compare(waitForObject(names.o_VolumeDElivered_Unit).visible, True, "volume delivered unit is visible") test.compare(str(waitForObject(names.o_CumulativeDElivered).text ), config.CUMULATIVE_DELIVERED) test.compare(waitForObject(names.o_CumulativeDElivered).visible, True, "{} is visible".format(config.CUMULATIVE_DELIVERED)) test.compare(str(waitForObject(names.o_CumulativeDelivered_Unit).text ), config.LIQUID_UNIT) test.compare(waitForObject(names.o_CumulativeDelivered_Unit).visible, True, "{} is visible".format(config.LIQUID_UNIT)) test.log("Test for verifying components of Heparin in Main Treatment ") test.compare(str(waitForObject(names.o_Heparin).text ), config.HEPARIN_TEXT) test.compare(waitForObject(names.o_Heparin).visible, True, "{} is visible".format(config.HEPARIN_TEXT)) test.compare(str(waitForObject(names.o_Heparin_VolumeDelivered).text ), config.VOLUME_DELIVERED) test.compare(waitForObject(names.o_Heparin_VolumeDelivered).visible, True, "{} is visible".format(config.VOLUME_DELIVERED)) test.compare(str(waitForObject(names.o_Heparin_VolumeDelivered_Unit ).text ), config.LIQUID_UNIT) test.compare(waitForObject(names.o_Heparin_VolumeDelivered_Unit ).visible, True, "{} is visible".format(config.LIQUID_UNIT)) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) utils.waitForGUI(1) hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TREA.value) verification_of_blood_prime_from_dialysis_state() verification_of_monitoring_treatment_parameters() utils.tstDone()