Index: shared/scripts/configuration/config.py =================================================================== diff -u -r9b2b6f2f03d8988f9999d65945a60773cbaa22e9 -rc6274593f3f5a607595b95f0243313a6cf32d599 --- shared/scripts/configuration/config.py (.../config.py) (revision 9b2b6f2f03d8988f9999d65945a60773cbaa22e9) +++ shared/scripts/configuration/config.py (.../config.py) (revision c6274593f3f5a607595b95f0243313a6cf32d599) @@ -8,7 +8,7 @@ # # @file utils.py # -# @author (last) Joseph varghese +# @author (last) LTTS # @date (last) 18-Jan-2022 # ############################################################################ @@ -25,3 +25,8 @@ "Magenta":"#fd28fd", "Orange": "#f2721c", "Peach":"#f1979a", "Red": "#c53b33", "Rose":"#fc178d", "Slate blue":"#7f7ffa", "Violet": "#6435c9", "White": "#ffffff", "Yellow": "#fcfc4d"} +CREATE_TREATMENT_PARAMETERS = ["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 Flow Rate"] + + Index: shared/scripts/configuration/utility.py =================================================================== diff -u -ra4e22083e34eee528f48cf21991d135e0ebf0a58 -rc6274593f3f5a607595b95f0243313a6cf32d599 --- shared/scripts/configuration/utility.py (.../utility.py) (revision a4e22083e34eee528f48cf21991d135e0ebf0a58) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision c6274593f3f5a607595b95f0243313a6cf32d599) @@ -7,7 +7,7 @@ # # @file utils.py # -# @author (last) Joseph varghese +# @author (last) LTTS # @date (last) 15-Jan-2022 # ############################################################################ @@ -22,6 +22,7 @@ from builtins import int as pyInt from builtins import str as pyStr from builtins import float as pyFloat +from unicodedata import bidirectional def start_application(app_name): @@ -60,28 +61,14 @@ except: logErrorDetails("Failed to start the application") sys.exit(1) + - -def color_verification(exp_val = "Red", act_val = "#c53b33"): - """ - Function to verify item color verification - Argument: - exp_val - Expected required value - act_val - Color displayed on UI - Return: - handle the application for log - """ - test.compare(config.COLOR_CODES[color_name],(act_val.color[name])) - - def check_if_object_is_within_the_container(obj=None, container=None): """ check if an object is inside a container - Arguments: - obj - child UI object - container - container UI object - Return: - bool + @param obj - child UI object + @param container - container UI object + @return boolean """ container = squish.findObject(container) containerPos = container.mapToGlobal(squish.QPoint(0, 0)) @@ -99,14 +86,13 @@ return False -def scroll_to_zone(zone=None, screen_object=None): + +def scroll_to_zone(zone=None, screen_object=None, direction = None): """ - scroll to the numeric if object is hidden - Arguments: - zone - UI object - screen_object - UI object (UI Home screen) - Return: - bool + scroll to the UI, if object is hidden + @param zone - object to be find out. + @param screen_object - object of the screen. + @return boolean """ counter = 0 while counter <= 100: @@ -119,42 +105,107 @@ else: raise RuntimeError except RuntimeError: - ScreenObj = squish.waitForObject(screen_object) + ScreenObj = squish.findObject(screen_object) screenHeight = pyInt(ScreenObj.height) screenWidth = pyInt(ScreenObj.width) - squish.mouseWheel(ScreenObj, (screenWidth-100), + if direction is None: + squish.mouseWheel(ScreenObj, (screenWidth-100), 107, 0, -(screenHeight-460), squish.Qt.NoModifier) - + else: + squish.mouseWheel(ScreenObj, (screenWidth-100), + -(screenHeight-700), 0, 200, squish.Qt.NoModifier) + raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") -def set_slider_value(slider_value, slider_object): +def set_slider_value(slider_value= None, slider_object= None, bidirectional= False, + slider_range = None): """ Method to drag slider to desired value - Argument: - slider_value : value in which slider should be placed - slider_object : object of the slider - Return: - True - if user able to select slider. else, false + @param slider_value : value in which slider should be placed + @param slider_object : object of the slider + @param bidirectional : True, if slider have 2 handler + @return boolean (True - if user able to select slider. else, false) """ slider_value = pyFloat(slider_value) actual_value = slider_value + if slider_range == "Max": + x_value = 600 + else: + x_value = 0 counter = 0 while True: - squish.mouseDrag(slider_object, 0, 0, slider_value, 0, squish.Qt.NoModifier, + if slider_value < 0: + slider_value = -1 * slider_value + squish.mouseDrag(slider_object, x_value, 0, slider_value, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - if counter == 25: + if counter == 50: + test.fail("User unable to fix slider value") + return False + if bidirectional is True: + if slider_range == "Low": + if actual_value == pyFloat(slider_object.minValue): + return True + if slider_value >= pyFloat(slider_object.minValue): + slider_value = slider_value - 30 + if slider_value <= pyFloat(slider_object.minValue): + slider_value = slider_value + 30 + if slider_range == "Max": + if actual_value == pyFloat(slider_object.maxValue): + return True + if slider_value >= pyFloat(slider_object.maxValue): + slider_value = slider_value + 30 + if slider_value <= pyFloat(slider_object.maxValue): + slider_value = slider_value - 30 + else: + if actual_value == pyFloat(slider_object.value): + return True + if slider_value >= pyFloat(slider_object.value): + slider_value = slider_value + 30 + if slider_value <= pyFloat(slider_object.value): + slider_value = slider_value - 30 + counter = counter + 1 + + +def slider_movement_for_negative_values(slider_value= None, slider_object= None, bidirectional= False, + slider_range = None): + """ + Method to drag slider for negative values value + @param slider_value : value in which slider should be placed + @param slider_object : object of the slider + @param bidirectional : True, if slider have 2 handler + @return boolean (True - if user able to select slider. else, false) + """ + slider_value = pyFloat(slider_value) + actual_value = slider_value + if slider_range == "Max": + x_value = 600 + else: + x_value = 0 + counter = 0 + while True: + squish.mouseDrag(slider_object, x_value, 0, slider_value, 0, squish.Qt.NoModifier, + squish.Qt.LeftButton) + if counter == 50: test.fail("User unable to fix slider slider_value") return False - if actual_value == pyFloat(slider_object.value): - return True - if slider_value >= pyFloat(slider_object.value): - slider_value = slider_value + 30 - if slider_value <= pyFloat(slider_object.value): - slider_value = slider_value - 30 + if bidirectional is True: + if slider_range == "Low": + if actual_value == pyFloat(slider_object.minValue): + return True + if slider_value >= pyFloat(slider_object.minValue): + slider_value = slider_value + 30 + if slider_value <= pyFloat(slider_object.minValue): + slider_value = slider_value - 30 + if slider_range == "Max": + if actual_value == pyFloat(slider_object.maxValue): + return True + if slider_value >= pyFloat(slider_object.maxValue): + slider_value = slider_value + 30 + if slider_value <= pyFloat(slider_object.maxValue): + slider_value = slider_value - 30 counter = counter + 1 - - - + + Index: shared/scripts/names.py =================================================================== diff -u -rdc6c3c4de69df27ed25c64b98f7ac05fad64bb97 -rc6274593f3f5a607595b95f0243313a6cf32d599 --- shared/scripts/names.py (.../names.py) (revision dc6c3c4de69df27ed25c64b98f7ac05fad64bb97) +++ shared/scripts/names.py (.../names.py) (revision c6274593f3f5a607595b95f0243313a6cf32d599) @@ -3,6 +3,15 @@ from objectmaphelper import * + +def prescription_measurement_title(text): + prescription_mesurement["text"] = text + return prescription_mesurement + +def operating_parameters_measurement_title(text): + operating_measurement["text"] = text + return operating_measurement + o_Gui_MainView = {"type": "Gui::MainView", "unnamed": 1, "visible": True} o_Overlay = {"container": o_Gui_MainView, "type": "Overlay", "unnamed": 1, "visible": True} o_borderRect_Rectangle = {"container": o_Overlay, "gradient": 0, "id": "_borderRect", "type": "Rectangle", "unnamed": 1, "visible": True} @@ -19,9 +28,6 @@ o_PreTreatmentCreate_bloodFlowRateSlider_Slider = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "gradient": 0, "objectName": "_bloodFlowRateSlider", "type": "Slider", "visible": True} o_PreTreatmentCreate_dialysateFlowRate_SliderCreateTreatment = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "gradient": 0, "objectName": "_dialysateFlowRate", "type": "SliderCreateTreatment", "visible": True} o_PreTreatementCreateStack_PreTreatmentBase_TreatmentFlowBase = {"container":o_PreTreatmentCreateStack_PreTreatmentBase_TreatmentFlowBase,"objectName":"_PreTreatmentBase","type":"TreatmentFlowBase", "visible": True} -back_b = {"container": o_PreTreatementCreateStack_PreTreatmentBase_TreatmentFlowBase, "gradient": 0, "objectName": "_backButton", "type": "BackButton", "visible": True} - -conform_c={"container": o_Gui_MainView, "gradient": 0, "objectName": "_confirmButton", "type": "TouchRect", "visible": False} o_confirmButton_TouchRect = {"container": o_Gui_MainView, "gradient": 0, "objectName": "_confirmButton", "type": "TouchRect", "visible": False} o_backButton_BackButton = {"container": o_Gui_MainView, "gradient": 0, "objectName": "_backButton", "type": "BackButton", "visible": False} o_NinePatchImage = {"container": o_Gui_MainView, "occurrence": 6, "type": "NinePatchImage", "unnamed": 1, "visible": False} @@ -56,6 +62,7 @@ fluid_text = {"container": treatmentStack_treatmentHome_TreatmentHome, "text": "Volume Delivered", "type": "Text", "unnamed": 1, "visible": True} cumulative_fluid_text = {"container": treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} + #authentication confirm_button = {"container": o_PreTreatmentCreateStack_PreTreatmentBase_TreatmentFlowBase, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} back_button ={"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_image", "source": "qrc:/images/iBack", "type": "Image", "unnamed": 1, "visible": True} @@ -70,7 +77,16 @@ o_PreTreatmentCreate_heparinDispensingRate_SliderCreateTreatment = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "gradient": 0, "objectName": "_heparinDispensingRate", "type": "SliderCreateTreatment", "visible": True} o_PreTreatmentBase_backgroundRect_Rectangle_2 = {"container": o_PreTreatmentCreateStack_PreTreatmentBase_TreatmentFlowBase, "gradient": 0, "id": "_backgroundRect", "type": "Rectangle", "unnamed": 1, "visible": True} create_treatment_screen = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "objectName": "TreatmentCreateFlickable", "type": "Flickable", "visible": True} +o_PreTreatmentCreateStack_PreTreatmentConfirm_TreatmentFlowBase = {"container": o_PreTreatmentCreateStack_PreTreatmentCreateStack, "objectName": "_PreTreatmentConfirm", "type": "TreatmentFlowBase", "visible": True} +confirm_title_text = {"container": o_PreTreatmentCreateStack_PreTreatmentConfirm_TreatmentFlowBase, "text": "Confirm Treatment", "type": "Text", "unnamed": 1, "visible": True} +prescription_title_text = {"container": o_PreTreatmentCreateStack_PreTreatmentConfirm_TreatmentFlowBase, "objectName": "ConfirmTreatmentTable_prescription", "type": "Text", "visible": True} +operating_parameters_title_text = {"container": o_PreTreatmentCreateStack_PreTreatmentConfirm_TreatmentFlowBase, "objectName": "ConfirmTreatmentTable_operating_parameters", "type": "Text", "visible": True} +prescription_mesurement = {"container": o_PreTreatmentCreateStack_PreTreatmentConfirm_TreatmentFlowBase, "type": "Text", "visible": True} +operating_measurement = {"container": o_PreTreatmentCreateStack_PreTreatmentConfirm_TreatmentFlowBase, "type": "Text", "visible": True} +treatment_confirm_flickable = {"container": o_PreTreatmentCreateStack_PreTreatmentConfirm_TreatmentFlowBase, "objectName": "_PreTreatmentConfirmFlickable", "type": "Flickable", "visible": True} +back_button_confirm_treatment = {"container": o_Gui_MainView, "type": "Text", "unnamed": 1, "visible": True} + Index: shared/searchImages/Rinseback_flow_rate.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/aterial_pressure_high_limit.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/aterial_pressure_low_limit.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/blood.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/blood_pressure_measurement_interval.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/dialysate.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/dialysate_temperature.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/duration.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/heparin_bolus_volume.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/heparin_dispensing_rate.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/heparin_stop_time.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/saline_bolus.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/venous_pressure_high_limits.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: shared/searchImages/venous_pressure_low_limits.png =================================================================== diff -u -r8fe36cf3dde9429e91c1497af8bf7eac2a9a10e6 -rc6274593f3f5a607595b95f0243313a6cf32d599 Binary files differ Index: suite.conf =================================================================== diff -u -rdc6c3c4de69df27ed25c64b98f7ac05fad64bb97 -rc6274593f3f5a607595b95f0243313a6cf32d599 --- suite.conf (.../suite.conf) (revision dc6c3c4de69df27ed25c64b98f7ac05fad64bb97) +++ suite.conf (.../suite.conf) (revision c6274593f3f5a607595b95f0243313a6cf32d599) @@ -1,7 +1,7 @@ AUT=denaliSquish CWD= ENVVARS=envvars -HOOK_SUB_PROCESSES=false +HOOK_SUB_PROCESSES=true IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAPSTYLE=script Fisheye: Tag c6274593f3f5a607595b95f0243313a6cf32d599 refers to a dead (removed) revision in file `tst_case1/test.py'. Fisheye: No comparison available. Pass `N' to diff? Index: tst_create_custom_treatment/test.py =================================================================== diff -u -ra4e22083e34eee528f48cf21991d135e0ebf0a58 -rc6274593f3f5a607595b95f0243313a6cf32d599 --- tst_create_custom_treatment/test.py (.../test.py) (revision a4e22083e34eee528f48cf21991d135e0ebf0a58) +++ tst_create_custom_treatment/test.py (.../test.py) (revision c6274593f3f5a607595b95f0243313a6cf32d599) @@ -15,13 +15,15 @@ # NOTE: # This test is intended to be used to verify custom treatment in application . + import names import test -from dialin.ui import utils +from dialin.ui import utils, hd_simulator from dialin.ui import unittests from builtins import str as pyStr from configuration import utility +from configuration import config from configuration import assertion_helper from dialin.common.msg_defs import RequestRejectReasons from dialin.ui.hd_simulator import HDSimulator @@ -33,27 +35,40 @@ ACID_CONCENTRATE = ["Fres. Naturalyte", "08-1251-1", "08-2251-0", "08-3251-9"] BICARBONATE_CONCENTRATE = "Fres. Centrisol" DIALYZER_TYPE = ["BB Diacap Pro 13H", "BB Diacap Pro 16H", "BB Diacap Pro 19H", "F Optiflux F160NRe", "F Optiflux F180NRe"] +CONFIRM_TREATMENT_TITLE = "Confirm Treatment" +PRESCRIPTION_TITLE = "PRESCRIPTION" +OPERATING_PARAMETERS_TITLE = "OPERATING PARAMETERS" CREATE_TREATMENT_SLIDER_VALUES = { - "bloodFlowRate": [200, 300, 400, 150, 250], - "dialysateFlowRate": [150, 250, 300, 450, 500], - "duration": [120, 150, 240, 300, 450], - "heparinDispensingRate": [0.2, 0.3, 0.6, 0.8, 0.5], - "heparinBolusVolume": [0.2, 0.5, 0.8, 1.0, 1.6], - "heparinStopTime": [20, 60, 270, 320, 420, 440], - "salineBolus": [200], - "dialysateTemperature": [35.5, 36.0, 36.5, 37.0, 37.5], - "bloodPressureMeasurementInterval": [5, 15, 20, 30, 45, 55], - "rinsebackFlowRate": [75, 100, 125], - -} + "Blood Flow Rate": [200, 300, 400], + "Dialysate Flow Rate": [150, 250, 300], + "Duration": [120, 150, 240], + "Heparin Dispensing Rate": [0.2, 0.3, 0.6], + "Heparin Bolus Volume": [0.2, 0.5, 0.8], + "Heparin Stop Time": [20, 60, 270], + "Saline Bolus Volume": [200], + "Dialysate Temperature": [35.5, 36.0, 36.5], + "Venous Pressure Limit High": [550, 510, 500], + "Venous Pressure Limit Low": [120, 140, 110], + "Arterial Pressure Limit High": [-30, -40, -50], + "Arterial Pressure Limit Low": [-280, -260, -290] , + "Blood Pressure Measure Interval": [5, 15, 20], + "Rinseback Rate": [75, 100, 125], + } +PRESCRIPTION_DETAILS = {"Blood Flow Rate": "mL/min", "Dialysate Flow Rate": "mL/min", + "Duration": "min", "Heparin Dispensing Rate": "mL/hr", + "Heparin Bolus Volume": "mL", "Heparin Stop Time": "min", + "Saline Bolus Volume": "mL", + "Dialysate Temperature": "°C", "Arterial Pressure Limit Low": "mmHg", + "Arterial Pressure Limit High": "mmHg","Blood Pressure Measure Interval":"min", + "Rinseback Rate" : "min", "Venous Pressure Limit High": "mmHg", + "Venous Pressure Limit Low": "mmHg" + } -def treatment_create_flickable(x_axis =0, y_axis = 0): - - mouseWheel(waitForObject(names.treatment_create_flickable), - 1184, 107, x_axis, y_axis, Qt.NoModifier) +OPERATIONAL_PARAMETERS = {"Heparin Type": "UFH 1,000 IU/mL", "Acid Concentrate": ACID_CONCENTRATE, + "Bicarbonate Concentrate": "Fres. Centrisol", "Dialyzer Type": DIALYZER_TYPE} def set_parameter_type(text): @@ -62,43 +77,31 @@ return names.operating_parameters else: test.log(f"Invalid \"text\": {text} for object.") - names.keyboard_input["text"] = "UFH 1,000 IU/mL" + names.operating_parameters["text"] = None - - slider_object = waitForObject(names.demo) - 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) - - - - - - + def set_operating_parameters(heparin_type, acid_concentrate, bicarbonate_concentrate, dialyzer_type): """ Tests that all possible non-slider options are shown. - + @Param : operating parameters value @return: None """ heparin_parameter_object = set_parameter_type(text = heparin_type) utility.scroll_to_zone(heparin_parameter_object, names.treatment_create_flickable) tapObject(waitForObject(heparin_parameter_object)) + object_on_zone = set_parameter_type(text = ACID_CONCENTRATE[3]) + utility.scroll_to_zone(object_on_zone, names.treatment_create_flickable) acid_concentrate_box_obj = set_parameter_type(text = acid_concentrate) - utility.scroll_to_zone(acid_concentrate_box_obj, names.treatment_create_flickable) tapObject(waitForObject(acid_concentrate_box_obj)) bicarbonate_concentrate_box_obj = set_parameter_type(text = bicarbonate_concentrate) utility.scroll_to_zone(bicarbonate_concentrate_box_obj, names.treatment_create_flickable) tapObject(waitForObject(bicarbonate_concentrate_box_obj)) - dialyzer_type_box_obj = set_dialyzer_type(text = dialyzer_type) - utility.scroll_to_zone(dialyzer_type_box_obj, names.treatment_create_flickable) + object_on_zone = set_parameter_type(text = DIALYZER_TYPE[3]) + utility.scroll_to_zone(object_on_zone, names.treatment_create_flickable) + dialyzer_type_box_obj = set_parameter_type(text = dialyzer_type) tapObject(waitForObject(dialyzer_type_box_obj)) @@ -107,30 +110,64 @@ reject_reasons = [ RequestRejectReasons.REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE ] * hd_simulator.NUM_TREATMENT_PARAMETERS - treatment_status = hd_simulator.cmd_send_treatment_parameter_validation_response(reject_reasons) - test.compare(True, treatment_status) - test.log("custom treatment should be rejected") + squish_assert.is_true(treatment_status, "custom treatment should be rejected") + +def verify_request_continue_mode(hd_simulator): -def set_slider_value_for_parameter(index_value, item_text, slider_value, slider_obj): + treatment_status = hd_simulator.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 ]) + squish_assert.is_true(treatment_status, "custom treatment should be accepted") + + +def verify_custom_treatment_record_rejected(): + test.startSection("Verifying custom treatment record, if confirmation rejected") + for expected_treatment_title in config.CREATE_TREATMENT_PARAMETERS: + expected_color = config.COLOR_CODES.get("Red") + + parameter_object = set_parameter_type(text = expected_treatment_title) + utility.scroll_to_zone(parameter_object, names.treatment_create_flickable) + + parameter_text = waitForObject(parameter_object) + parameter_text_color = parameter_text.color + squish_assert.are_equal(expected_color, parameter_text_color, message = "parameter color should be "\ + f"red for {expected_treatment_title}, if the confirmation get rejected !") + + test.endSection() + + +def set_slider_value_for_parameter(index_value = None, item_text = None, slider_value = None, + slider_obj = None, bislider = False, slider_range = None): + parameter = object.children(slider_obj)[index_value] - slider_object = object.children(parameter)[2] - slider_status = utility.set_slider_value(slider_value, slider_object) + if bislider is True: + slider_object = object.children(parameter)[1] + else: + slider_object = object.children(parameter)[2] + slider_status = utility.set_slider_value(slider_value, slider_object, bislider, slider_range) squish_assert.is_true(condition = slider_status, message = f"{item_text} should set to value -> {slider_value}") def create_custom_treatment_record( blood_flow_rate, dialysate_flow_rate, - duration, heparin_dispensing_rate, + Duration, heparin_dispensing_rate, heparin_bolus_volume, heparin_stop_time, saline_bolus, dialysate_temperature, blood_pressure_measurement_interval, - rinseback_flowrate, + rinseback_flowrate, venous_pressure_low_limits, + venous_pressure_high_limits, arterial_pressure_low_limit, + arterial_pressure_high_limit, index ): + """ + Method to set custom treatment slider values for parameters. + @Param : parameters value + @return: None + """ + slider_object = waitForObject(names.create_treatment_screen) child = object.children(slider_object)[0] parameter_child = object.children(child)[0] @@ -141,8 +178,8 @@ 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) + 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.treatment_create_flickable) @@ -164,62 +201,109 @@ slider_value = saline_bolus, slider_obj = parameter_child) set_operating_parameters(heparin_type = HEPARIN_TYPE, - acid_concentrate = ACID_CONCENTRATE[0], + acid_concentrate = ACID_CONCENTRATE[index], bicarbonate_concentrate = BICARBONATE_CONCENTRATE, - dialyzer_type = DIALYZER_TYPE[0]) + dialyzer_type = DIALYZER_TYPE[index]) parameter_object = set_parameter_type(text = "Venous Pressure Limits (mmHg)") utility.scroll_to_zone(parameter_object, names.treatment_create_flickable) - set_slider_value_for_parameter(index_value = 8, item_text = "dialysate temperature", + set_slider_value_for_parameter(index_value = 13, item_text = "dialysate temperature", slider_value = dialysate_temperature, slider_obj = parameter_child) - + parameter_object = set_parameter_type(text = "Rinseback Flow Rate") utility.scroll_to_zone(parameter_object, names.treatment_create_flickable) - 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) + set_slider_value_for_parameter(index_value = 14, item_text = " arterial pressure low limits (mmHg)", + slider_value = arterial_pressure_low_limit, slider_obj = parameter_child, bislider = True, slider_range = "Low") + set_slider_value_for_parameter(index_value = 14, item_text = "arterial pressure high limits (mmHg)", + slider_value = arterial_pressure_high_limit, slider_obj = parameter_child, bislider = True, slider_range = "Max") - """ + set_slider_value_for_parameter(index_value = 15, item_text = "venous_pressure_low_limits", + slider_value = venous_pressure_low_limits, slider_obj = parameter_child, bislider = True, slider_range = "Low") + set_slider_value_for_parameter(index_value = 15, item_text = "venous pressure high limits (mmHg)", + slider_value = venous_pressure_high_limits, slider_obj = parameter_child, bislider = True, slider_range = "Max") + + set_slider_value_for_parameter(index_value = 16, item_text = "blood pressure measurement interval", + slider_value = blood_pressure_measurement_interval, slider_obj = parameter_child) + set_slider_value_for_parameter(index_value = 17, item_text = "rinseback_flowrate", + slider_value = rinseback_flowrate, slider_obj = parameter_child) - +def verify_the_confirm_treatment_screen_is_displayed() -> None: + + test.log("Verifying the 'Confirm Treatment' is displayed and its title text") + confirm_treatment_title = waitForObject(names.confirm_title_text) + squish_assert.are_equal(expected_value=CONFIRM_TREATMENT_TITLE, + actual_value=confirm_treatment_title.text.toUtf8().constData(), + message=f"{CONFIRM_TREATMENT_TITLE} screen is displayed " + + f"and title should be {CONFIRM_TREATMENT_TITLE}") + +def verify_prescriptional_details_from_confirm_treatment_screen(index): + test.startSection("Verifying prescription values from confirm treatment section") + verify_the_confirm_treatment_screen_is_displayed() - custom_treatment = waitForObject(names.custom_treatment) - test.compare("Create a Custom Treatment", custom_treatment.text) - test.log(f"user successfully authenticated.") + prescription_title = waitForObject(names.prescription_title_text) + squish_assert.are_equal(expected_value=PRESCRIPTION_TITLE, + actual_value=prescription_title.text.toUtf8().constData(), + message=f"{PRESCRIPTION_TITLE} title " + + f"should be {PRESCRIPTION_TITLE}") + option = index + for expected_prescription_title, measurement in PRESCRIPTION_DETAILS.items(): + if expected_prescription_title == "Saline Bolus Volume": + option = 0 + parameter_object = names.prescription_measurement_title(text = expected_prescription_title) + utility.scroll_to_zone(parameter_object, names.treatment_confirm_flickable) + + prescription_title = waitForObject(names.prescription_measurement_title(\ + text=expected_prescription_title)) + actual_measurement = object.parent(prescription_title) + actual_measurement = object.children(actual_measurement)[-1] + squish_assert.are_equal(expected_value=expected_prescription_title, + actual_value=prescription_title.text.toUtf8().constData(), + message=f"{expected_prescription_title} title should be " + + f"{expected_prescription_title}") + unit = CREATE_TREATMENT_SLIDER_VALUES[expected_prescription_title][option] + squish_assert.are_equal(expected_value=f"{unit} {measurement}", + actual_value=actual_measurement.text.toUtf8().constData(), + message=f"{expected_prescription_title} corresponding "+ + f"measured value should be {unit} {measurement}") + option = index + test.endSection() - mouseClick(waitForImage("blood",{ "tolerant": True, "threshold": 99.999 })) - mouseClick(waitForImage("dialysate",{ "tolerant": True, "threshold": 99.999 })) - mouseClick(waitForImage("duration",{ "tolerant": True, "threshold": 99.999 })) - treatment_create_flickable(y_axis = -100) - mouseClick(waitForImage("heparin_dispensing_rate",{ "tolerant": True, "threshold": 99.999 })) - mouseClick(waitForImage("heparin_bolus_volume",{ "tolerant": True, "threshold": 99.999 })) - mouseClick(waitForImage("heparin_stop_time",{ "tolerant": True, "threshold": 99.999 })) - treatment_create_flickable(y_axis = -65) - mouseClick(waitForImage("saline_bolus",{ "tolerant": True, "threshold": 99.999 })) - +def verify_operational_details_from_confirm_treatment_screen(index): + + test.startSection("Verifying operational values from confirm treatment screen") + verify_the_confirm_treatment_screen_is_displayed() - treatment_create_flickable(y_axis = -65) - mouseClick(waitForImage("dialysate_temperature",{ "tolerant": True, "threshold": 99.999 })) - mouseClick(waitForImage("aterial_pressure_low_limit",{ "tolerant": True, "threshold": 99.999 })) - mouseClick(waitForImage("aterial_pressure_high_limit",{ "tolerant": True, "threshold": 99.999 })) - treatment_create_flickable(y_axis = -150) - mouseClick(waitForImage("venous_pressure_low_limits",{ "tolerant": True, "threshold": 99.999 })) - mouseClick(waitForImage("venous_pressure_high_limits",{ "tolerant": True, "threshold": 99.999 })) - 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") - """ + parameter_object = names.prescription_measurement_title(text = "Blood Flow Rate") + utility.scroll_to_zone(parameter_object, names.treatment_confirm_flickable) + + for expected_operational_title, measurement in OPERATIONAL_PARAMETERS.items(): + operational_title = waitForObject(names.operating_parameters_measurement_title(\ + text=expected_operational_title)) + actual_measurement = object.parent(operational_title) + actual_measurement = object.children(actual_measurement)[-1] + squish_assert.are_equal(expected_value=expected_operational_title, + actual_value=operational_title.text.toUtf8().constData(), + message=f"{expected_operational_title} title should be " + + f"{expected_operational_title}") + if expected_operational_title == "Acid Concentrate" or expected_operational_title == "Dialyzer Type": + measurement = measurement[index] + squish_assert.are_equal(expected_value=measurement, + actual_value=actual_measurement.text.toUtf8().constData(), + message=f"{expected_operational_title} corresponding "+ + f"measured value should be {measurement}") + test.endSection() + + def main(): utils.tstStart("tst_create_custom_treatment") @@ -234,77 +318,92 @@ type(waitForObject(names.input_patient_id), PATIENT_ID) tapObject(waitForObject(names.confirm_button)) + #set custom values for parameters create_custom_treatment_record( - 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], - 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], + blood_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Blood Flow Rate"][0], + dialysate_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Flow Rate"][0], + Duration = CREATE_TREATMENT_SLIDER_VALUES["Duration"][0], + heparin_dispensing_rate = CREATE_TREATMENT_SLIDER_VALUES["Heparin Dispensing Rate"][0], + heparin_bolus_volume = CREATE_TREATMENT_SLIDER_VALUES["Heparin Bolus Volume"][0], + heparin_stop_time = CREATE_TREATMENT_SLIDER_VALUES["Heparin Stop Time"][0], + saline_bolus = CREATE_TREATMENT_SLIDER_VALUES["Saline Bolus Volume"][0], + dialysate_temperature = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Temperature"][0], + venous_pressure_low_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit Low"][0], + venous_pressure_high_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit High"][0], + arterial_pressure_low_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit Low"][0], + arterial_pressure_high_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit High"][0], + blood_pressure_measurement_interval = CREATE_TREATMENT_SLIDER_VALUES["Blood Pressure Measure Interval"][0], + rinseback_flowrate = CREATE_TREATMENT_SLIDER_VALUES["Rinseback Rate"][0], + index = 0 ) - #verify_custom_treatment_record() - """ + + verify_request_continue_mode(hd) + + #verification of records from confirm treatment screen + verify_operational_details_from_confirm_treatment_screen(index = 0) + verify_prescriptional_details_from_confirm_treatment_screen(index = 0) + + tapObject(waitForObject(names.back_button_confirm_treatment)) + + parameter_object = set_parameter_type(text = config.CREATE_TREATMENT_PARAMETERS[0]) + utility.scroll_to_zone(parameter_object, names.treatment_create_flickable, direction="Top") + + #set custom values for parameters create_custom_treatment_record( - bloodFlowRate = CREATE_TREATMENT_SLIDER_VALUES["bloodFlowRate"][1], - dialysateFlowRate = CREATE_TREATMENT_SLIDER_VALUES["dialysateFlowRate"][1], - duration = CREATE_TREATMENT_SLIDER_VALUES["duration"][1], - heparinDispensingRate = CREATE_TREATMENT_SLIDER_VALUES["heparinDispensingRate"][1], - heparinBolusVolume = CREATE_TREATMENT_SLIDER_VALUES["heparinBolusVolume"][1], - heparinStopTime = CREATE_TREATMENT_SLIDER_VALUES["heparinStopTime"][1], - salineBolus = CREATE_TREATMENT_SLIDER_VALUES["salineBolus"][1], - dialysateTemperature = CREATE_TREATMENT_SLIDER_VALUES["dialysateTemperature"][1], - bloodPressureMeasurementInterval = CREATE_TREATMENT_SLIDER_VALUES["bloodPressureMeasurementInterval"][1], - rinsebackFlowRate = CREATE_TREATMENT_SLIDER_VALUES["rinsebackFlowRate"][1], + blood_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Blood Flow Rate"][1], + dialysate_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Flow Rate"][1], + Duration = CREATE_TREATMENT_SLIDER_VALUES["Duration"][1], + heparin_dispensing_rate = CREATE_TREATMENT_SLIDER_VALUES["Heparin Dispensing Rate"][1], + heparin_bolus_volume = CREATE_TREATMENT_SLIDER_VALUES["Heparin Bolus Volume"][1], + heparin_stop_time = CREATE_TREATMENT_SLIDER_VALUES["Heparin Stop Time"][1], + saline_bolus = CREATE_TREATMENT_SLIDER_VALUES["Saline Bolus Volume"][0], + dialysate_temperature = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Temperature"][1], + venous_pressure_low_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit Low"][1], + venous_pressure_high_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit High"][1], + arterial_pressure_low_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit Low"][1], + arterial_pressure_high_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit High"][1], + blood_pressure_measurement_interval = CREATE_TREATMENT_SLIDER_VALUES["Blood Pressure Measure Interval"][1], + rinseback_flowrate = CREATE_TREATMENT_SLIDER_VALUES["Rinseback Rate"][1], + index = 1 ) - + verify_request_rejection_mode(hd) + parameter_object = set_parameter_type(text = config.CREATE_TREATMENT_PARAMETERS[0]) + utility.scroll_to_zone(parameter_object, names.treatment_create_flickable, direction="Top") + + #verification of create treatment screen after request rejection + verify_custom_treatment_record_rejected() + + parameter_object = set_parameter_type(text = config.CREATE_TREATMENT_PARAMETERS[0]) + utility.scroll_to_zone(parameter_object, names.treatment_create_flickable, direction="Top") + + #set custom values for parameters create_custom_treatment_record( - bloodFlowRate = CREATE_TREATMENT_SLIDER_VALUES["bloodFlowRate"][2], - dialysateFlowRate = CREATE_TREATMENT_SLIDER_VALUES["dialysateFlowRate"][2], - duration = CREATE_TREATMENT_SLIDER_VALUES["duration"][2], - heparinDispensingRate = CREATE_TREATMENT_SLIDER_VALUES["heparinDispensingRate"][2], - heparinBolusVolume = CREATE_TREATMENT_SLIDER_VALUES["heparinBolusVolume"][2], - heparinStopTime = CREATE_TREATMENT_SLIDER_VALUES["heparinStopTime"][2], - salineBolus = CREATE_TREATMENT_SLIDER_VALUES["salineBolus"][2], - dialysateTemperature = CREATE_TREATMENT_SLIDER_VALUES["dialysateTemperature"][2], - bloodPressureMeasurementInterval = CREATE_TREATMENT_SLIDER_VALUES["bloodPressureMeasurementInterval"][2], - rinsebackFlowRate = CREATE_TREATMENT_SLIDER_VALUES["rinsebackFlowRate"][2], + blood_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Blood Flow Rate"][2], + dialysate_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Flow Rate"][2], + Duration = CREATE_TREATMENT_SLIDER_VALUES["Duration"][2], + heparin_dispensing_rate = CREATE_TREATMENT_SLIDER_VALUES["Heparin Dispensing Rate"][2], + heparin_bolus_volume = CREATE_TREATMENT_SLIDER_VALUES["Heparin Bolus Volume"][2], + heparin_stop_time = CREATE_TREATMENT_SLIDER_VALUES["Heparin Stop Time"][2], + saline_bolus = CREATE_TREATMENT_SLIDER_VALUES["Saline Bolus Volume"][0], + dialysate_temperature = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Temperature"][2], + venous_pressure_low_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit Low"][2], + venous_pressure_high_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit High"][2], + arterial_pressure_low_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit Low"][2], + arterial_pressure_high_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit High"][2], + blood_pressure_measurement_interval = CREATE_TREATMENT_SLIDER_VALUES["Blood Pressure Measure Interval"][2], + rinseback_flowrate = CREATE_TREATMENT_SLIDER_VALUES["Rinseback Rate"][2], + index = 2 ) - + verify_request_continue_mode(hd) + verify_operational_details_from_confirm_treatment_screen(index = 2) + verify_prescriptional_details_from_confirm_treatment_screen(index = 2) - - #verify_request_rejection_mode(hd) - #set_operating_parameters(heparin_type = HEPARIN_TYPE, - # acid_concentrate = ACID_CONCENTRATE[1], - # bicarbonate_concentrate = BICARBONATE_CONCENTRATE, - # dialyzer_type = DIALYZER_TYPE[1]) - treatment_create_flickable(y_axis = -65) - #hd.cmd_send_pre_treatment_patient_connection_confirm_response(accepted = 1, reason = 1) - #hd.cmd_send_pre_treatment_prime_start_response(accepted = 1, reason = 1) - #hd.cmd_send_pre_treatment_continue_to_treament_response( accepted=1, reason= 0) - 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 - ]) - hd.cmd_initiate_treatment_response(response= 1, reason=0) - time.sleep(2) - #hd.cmd_send_pre_treatment_patient_connection_confirm_response(accepted = 1, reason = 0) - #hd.simulator.cmd_send_treatment_parameter_validation_response(19) - #hd.cmd_initiate_treatment_response(response=1, reason=0) - #hd.cmd_send_treatment_parameter_validation_response(self, rejections: List[RequestRejectReasons]) + utils.waitForGUI(.5) - time.sleep(20) - - """ utils.tstDone()