# -*- 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, utility def test_blood_prime_value(expected_blood_prime_value): """ Tests to verify target values from blood prime section. @param: expected_blood_prime_value. @input: expected target value. """ bloodprime_text = waitForObject(names.o_target_value) bloodprime_unit = object.children(bloodprime_text)[1] expected_blood_prime_value = str(expected_blood_prime_value) +" "+str(config.LIQUID_UNIT) test.compare(expected_blood_prime_value, bloodprime_unit.text) def verification_of_blood_prime_from_dialysis_state(hd_instance): """ Tests for verification of blood prime UI section. @param hd_instance - instance for hd simulator. @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, "blood priming text is verified") test.compare(waitForObject(names.o_blood_priming_value_by_default).text, config.BLOOD_PRIMING_DEFAULT_VALUE, "blood priming unit is verified") for target_range in (150, 300): test.log("Selected target value should be -> " + str(target_range)) for current_range in range(0, config.BLOOD_PRIMING_RANGE-1): hd_instance.cmd_send_treatment_blood_prime_data(target = target_range,current = current_range) test_blood_prime_value(expected_blood_prime_value = current_range) utils.waitForGUI(1.5) #For fetching the effect in UI test.endSection() def monitoring_treatment_parameters(hd_instnace): """ Tests for monitoring treatment parameters. @param: hd_instance - instance for hd simulator. @return: N/A """ test.startSection("Verification of treatment parameters") hd_instnace.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 0, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, treatment_end_state=0, treatment_stop_state= 0) test.log("Test for verifying components of Flows in Main Treatment ") test.compare(str(waitForObject(names.o_Flows).text), "FLOWS") test.compare(waitForObject(names.o_Flows).visible, True) test.compare(str(waitForObject(names.o_Blood).text), "Blood") test.compare(waitForObject(names.o_Blood).visible, True) test.compare(str(waitForObject(names.o_Blood_Unit).text), "mL/min") test.compare(waitForObject(names.o_Blood_Unit).visible, True) test.compare(str(waitForObject(names.o_Dialysate).text ), "Dialysate" ) test.compare(waitForObject(names.o_Dialysate).visible, True) test.compare(str(waitForObject(names.o_Dialysate_Unit).text), "mL/min") test.compare(waitForObject(names.o_Dialysate_Unit).visible, True) test.log("Test for verifying components of Vitals in Main Treatment ") test.compare(str(waitForObject(names.o_Vitals).text ), "VITALS" ) test.compare(waitForObject(names.o_Vitals).visible, True) test.compare(str(waitForObject(names.o_BloodPressure_Unit).text), "mmHg") test.compare(waitForObject(names.o_BloodPressure_Unit).visible, True) test.compare(str(waitForObject(names.o_HeartRate_Unit).text), "BPM") test.compare(waitForObject(names.o_HeartRate_Unit).visible, True) test.log("Test for verifying components of Pressure in Main Treatment ") test.compare(str(waitForObject(names.o_pressure).text ), "PRESSURE (mmHg)" ) test.compare(waitForObject(names.o_pressure).visible, True) test.compare(str(waitForObject(names.o_Arterial).text ), "Arterial" ) test.compare(waitForObject(names.o_Arterial).visible, True) test.compare(str(waitForObject(names.o_Venous).text ), "Venous" ) test.compare(waitForObject(names.o_Venous).visible, True) test.log("Test for verifying components of Time Duration in Main Treatment ") test.compare(str(waitForObject(names.o_Timeremaining).text ), "Time Remaining" ) test.compare(waitForObject(names.o_Timeremaining).visible, True) test.log("Test for verifying components of Ultrafiltration Volume in Main Treatment ") test.compare(str(waitForObject(names.o_Ultrafiltration).text ), "ULTRAFILTRATION VOLUME (L)" ) test.compare(waitForObject(names.o_Ultrafiltration ).visible, True) test.log("Test for verifying components of Saline Bolus in Main Treatment ") test.compare(str(waitForObject(names.o_SalineBolus).text ), "SALINE BOLUS" ) test.compare(waitForObject(names.o_SalineBolus).visible, True) test.compare(str(waitForObject(names.o_VolumeDelivered).text ), "Volume Delivered" ) test.compare(waitForObject(names.o_VolumeDelivered).visible, True) test.compare(str(waitForObject(names.o_VolumeDElivered_Unit).text ), "mL" ) test.compare(waitForObject(names.o_VolumeDElivered_Unit).visible, True) test.compare(str(waitForObject(names.o_CumulativeDElivered).text ), "Cumulative Delivered" ) test.compare(waitForObject(names.o_CumulativeDElivered).visible, True) test.compare(str(waitForObject(names.o_CumulativeDelivered_Unit).text ), "mL" ) test.compare(waitForObject(names.o_CumulativeDelivered_Unit).visible, True) test.log("Test for verifying components of Heparin in Main Treatment ") test.compare(str(waitForObject(names.o_Heparin).text ), "HEPARIN" ) test.compare(waitForObject(names.o_Heparin).visible, True) test.compare(str(waitForObject(names.o_Heparin_VolumeDelivered).text ), "Volume Delivered" ) test.compare(waitForObject(names.o_Heparin_VolumeDelivered).visible, True) test.compare(str(waitForObject(names.o_Heparin_VolumeDelivered_Unit ).text ), "mL" ) test.compare(waitForObject(names.o_Heparin_VolumeDelivered_Unit ).visible, True) test.endSection() def main(): utils.tstStart("tst_treatment_monitoring") utility.start_application(config.AUT_NAME) hd = HDSimulator() hd.cmd_send_power_on_self_test_version_request() hd._handler_ui_first_check_in(message = None) hd.cmd_send_hd_operation_mode(6, 0) verification_of_blood_prime_from_dialysis_state(hd) monitoring_treatment_parameters(hd) utils.waitForGUI(0.5) utils.tstDone()