Index: tst_create_custom_treatment/test.py =================================================================== diff -u -r9b2b6f2f03d8988f9999d65945a60773cbaa22e9 -rdc6c3c4de69df27ed25c64b98f7ac05fad64bb97 --- tst_create_custom_treatment/test.py (.../test.py) (revision 9b2b6f2f03d8988f9999d65945a60773cbaa22e9) +++ tst_create_custom_treatment/test.py (.../test.py) (revision dc6c3c4de69df27ed25c64b98f7ac05fad64bb97) @@ -16,13 +16,13 @@ # This test is intended to be used to verify custom treatment in application . import names -import time import test from dialin.ui import utils from dialin.ui import unittests from builtins import str as pyStr from configuration import utility +from configuration.assertion_helper import AssertionHelper from dialin.common.msg_defs import RequestRejectReasons from dialin.ui.hd_simulator import HDSimulator @@ -55,7 +55,7 @@ 1184, 107, x_axis, y_axis, Qt.NoModifier) -def set_heparin_type(text): +def set_parameter_type(text): if isinstance(text, pyStr): names.operating_parameters["text"] = text return names.operating_parameters @@ -64,33 +64,6 @@ names.keyboard_input["text"] = "UFH 1,000 IU/mL" -def set_acid_concentrate(text): - if isinstance(text, pyStr): - names.operating_parameters["text"] = text - return names.operating_parameters - else: - test.log(f"Invalid \"text\": {text} for object.") - names.keyboard_input["text"] = "Fres.Naturalyte" - - -def set_bicarbonate_concentrate(text): - if isinstance(text, pyStr): - names.operating_parameters["text"] = text - return names.operating_parameters - else: - test.log(f"Invalid \"text\": {text} for object.") - names.keyboard_input["text"] = "Fres.Centrisol" - - -def set_dialyzer_type(text): - if isinstance(text, pyStr): - names.operating_parameters["text"] = text - return names.operating_parameters - else: - test.log(f"Invalid \"text\": {text} for object.") - names.keyboard_input["text"] = "BB Diacap Pro 13H" - - slider_object = waitForObject(names.demo) child = object.children(slider_object)[0] child = object.children(child)[0] @@ -138,41 +111,86 @@ test.compare(True, treatment_status) test.log("custom treatment should be rejected") + +def set_slider_value_for_parameter(index_value, item_text, slider_value, slider_obj): + + + parameter = object.children(slider_obj)[index_value] + slider_object = object.children(parameter)[2] + status = utility.set_slider_value(slider_value, slider_object) + if status is True: + test.passes(f"{item_text} should set to value -> {slider_value}") + else: + test.fail(f"{item_text} could not set to value -> {slider_value}") -def test_sliders(): + +def create_custom_treatment_record( blood_flow_rate, dialysate_flow_rate, + duration, heparin_dispensing_rate, + heparin_bolus_volume, heparin_stop_time, + saline_bolus, dialysate_temperature, + blood_pressure_measurement_interval, + rinseback_flowrate, + ): + + slider_object = waitForObject(names.create_treatment_screen) + child = object.children(slider_object)[0] + parameter_child = object.children(child)[0] + + slider_status = set_slider_value_for_parameter(index_value = 1, item_text = "blood flow rate", + slider_value = blood_flow_rate, slider_obj = parameter_child) + test.compare(Trueslider_status, ) + + set_slider_value_for_parameter(index_value = 2, item_text = "dialysate flow rate", + slider_value = dialysate_flow_rate, slider_obj = parameter_child) + + set_slider_value_for_parameter(index_value = 3, item_text = "duration", + slider_value = duration, slider_obj = parameter_child) + + parameter_object = set_parameter_type(text = "Heparin Stop Time") + utility.scroll_to_zone(parameter_object, names.create_treatment_screen) + + set_slider_value_for_parameter(index_value = 4, item_text = "heparin dispensing rate", + slider_value = heparin_dispensing_rate, slider_obj = parameter_child) + + set_slider_value_for_parameter(index_value = 5, item_text = "heparin bolus volume", + slider_value = heparin_bolus_volume, slider_obj = parameter_child) + + parameter_object = set_parameter_type(text = "Saline Bolus") + utility.scroll_to_zone(parameter_object, names.create_treatment_screen) + + + set_slider_value_for_parameter(index_value = 6, item_text = "heparin stop time", + slider_value = heparin_stop_time, slider_obj = parameter_child) + + set_slider_value_for_parameter(index_value = 7, item_text = "saline bolus", + slider_value = saline_bolus, slider_obj = parameter_child) """ - Tests that all sliders have the correct min / max values and that the selected value is displayed correctly. + set_slider_value_for_parameter(index_value = 8, item_text = "dialysate temperature", + slider_value = dialysate_temperature, slider_obj = parameter_child) - @return: None + set_slider_value_for_parameter(index_value = 9, item_text = "blood pressure measurement interval", + slider_value = blood_pressure_measurement_interval, slider_obj = parameter_child) + + set_slider_value_for_parameter(index_value = 10, item_text = "rinseback_flowrate", + slider_value = rinseback_flowrate, slider_obj = parameter_child) + + """ - - -def create_custom_treatment_record( bloodFlowRate, dialysateFlowRate, duration, - heparinDispensingRate, heparinBolusVolume, - heparinStopTime, salineBolus, dialysateTemperature, - bloodPressureMeasurement, rinsebackFlowRate - ): + - slider_object = waitForObject(names.pretreatment_create) - child = object.children(slider_object)[0] - child = object.children(child)[0] - child = object.children(child)[1] - child = object.children(child)[2] - child1 = object.children(child)[5] - move = object.children(child)[2] - set_random_slider_weight(value = 400, slider_object = child) + """ custom_treatment = waitForObject(names.custom_treatment) test.compare("Create a Custom Treatment", custom_treatment.text) test.log(f"user successfully authenticated.") + """ - - + """ mouseClick(waitForImage("blood",{ "tolerant": True, "threshold": 99.999 })) mouseClick(waitForImage("dialysate",{ "tolerant": True, "threshold": 99.999 })) mouseClick(waitForImage("duration",{ "tolerant": True, "threshold": 99.999 })) @@ -198,41 +216,35 @@ mouseClick(waitForImage("blood_pressure_measurement_interval",{ "tolerant": True, "threshold": 99.999 })) mouseClick(waitForImage("Rinseback_flow_rate",{ "tolerant": True, "threshold": 99.999 })) test.log("User successfully selected values for treatment items") - + """ def main(): utils.tstStart("tst_create_custom_treatment") utility.start_application("Create custom treatment for a patient") hd = HDSimulator() + hd.cmd_send_power_on_self_test_version_request() hd._handler_ui_first_check_in(message = None) tapObject(waitForObject(names.input_patient_id)) type(waitForObject(names.input_patient_id), PATIENT_ID) tapObject(waitForObject(names.confirm_button)) - hd.cmd_send_treatment_parameter_manual_validation_response([ - 1, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 - ]) - """ + create_custom_treatment_record( - bloodFlowRate = CREATE_TREATMENT_SLIDER_VALUES["bloodFlowRate"][0], - dialysateFlowRate = CREATE_TREATMENT_SLIDER_VALUES["dialysateFlowRate"][0], + blood_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["bloodFlowRate"][0], + dialysate_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["dialysateFlowRate"][0], duration = CREATE_TREATMENT_SLIDER_VALUES["duration"][0], - heparinDispensingRate = CREATE_TREATMENT_SLIDER_VALUES["heparinDispensingRate"][0], - heparinBolusVolume = CREATE_TREATMENT_SLIDER_VALUES["heparinBolusVolume"][0], - heparinStopTime = CREATE_TREATMENT_SLIDER_VALUES["heparinStopTime"][0], - salineBolus = CREATE_TREATMENT_SLIDER_VALUES["salineBolus"][0], - dialysateTemperature = CREATE_TREATMENT_SLIDER_VALUES["dialysateTemperature"][0], - bloodPressureMeasurementInterval = CREATE_TREATMENT_SLIDER_VALUES["bloodPressureMeasurementInterval"][0], - rinsebackFlowRate = CREATE_TREATMENT_SLIDER_VALUES["rinsebackFlowRate"][0], + heparin_dispensing_rate = CREATE_TREATMENT_SLIDER_VALUES["heparinDispensingRate"][0], + heparin_bolus_volume = CREATE_TREATMENT_SLIDER_VALUES["heparinBolusVolume"][0], + heparin_stop_time = CREATE_TREATMENT_SLIDER_VALUES["heparinStopTime"][0], + saline_bolus = CREATE_TREATMENT_SLIDER_VALUES["salineBolus"][0], + dialysate_temperature = CREATE_TREATMENT_SLIDER_VALUES["dialysateTemperature"][0], + blood_pressure_measurement_interval = CREATE_TREATMENT_SLIDER_VALUES["bloodPressureMeasurementInterval"][0], + rinseback_flowrate = CREATE_TREATMENT_SLIDER_VALUES["rinsebackFlowRate"][0], ) - verify_custom_treatment_record() + #verify_custom_treatment_record() """ - """ create_custom_treatment_record( bloodFlowRate = CREATE_TREATMENT_SLIDER_VALUES["bloodFlowRate"][1], dialysateFlowRate = CREATE_TREATMENT_SLIDER_VALUES["dialysateFlowRate"][1],