Index: shared/scripts/configuration/config.py =================================================================== diff -u -r52bc8f634fc08f78afc721468c23106dff15fe5a -rcdc2b6ae80bb42957f9e1e225f5f64140614efd6 --- shared/scripts/configuration/config.py (.../config.py) (revision 52bc8f634fc08f78afc721468c23106dff15fe5a) +++ shared/scripts/configuration/config.py (.../config.py) (revision cdc2b6ae80bb42957f9e1e225f5f64140614efd6) @@ -83,6 +83,7 @@ HEART_RATE_UPPER_LIMIT = 180 TREATMENT_UNHIGHLIGHTED_COLOR = "#000000" TREATMENT_HIGHLIGHTED_COLOR = "#135088" +TREATMENT_PRESSURE_IN_RANGE_COLOR="#ffffff" # for the range bar marker text #create custom treatment HIGHER_VALUE_OF_BLOOD_FLOW_RATE = 500 @@ -134,21 +135,29 @@ "Rinseback Flow Rate": [50, 75, 100, 125, 150], } -#dictionary consist of slider [minimum value, slider buffer value, width buffer of slider, maximum value] +#dictionary consist of slider [minimum value, slider buffer value, width buffer of slider] CREATE_TREATMENT_SLIDER_VALUES = { - - "blood_flow_rate" : [100, 25, 46, 500], - "dialysate_flow_rate" : [100, 50, 75, 600], - "duration" : [60, 15, 28, 480], - "heparin_dispensing_rate" : [0.2, 0.1, 93, 1.0], - "heparin_bolus_volume" : [0.2, 0.1, 41, 2.0], - "heparin_stop_time" : [0, 10, 15.75, 480], - "saline_bolus" : [100, 100, 425, 300], - "dialysate_temperature" : [35, 0.5, 187.5, 37.0], + "blood_flow_rate" : [100, 25, 46], + "dialysate_flow_rate" : [100, 50, 75], + "duration" : [60, 15, 28], + "heparin_dispensing_rate" : [0.2, 0.1, 93], + "heparin_bolus_volume" : [0.2, 0.1, 41], + "heparin_stop_time" : [0, 10, 15.75], + "saline_bolus" : [100, 100, 425], + "dialysate_temperature" : [35, 0.5, 187.5], "arterial_pressure_limit_high" : [20, 10, 11.931], - "blood_pressure_measurement_interval" : [5, 5, 60, 60], + "blood_pressure_measurement_interval" : [5, 5, 60], } - + +# NOTE this is for the sliders specifically on the Treatment screen's pressure dialog (tst_main_treatment_pressure) +#dictionary consist of slider [minimum value, slider buffer value, width buffer of slider] +TREATMENT_PRESSURE_ADJUSTMENT_VALUES = { + "arterial_window" : [120, 40, 300], + "venous_window" : [100, 20, 150], + "venous_asymmetric" : [20, 5, 225] +} +TREATMENT_PRESSURE_ADJUSTMENT_TITLE = "PRESSURES" + #Alarms location CONFIG_PATH = Path(os.getcwd()) HOME_DIR_PATH = CONFIG_PATH.parent.parent.parent Index: shared/scripts/names.py =================================================================== diff -u -re3f67a6e78d267bb99596ba1ce439c6fe7d89a25 -rcdc2b6ae80bb42957f9e1e225f5f64140614efd6 --- shared/scripts/names.py (.../names.py) (revision e3f67a6e78d267bb99596ba1ce439c6fe7d89a25) +++ shared/scripts/names.py (.../names.py) (revision cdc2b6ae80bb42957f9e1e225f5f64140614efd6) @@ -171,6 +171,8 @@ # venous progress o_venous_slider = {"container": o_venous_range_slider , "id": "_slider" , "type": "Slider" } o_venous_limitbar = {"container": o_venous_range_slider, "id": "_progressRect" , "type": "ProgressRect"} +o_venous_asymmetric_slider = {"container": o_Overlay, "id": "_slider", "occurrence": 3, "type": "Slider", "unnamed": 1, "visible": True} + # arterial adjustment low slider title text o_venous_slider_handle = {"container": o_venous_slider, "id": "_handler", "type": "Rectangle"} # venous adjustment low slider title text @@ -1137,4 +1139,15 @@ o_treatmentHome_Saline_Rejection_Text = {"container": o_treatmentHome, "text": "", "type": "Text", "unnamed": 1, "visible": True} o_SettingsHome_confirmButton = {"container": o_SettingsHome_SettingsHome_settings, "objectName": "_confirmButton", "type": "ConfirmButton", "visible": True} +o_treatmentHome_text_container = {"container": o_treatmentHome,"type": "Text", "unnamed": 1, "visible": True} +#treatment screen - pressures +o_treatmentHome_arterialRangeBar_RangeBar = {"container": o_treatmentHome, "id": "_arterialRangeBar", "type": "RangeBar", "unnamed": 1, "visible": True} +o_treatmentHome_arterialRangeBar_RangeBar_marker = {"container": o_treatmentHome_arterialRangeBar_RangeBar, "id": "_rangeMarkerValue", "type": "RangeMarker", "unnamed": 1, "visible": True} +o_treatmentHome_pressure_arterial_marker_text = {"container": o_treatmentHome_arterialRangeBar_RangeBar_marker, "id": "_textValue", "type": "Text", "unnamed": 1, "visible": True} + +o_treatmentHome_venousRangeBar_RangeBar = {"container": o_treatmentHome, "id": "_venousRangeBar", "type": "RangeBar", "unnamed": 1, "visible": True} +o_treatmentHome_venousRangeBar_RangeBar_marker = {"container": o_treatmentHome_venousRangeBar_RangeBar, "id": "_rangeMarkerValue", "type": "RangeMarker", "unnamed": 1, "visible": True} +o_treatmentHome_pressure_venous_marker_text = {"container": o_treatmentHome_venousRangeBar_RangeBar_marker, "id": "_textValue", "type": "Text", "unnamed": 1, "visible": True} + + Index: suite.conf =================================================================== diff -u -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 -rcdc2b6ae80bb42957f9e1e225f5f64140614efd6 --- suite.conf (.../suite.conf) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) +++ suite.conf (.../suite.conf) (revision cdc2b6ae80bb42957f9e1e225f5f64140614efd6) @@ -5,6 +5,6 @@ IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_environment tst_post tst_standbymode tst_In_treatment tst_main_treatment_pressure tst_treatment_blood_dialysateflow_rate tst_main_treatment_vitals tst_ui_alarms_list tst_ui_alarms_dialog tst_main_treatment_ultrafiltration tst_main_treatment_heparin tst_pre_treatment_priming pre_treatment_disposables pre_treatment_patient_connection tst_unhandled_message_log tst_instructions_poc tst_service_screen tst_cloud_sync_device_registration tst_rinseback_setup tst_recirculate tst_settings_information tst_cloud_sync - treatment_screen tst_dialin_logs tst_disinfection tst_service_protected_menu tst_service_export_logs +TEST_CASES=tst_environment tst_post tst_standbymode tst_In_treatment tst_main_treatment_pressure tst_treatment_blood_dialysateflow_rate tst_main_treatment_vitals tst_ui_alarms_list tst_ui_alarms_dialog tst_main_treatment_ultrafiltration tst_main_treatment_heparin tst_pre_treatment_priming pre_treatment_disposables pre_treatment_patient_connection tst_unhandled_message_log tst_instructions_poc tst_service_screen tst_cloud_sync_device_registration tst_rinseback_setup tst_recirculate tst_settings_information tst_cloud_sync - treatment_screen tst_dialin_logs tst_disinfection tst_service_protected_menu tst_service_export_logs tst_main_treatment_flows VERSION=3 WRAPPERS=Qt Index: tst_create_custom_treatment/test.py =================================================================== diff -u -rb4d2f9ef205d7fb355ffd9cd4e5f647dd2c37e9b -rcdc2b6ae80bb42957f9e1e225f5f64140614efd6 --- tst_create_custom_treatment/test.py (.../test.py) (revision b4d2f9ef205d7fb355ffd9cd4e5f647dd2c37e9b) +++ tst_create_custom_treatment/test.py (.../test.py) (revision cdc2b6ae80bb42957f9e1e225f5f64140614efd6) @@ -14,8 +14,8 @@ # NOTE: # This test is intended to be used to verify custom treatment in application . +# SliderArrows are briefly tested as part of tst_instructions_poc - import names from dialin.ui import utils from configuration import utility @@ -28,33 +28,6 @@ PRE_TREATMENT_STEP = 0 -def test_sliderArrows(sliderObject = None, occurenceIndex = 0, currentValue = 0, changeAmount = 0, valuesKey = "", configStr = ""): - """ - Method to test a slider's arrows (increment and decrement) effect on the slider's actual value - @param sliderObject: The slider object - @param currentValue: The slider's current value set when calling this method - @param valuesKey : the string key of this slider's value in the CREATE_TREATMENT_SLIDER_VALUES array - @param configStr : the configuration string - """ - # set the buttons to the index expected - names.o_PreTreatmentCreate_IncrementButton["occurrence"] = occurenceIndex - names.o_PreTreatmentCreate_DecrementButton["occurrence"] = occurenceIndex - - # increment slider value - mouseClick(waitForObject(names.o_PreTreatmentCreate_IncrementButton)) - test.compare(format(waitForObjectExists(sliderObject).value, '.2f'), format(currentValue+changeAmount, '.2f'), valuesKey+" slider value should set to "+str(currentValue+changeAmount)) - - # wait for GUi to update - utils.waitForGUI(0.2) - - # decrement slider value - mouseClick(waitForObject(names.o_PreTreatmentCreate_DecrementButton)) - test.compare(format(waitForObjectExists(sliderObject).value, '.2f'), format(currentValue, '.2f'), valuesKey+" slider value should set to "+str(currentValue)) - - #reset the index to 0 - names.o_PreTreatmentCreate_IncrementButton["occurrence"] = 0 - names.o_PreTreatmentCreate_DecrementButton["occurrence"] = 0 - def set_parameter_type(text): """ Method to set object property based on text Index: tst_main_treatment_flows/test.py =================================================================== diff -u --- tst_main_treatment_flows/test.py (revision 0) +++ tst_main_treatment_flows/test.py (revision cdc2b6ae80bb42957f9e1e225f5f64140614efd6) @@ -0,0 +1,78 @@ +# -*- 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_main_treatment_pressure +# date Apr/12/2022 +# author Papiya Mandal + +import names + +from builtins import int as pyInt +from configuration.config import * +from configuration.utility import * +from configuration import application_init +from dialin.ui import utils +from dialin.ui.hd_simulator import HDSimulator +from configuration import utility +from dialin.common.msg_ids import MsgIds +from dialin.common import msg_defs + +hd_simulator = HDSimulator() + +TREATMENT_FLOW_ADJUSTMENT_HD_TEST_VALUES = [ + {"blood_flow": 120, "dialysate_flow": 30}, + {"blood_flow": 200, "dialysate_flow": 35} + ] + +def test_GUI_response_to_HD_value_setting(): + for index in range(0, len(TREATMENT_FLOW_ADJUSTMENT_HD_TEST_VALUES), 1): + blood_flow_test_value = TREATMENT_FLOW_ADJUSTMENT_HD_TEST_VALUES[index]["blood_flow"] + dialysate_flow_test_value = TREATMENT_FLOW_ADJUSTMENT_HD_TEST_VALUES[index]["dialysate_flow"] + + test.startSection(f"Testing the flow value display : blood flow ({blood_flow_test_value}) and dialysate flow ({dialysate_flow_test_value})") + hd_simulator.cmd_set_treatment_blood_flow_rate(0,0.1,0.2,0.3,0.4,0.5,0,6,blood_flow_test_value, 0) + hd_simulator.cmd_set_treatment_dialysate_flow_rate(0,0.1,0.2,0.3,0.4,0.5,0,6,dialysate_flow_test_value, 0) + + utils.waitForGUI(0.5) + + # check blood flow labels + names.o_treatmentHome_text_container["text"] = str(blood_flow_test_value) + blood_flow_display_object = utility.get_object_from_names(names.o_treatmentHome_text_container, error_message="blood flow text object is missing") + if blood_flow_display_object is not None: + test.compare(blood_flow_display_object.text, str(blood_flow_test_value), "Expecting flow value to be displayed") + + # check dialysate flow labesl + names.o_treatmentHome_text_container["text"] = str(dialysate_flow_test_value) + dialysate_flow_display_object = utility.get_object_from_names(names.o_treatmentHome_text_container, error_message="dialysate flow text object is missing") + if dialysate_flow_display_object is not None: + test.compare(dialysate_flow_display_object.text, str(dialysate_flow_test_value), "Expecting flow value to be displayed") + + test.endSection() + + +def main(): + utils.tstStart(__file__) + application_init.setup_post_log_successful_start() + + startApplication(config.AUT_NAME_ONLY +" -q") + + hd_simulator.cmd_send_power_on_self_test_version_request() + hd_simulator.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, dialysis_state=0) + + # flow values shown on the treatment screen + test_GUI_response_to_HD_value_setting() + + # TODO need to test pop up screen with sliders + # TODO need to check values in log + + utils.tstDone() + Index: tst_main_treatment_pressure/test.py =================================================================== diff -u -re3f67a6e78d267bb99596ba1ce439c6fe7d89a25 -rcdc2b6ae80bb42957f9e1e225f5f64140614efd6 --- tst_main_treatment_pressure/test.py (.../test.py) (revision e3f67a6e78d267bb99596ba1ce439c6fe7d89a25) +++ tst_main_treatment_pressure/test.py (.../test.py) (revision cdc2b6ae80bb42957f9e1e225f5f64140614efd6) @@ -16,9 +16,14 @@ from builtins import int as pyInt from configuration.config import * from configuration.utility import * +from configuration import application_init from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator +from configuration import utility +from dialin.common.msg_ids import MsgIds +from dialin.common import msg_defs + in_range_color = "#ffffff" out_of_range_color = "#c53b33" ART_LOW_VAL_MINUS_120 = -120 @@ -46,7 +51,35 @@ ACCEPTED = 0 hd_simulator = HDSimulator() +# the values for testing the slider and logging for pressure limit adjustment dialog +ADJUST_PRESSURE_LIMIT_TEST_VALUES = [ + {"arterial_window":120, "venous_window" : 100, "venous_asymmetric":20}, + {"arterial_window":120, "venous_window" : 140, "venous_asymmetric":35}, + {"arterial_window":200, "venous_window" : 120, "venous_asymmetric":20}, + {"arterial_window":160, "venous_window" : 100, "venous_asymmetric":25}, + ] + +def test_custom_treatment_slider(slider_object, value, slider_parameter, parameter, x_mouseclick_shift = 0): + ## TODO need to move the implementation of this function to a single spot, update all tests to use that single function + ## since all the function calls are doing the same thing! + """ + Method to set slider handle based on custom values + @param slider_object : (dictionary) object of treatment parameters + @param value : (int)value to be set on slider + @param slider_parameter : (list) consist combination of slider minimum value, slider buffer and width buffer + @param parameter : (str) parameter name + """ + minimum_slider_value = slider_parameter[0] + slider_buffer = slider_parameter[1] + width_buffer = slider_parameter[2] + slider_width = ((value - minimum_slider_value)/slider_buffer) * width_buffer + x_mouseclick_shift + slider_obj = utility.get_object_from_names(slider_object, error_message=parameter+" slider object missing") + if slider_obj is not None: + mouseClick(slider_obj, float(slider_width) , 3, Qt.LeftButton) + utils.waitForGUI(0.5) + test.compare(slider_obj.value, value, str(parameter)+" slider value should set to " +str(value)) + def verify_arterial_and_venous_value_in_main_treatment_screen(accepted, art_low, art_high, ven_low, ven_high): """ Method to verify Arterial low and high @@ -644,57 +677,193 @@ close_the_pop_up() test.endSection() +# TODO need to copy to utility sice this function is also used in other testcases, should consolidate +def verify_log(msg_id=None, msg=None, param=None): + """ + This function verifies the UI log's. + @param msg_id - (string) expected message_id's. + @param msg - (string) message to be displayed on log. + @param param - (list) parameters for msg_id's. + """ + test.startSection("Verification of UI log based on message : " + str(msg)) + param = ','.join(str(param)) if param is not None else param + utils.waitForGUI(2) + ack = False + if not msg_id in msg_defs.ACK_NOT_REQUIRED and msg_id != None: + ack = True + message_extracted = utility.get_current_log_details(message_ack=ack, message_text=msg) + test.log(str(message_extracted)) + if None in message_extracted: + test.fail("Message not found in log file.") + test.endSection() + return + if ack == True: + test.verify((config.ACK_REQ_STATUS in message for message in message_extracted), "ack request is verified") + test.verify((config.ACK_BAK_STATUS in message for message in message_extracted), "ack back is verified") + message_id_hex = builtins.hex(builtins.int(msg_id)) + message_id_str = builtins.str(message_id_hex).upper() + test.verify((message_id_str in message for message in message_extracted), "message ID is verified") + if param is not None: + test.verify((param in message for message in message_extracted), "parameters are verified") + test.endSection() + +def test_pressure_limit_adjust(arterial_window, venous_window, venous_asymmetric): + test.startSection(f"Testing slider value for arterial ({arterial_window}), venous window ({venous_window}), and venous asymmetric ({venous_asymmetric})") + open_pressure_pop_up() + test_custom_treatment_slider(names.o_arterial_slider, arterial_window, config.TREATMENT_PRESSURE_ADJUSTMENT_VALUES["arterial_window"], + config.TREATMENT_PRESSURE_ADJUSTMENT_TITLE) + test_custom_treatment_slider(names.o_venous_slider, venous_window, config.TREATMENT_PRESSURE_ADJUSTMENT_VALUES["venous_window"], + config.TREATMENT_PRESSURE_ADJUSTMENT_TITLE) + test_custom_treatment_slider(names.o_venous_asymmetric_slider, venous_asymmetric, config.TREATMENT_PRESSURE_ADJUSTMENT_VALUES["venous_asymmetric"], + config.TREATMENT_PRESSURE_ADJUSTMENT_TITLE) + click_on_confirm_btn() + test.endSection() +def test_adjust_pressure_limit_slider_and_logs_entry(): + """ + This verifies that when the pressure limits are adjusted, the application + logs the changes + """ + test.startSection("Verify the log entry exists for adjusted pressure limits") + for index in range(0, len(ADJUST_PRESSURE_LIMIT_TEST_VALUES), 1): + target_arterial_window = ADJUST_PRESSURE_LIMIT_TEST_VALUES[index]["arterial_window"] + target_venous_window = ADJUST_PRESSURE_LIMIT_TEST_VALUES[index]["venous_window"] + target_venous_asymmetric=ADJUST_PRESSURE_LIMIT_TEST_VALUES[index]["venous_asymmetric"] + + # set and check the slider values + test_pressure_limit_adjust(arterial_window = target_arterial_window, + venous_window = target_venous_window, + venous_asymmetric = target_venous_asymmetric) + #check log entry + verify_log(msg_id = MsgIds.MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST.value, msg = "AdjustPressuresLimits", + param = [target_arterial_window, target_venous_window, target_venous_asymmetric]) + + test.endSection() + +def test_adjust_pressure_limit_dialog_closes(): + """ + This test checks to make sure that the dialog closes after the UI receives a response + """ + test.startSection("Testing pressure limit adjust dialog closure when HD accepts values") + open_pressure_pop_up() + + # using first of the test values as the values for this test + target_arterial_window = ADJUST_PRESSURE_LIMIT_TEST_VALUES[0]["arterial_window"] + target_venous_window = ADJUST_PRESSURE_LIMIT_TEST_VALUES[0]["venous_window"] + target_venous_asymmetric=ADJUST_PRESSURE_LIMIT_TEST_VALUES[0]["venous_asymmetric"] + + test_pressure_limit_adjust(arterial_window = target_arterial_window, venous_window = target_venous_window, venous_asymmetric = target_venous_asymmetric) + + # mock a response back from HD to UI to close dialog + hd_simulator.cmd_send_treatment_adjust_pressures_limit_response(accepted = 1, reason = 0, + art_pressure_limit_window = target_arterial_window, + ven_pressure_limit_window = target_venous_window, + ven_pressure_asym_limit_window = target_venous_asymmetric) + utils.waitForGUI(0.5) # wait for GUi update + + + # this is a bit reverse, when a dialog is not visible the "waitForObjectExists" throws an exception + # indicating that the dialog does not exist, so using this as check. + try: + dialog_object = waitForObjectExists(names.o_modalDialog, 200) + test.fail("Pop up is still visible") + except LookupError: + test.passes("Pop up not visible") + + test.endSection() + +def test_pressure_displayed_in_treatment_screen_range_bar(): + TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES = [ + {"is_arterial_pressure_in_range":True, "arterial_pressure": 100, "arterial_limit_low":-300, "arterial_limit_high":120, + "is_venous_pressure_in_range" : True, "venous_pressure": 140, "venous_limit_low":-100, "venous_limit_high":250, + "blood_pump_occlusion" : 1, "pressure_limit_state":2, }, + {"is_arterial_pressure_in_range":False, "arterial_pressure": -200, "arterial_limit_low":-150, "arterial_limit_high":120, + "is_venous_pressure_in_range" : True, "venous_pressure": 140, "venous_limit_low":-100, "venous_limit_high":250, + "blood_pump_occlusion" : 1, "pressure_limit_state":2, }, + {"is_arterial_pressure_in_range":True, "arterial_pressure": 110, "arterial_limit_low":100, "arterial_limit_high":120, + "is_venous_pressure_in_range" : False, "venous_pressure": -100, "venous_limit_low":-50, "venous_limit_high":250, + "blood_pump_occlusion" : 1, "pressure_limit_state":2, }, + {"is_arterial_pressure_in_range":False, "arterial_pressure": -130, "arterial_limit_low":-140, "arterial_limit_high":120, + "is_venous_pressure_in_range" : False, "venous_pressure": 200, "venous_limit_low":-100, "venous_limit_high":150, + "blood_pump_occlusion" : 1, "pressure_limit_state":2, }, + ] + for index in range(0, len(TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES), 1): + test.startSection("Checking the value of the range bar in pressure on the treatment screen - dataset # {}".format(index)) + + is_arterial_pressure_value_in_range = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["is_arterial_pressure_in_range"] + is_venous_pressure_value_in_range = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["is_venous_pressure_in_range"] + target_arterial_pressure = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["arterial_pressure"] + target_venous_pressure = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["venous_pressure"] + target_blood_pump_occlusion = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["blood_pump_occlusion"] + target_pressure_state = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["pressure_limit_state"] + target_arterial_min_limit = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["arterial_limit_low"] + target_arterial_max_limit = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["arterial_limit_high"] + target_venous_min_limit = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["venous_limit_low"] + target_venous_max_limit = TREATMENT_PRESSURE_ADJUSTMENT_HD_TEST_VALUES[index]["venous_limit_high"] + + # mock the HD data sent to UI + hd_simulator.cmd_set_pressure_occlusion_data(arterial_prs = target_arterial_pressure, venous_prs = target_venous_pressure, + blood_pump_occlusion = target_blood_pump_occlusion, pressure_state= target_pressure_state, + art_min_limit = target_arterial_min_limit, art_max_limit = target_arterial_max_limit, + ven_min_limit = target_venous_min_limit, ven_max_limit = target_venous_max_limit) + + utils.waitForGUI(1) + + # check the range bar's upper and lower bounds + arterial_rangeBar = utility.get_object_from_names(names.o_treatmentHome_arterialRangeBar_RangeBar, error_message="arterial rangeBar object is missing") + if arterial_rangeBar is not None: + test.compare(arterial_rangeBar.lowerBound, target_arterial_min_limit, "Checking lower bound of arterial pressure range bar") + test.compare(arterial_rangeBar.upperBound, target_arterial_max_limit, "Checking upper bound of arterial pressure range bar") + + #check the marker value for the arterial pressure + arterial_rangeBar_marker_text_object = utility.get_object_from_names(names.o_treatmentHome_pressure_arterial_marker_text, error_message="arterial pressure marker label object is missing") + if arterial_rangeBar_marker_text_object is not None: + test.compare(arterial_rangeBar_marker_text_object.text, str(target_arterial_pressure), "Expecting arterial pressure to be displayed") + # base on the data set, check the color of the marker text + if is_arterial_pressure_value_in_range is not True: + test.compare(arterial_rangeBar_marker_text_object.color.name, config.OUT_OF_RANGE_COLOR, "Expecting color to be " + config.OUT_OF_RANGE_COLOR) + else: + test.compare(arterial_rangeBar_marker_text_object.color.name, config.TREATMENT_PRESSURE_IN_RANGE_COLOR, "Expecting color to be " + config.TREATMENT_PRESSURE_IN_RANGE_COLOR) + + # check the range bar's upper and lower bounds + venous_rangeBar = utility.get_object_from_names(names.o_treatmentHome_venousRangeBar_RangeBar, error_message="venous rangeBar object is missing") + if venous_rangeBar is not None: + test.compare(venous_rangeBar.lowerBound, target_venous_min_limit, "Checking lower bound of venous pressure range bar") + test.compare(venous_rangeBar.upperBound, target_venous_max_limit, "Checking upper bound of venous pressure range bar") + + #check the marker value for the venous pressure + venous_rangeBar_marker_text_object = utility.get_object_from_names(names.o_treatmentHome_pressure_venous_marker_text, error_message="venous pressure marker label object is missing") + if venous_rangeBar_marker_text_object is not None: + test.compare(venous_rangeBar_marker_text_object.text, str(target_venous_pressure), "Expecting venous pressure to be displayed") + # base on the data set, check the color of the marker text + if is_venous_pressure_value_in_range is not True: + test.compare(venous_rangeBar_marker_text_object.color.name, config.OUT_OF_RANGE_COLOR, "Expecting color to be " + config.OUT_OF_RANGE_COLOR) + else: + test.compare(venous_rangeBar_marker_text_object.color.name, config.TREATMENT_PRESSURE_IN_RANGE_COLOR, "Expecting color to be " + config.TREATMENT_PRESSURE_IN_RANGE_COLOR) + + utils.waitForGUI(1) + test.endSection() + def main(): utils.tstStart(__file__) - startApplication(AUT_NAME) + application_init.setup_post_log_successful_start() + startApplication(config.AUT_NAME_ONLY +" -q") # need to have acknowledging enabled + hd_simulator.cmd_send_power_on_self_test_version_request() hd_simulator.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, dialysis_state=0) - verify_the_constants() - - # set_arterial_low_and_high_limits_using_slider() - # set_venous_low_and_high_limits_using_slider() - - set_arterial_pressure_and_verify_the_color() - set_venous_pressure_and_verify_the_color() + # Pressure dialog related + # verify_the_constants() + # test_adjust_pressure_limit_slider_and_logs_entry() + # test_adjust_pressure_limit_dialog_closes() - verify_pressures_on_treatment_and_pop_up_screen(accepted=ACCEPTED, reason=0, - art_low=ART_LOW_VAL_MINUS_120, art_high=ART_HIGH_VAL_160, - ven_low=VENOUS_LOW_VAL_MINUS_310, ven_high=VENOUS_HIGH_VAL_170) - - verify_adjusted_pressures_on_treatment_and_pop_up_screen(accepted=ACCEPTED, reason=0, - art_low=ART_LOW_VAL_MINUS_120, art_high=ART_HIGH_VAL_160, - ven_low=VENOUS_LOW_VAL_MINUS_310, ven_high=VENOUS_HIGH_VAL_170) - -# verify_pressures_on_treatment_and_pop_up_screen(accepted=REJECTED, reason=39, -# art_low=ART_LOW_VAL_MINUS_200, art_high=ART_HIGH_VAL_70, -# ven_low=VENOUS_LOW_VAL_MINUS_200, ven_high=VENOUS_HIGH_VAL_150) -# -# verify_adjusted_pressures_on_treatment_and_pop_up_screen(accepted=REJECTED, reason=39, -# art_low=ART_LOW_VAL_MINUS_200, art_high=ART_HIGH_VAL_70, -# ven_low=VENOUS_LOW_VAL_MINUS_200, ven_high=VENOUS_HIGH_VAL_150) - - verify_pressures_on_treatment_and_pop_up_screen(accepted=ACCEPTED, reason=0, - art_low=ART_LOW_VAL_MINUS_80, art_high=ART_HIGH_VAL_175, - ven_low=VENOUS_LOW_VAL_110, ven_high=VENOUS_HIGH_VAL_250) + # Pressure values shown on the treatment screen + test_pressure_displayed_in_treatment_screen_range_bar() - verify_pressures_on_treatment_and_pop_up_screen(accepted=ACCEPTED, reason=0, - art_low=ART_LOW_VAL_MINUS_80, art_high=ART_HIGH_VAL_175, - ven_low=VENOUS_LOW_VAL_110, ven_high=VENOUS_HIGH_VAL_250) - -# verify_pressures_on_treatment_and_pop_up_screen(accepted=REJECTED, reason=21, -# art_low=ART_LOW_VAL_MINUS_30, art_high=ART_HIGH_VAL_100, -# ven_low=VENOUS_LOW_VAL_MINUS_390, ven_high=VENOUS_HIGH_VAL_300) -# -# verify_pressures_on_treatment_and_pop_up_screen(accepted=REJECTED, reason=21, -# art_low=ART_LOW_VAL_MINUS_30, art_high=ART_HIGH_VAL_100, -# ven_low=VENOUS_LOW_VAL_MINUS_390, ven_high=VENOUS_HIGH_VAL_300) - utils.tstDone()