Index: shared/scripts/configuration/config.py =================================================================== diff -u -ra2fa4b33cc71b0652e53491b8bb768c8fc64c943 -rae1bfa4af97263849cafb3d6964205cce4a10700 --- shared/scripts/configuration/config.py (.../config.py) (revision a2fa4b33cc71b0652e53491b8bb768c8fc64c943) +++ shared/scripts/configuration/config.py (.../config.py) (revision ae1bfa4af97263849cafb3d6964205cce4a10700) @@ -5,34 +5,35 @@ # # 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 utils.py -# -# @author (last) Joseph varghese -# @date (last) 18-Jan-2022 -# -############################################################################ +# @author (last) LTTS +# @date (last) 14-June-2022 +############################################################################# import os - from configuration.strings import * AUT_NAME = "denaliSquish" COMMON_PATH = os.environ['HOME']+"/Projects" - -COLOR_CODES = {"Aqua": "#81ffff", "Blue": "#017dea", "Blue 2": "#1090d5", "Green": "#29fd2d", "Grey": "#d3d3d3", - "Lavender": "#db98f5", "Light Blue": "#acd7f1", "Light Teal": "#29f1da","Lime": "#b7fc36", - "Magenta":"#fd28fd", "Orange": "#f2721c", "Peach":"#f1979a", "Red": "#c53b33", "Rose":"#fc178d", - "Slate blue":"#7f7ffa", "Violet": "#6435c9", "White": "#ffffff", "Yellow": "#fcfc4d"} +#instructions_imagelocation +INSTRUCTION_CONF_LOCATION = "/home/denali/Projects/application/resources/settings/Instructions/Instructions.conf" +IMAGE_LOCATION = "file:///home/denali/Projects/application/resources/settings/Instructions/" +EXPECTED_IMAGE_LOCATION = "/home/denali/Projects/application/resources/settings/Instructions/" +SERVICE_CONF_LOCATION = os.environ['HOME']+"/Projects/application/resources/settings/Service.conf" +TREATMENT_LOG_LOCATION = '/home/denali/Desktop/sd-card/treatment/*.log' -#standby mode -GOODMORNING_START_TIME_SEC = 0 -GOODEVENING_START_TIME_SEC = 43200 +ACCEPTED = True +REJECTED = False +ENABLED = True +DISABLED = False +CURRENT_COLOR = '#000000' +COMPLETE_COLOR = '#4290ec' +ENABLED_COLOR = '#fcfcfc' +INCOMPLETE_COLOR = '#607a91' +OUT_OF_RANGE_COLOR = "#c53b33" #main treatment screen -OUT_OF_RANGE_COLOR = "#c53b33" IN_RANGE_COLOR = "#fcfcfc" SYSTOLIC_LOWER_LIMIT = 60 SYSTOLIC_UPPER_LIMIT = 250 @@ -41,29 +42,23 @@ HEART_RATE_LOWER_LIMIT = 40 HEART_RATE_UPPER_LIMIT = 180 - KEYBOARD_SWITCH = ["ABC", "&123"] -#create custom treatment HEPARIN_TYPE = "UFH 1,000 IU/mL" 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"] + COLOR_CODES = {"Aqua": "#81ffff", "Blue": "#017dea", "Blue 2": "#1090d5", "Green": "#29fd2d", "Grey": "#d3d3d3", "Lavender": "#db98f5", "Light Blue": "#acd7f1", "Light Teal": "#29f1da","Lime": "#b7fc36", "Magenta":"#fd28fd", "Orange": "#f2721c", "Peach":"#f1979a", "Red": "#c53b33", "Rose":"#fc178d", "Slate blue":"#7f7ffa", "Violet": "#6435c9", "White": "#ffffff", "Yellow": "#fcfc4d"} - -CURRENT_COLOR = '#000000' -COMPLETE_COLOR= '#4290ec' -ENABLED_COLOR = '#fcfcfc' -INCOMPLETE_COLOR = '#607a91' + TREATMENT_UNHIGHLIGHTED_COLOR = "#000000" TREATMENT_HIGHLIGHTED_COLOR = "#135088" OPERATIONAL_PARAMETERS = {"Heparin Type": HEPARIN_TYPE, "Acid Concentrate": "Fres. Naturalyte", "Bicarbonate Concentrate": BICARBONATE_CONCENTRATE, "Dialyzer Type": "BB Diacap Pro 16H"} - #create custom treatment HIGHER_VALUE_OF_BLOOD_FLOW_RATE = 500 LOWER_VALUE_OF_BLOOD_FLOW_RATE = 100 @@ -80,6 +75,112 @@ POSITIVE_BUFFER = 10 NEGATIVE_BUFFER = -10 +#Alarm List +NUM_OF_ALARM_PRIORITIES = 4 # Total number of alarm priorities +NUM_OF_REQUEST_REJECT_REASONS = 43 +NUM_OF_MSG_ID = 289 + +ALARM_ID_NO_ALARM = 0 +ALARM_ID_OUT_OF_RANGE = 290 + +# alarm colors +ALARMS_COLORS_HEADER = { + "ALARM_PRIORITY_NONE" : "#438feb", + "ALARM_PRIORITY_LOW" : "#db8f00", + "ALARM_PRIORITY_MEDIUM" : "#db8f00", + "ALARM_PRIORITY_HIGH" : "#831913" +} + +ALARMS_COLORS_BODY = { + "ALARM_PRIORITY_NONE" : "#254670", + "ALARM_PRIORITY_LOW" : "#f5a623", + "ALARM_PRIORITY_MEDIUM" : "#f5a623", + "ALARM_PRIORITY_HIGH" : "#c53b33" +} + +ALARM_MUTE_FLAG = 0B0000001000000000 +ALARM_UNMUTE_FLAG = 0B0000000000000000 + +ALARM_BUTTONS_OK = 0B0000000010111000 + +ALARM_BUTTONS_RESUME = 0B0000000000110000 +ALARM_BUTTONS_RESUME_RINSEBACK = 0B0000000000100000 +ALARM_BUTTONS_RESUME_END = 0B0000000000010000 + +ALARM_BUTTONS_RINSEBACK = 0B0000000000101000 +ALARM_BUTTONS_RINSEBACK_RESUME = ALARM_BUTTONS_RESUME_RINSEBACK +ALARM_BUTTONS_RINSEBACK_END = 0B0000000000001000 + +ALARM_BUTTONS_END = 0B0000000000011000 +ALARM_BUTTONS_END_RESUME = ALARM_BUTTONS_RESUME_END +ALARM_BUTTONS_END_RINSEBACK = ALARM_BUTTONS_RINSEBACK_END + +ALARM_BUTTONS_RESUME_RINSEBACK_END = 0B0000000000000000 +ALARM_BUTTONS_RINSEBACK_RESUME_END = ALARM_BUTTONS_RESUME_RINSEBACK_END +ALARM_BUTTONS_END_RESUME_RINSEBACK = ALARM_BUTTONS_RESUME_RINSEBACK_END + +#standby mode & ultrafiltration +SALINE_BOLUS_CUMULATIVE = 300 +UF_MINIMUM_VALUE = 0 +UF_MAXIMUM_VALUE = 600 + +#standby mode +GOODMORNING_START_TIME_SEC = 0 +GOODEVENING_START_TIME_SEC = 43200 + + + +#pressure +PRESSURE_STEPS = 10 +ARTERIAL_PRESSURE_MINIMUM = -400 +ARTERIAL_PRESSURE_MAXIMUM = +600 +ARTERIAL_PRESSURE_LOW_MIN = -300 +ARTERIAL_PRESSURE_LOW_DEF = -300 +ARTERIAL_PRESSURE_LOW_MAX = +200 +ARTERIAL_PRESSURE_HIGH_MIN = -300 +ARTERIAL_PRESSURE_HIGH_DEF = +100 +ARTERIAL_PRESSURE_HIGH_MAX = +200 + +VENOUS_PRESSURE_MINIMUM = -100 +VENOUS_PRESSURE_MAXIMUM = +700 +VENOUS_PRESSURE_LOW_MIN = -100 +VENOUS_PRESSURE_LOW_DEF = -100 +VENOUS_PRESSURE_LOW_MAX = +600 +VENOUS_PRESSURE_HIGH_MIN = +100 +VENOUS_PRESSURE_HIGH_DEF = +400 +VENOUS_PRESSURE_HIGH_MAX = +600 + +#main_treatment_flows +BLOOD_FLOW_MINIMUM_VALUE = 100 +BLOOD_FLOW_BUFFER = 25 +FLOW_SLIDER_WIDTH_BUFFER = 37 +BLOOD_FLOW_MAXIMUM_VALUE = 500 +DIALYSATE_FLOW_MINIMUM_VALUE = 0 +DIALYSATE_FLOW_MAXIMUM_VALUE = 0 # Seems to be bug. need change +DIALYSATE_FLOW_BUFFER = 50 +DIALYSATE_FLOW_SLIDER_WIDTH_BUFFER = 60 + +#blood priming +BLOOD_PRIMING_RANGE = 300 +BLOOD_PRIMING_TARGET_MAXIMUM = 300 + +#tst_pretreatment_screens +NUM_OF_PRETREATMENT_BULLETS = len(PRE_TREATMENT_SCREENS) + +#patient id +KEYBOARD_SWITCH = ["ABC", "&123"] +PATIENT_ID_COMBINATION = { + "qwerty" : "qwerty", + "sampleid" : "sampleid", + "abcdefghijklmnop" : "abcdefghijklmnop", + "patientid" : "patientid", + "username" : "username", + "sA@MpLE#123" : "sAMpLE123", + "A@BH&321" : "ABH321", + "5432@qwerty" : "5432qwerty" +} + + #dictionary consist of custom treatment values CREATE_CUSTOM_TREATMENT = { "Blood Flow Rate": 250, @@ -98,7 +199,6 @@ "Rinseback Rate" : 100, "Venous Pressure Limit High" : 590, "Venous Pressure Limit Low": 560 - } #dictionary consist of slider values of treatment parameters @@ -131,6 +231,45 @@ "rinseback_flow_rate" : [50, 25, 187], } + +#ultrafilteration volume based on flow parameters. Python list contains Rotational speed, Motor speed, +# MC speed, MC current and PWM. +TREATMENT_ULTRAFILTRATION_FLOW_PARAMETERS = { + 0 : [100, 1, 1, 1, 1, 1, 1], + 1 : [550, 24, 32, 425, 85, 18, 36], + 2 : [80, 125, 187, 257, 530, 458, 985], + 3 : [100, 0, 0, 0, 0, 0, 0], + 4 : [220, 1.45, 1.45, 1.45, 1.45, 1.45, 1.45], + } + +#dictionary contains uf maximum and minimum value's to set. +TREATMENT_ULTRAFILTRATION_TESTING_OPTION = { + 0 : {"uf_maximum" : 600, "uf_minimum" : 0}, + 1 : {"uf_maximum" : 500, "uf_minimum" : 0}, + 2 : {"uf_maximum" : 280, "uf_minimum" : 0}, + 3 : {"uf_maximum" : 765, "uf_minimum" : 500}, + 4 : {"uf_maximum" : 680, "uf_minimum" : 450}, + 5 : {"uf_maximum" : 480, "uf_minimum" : 380}, + } + +#dictionary contains saline cumulative and saline delivered value +#key : saline cumulative value. +#value: saline delivered value +SALINE_BOLUS_VALUES = { + 0 : 0, + 1.0 : 1.0, + 125.56 : 100.56, + 165.87 : 145.87, + 220.65 : 220.65, + 325.25 : 300.25, + 400.86 : 380.86, + 500.00 : 500.25, + 634.76 : 634.76, + 823.65 : 800.65, + 999.99 : 999.99, + 1000 : 1000 +} + # pretreatment_patient_connection SYSTOLIC_PRESSSURE_120 = 120 SYSTOLIC_PRESSSURE_113 = 113 @@ -159,14 +298,92 @@ HEART_RATE_VAL_110 = 110 HEART_RATE_VAL_181 = 181 HEART_RATE_VAL_200 = 200 -SYSTOLIC_LOWER_LIMIT = 60 -SYSTOLIC_UPPER_LIMIT = 250 -DIASTOLIC_LOWER_LIMIT = 40 -DIASTOLIC_UPPER_LIMIT = 200 -HEART_RATE_LOWER_LIMIT = 40 -HEART_RATE_UPPER_LIMIT = 180 +UF_MINIMUM_SLIDER_WIDTH = -2 +UF_MAXIMUM_SLIDER_WIDTH = 638.00 +UF_VALID_RANGE = 700 +TRAINING_INDICATOR_SCREEN = 4 +TREATMENT_ULTRAFILTERATION_TESTING_OPTION = { + "OPTION_1" : {"uf_maximum" : 800, "uf_minimum" : 0}, + "OPTION_2" : {"uf_maximum" : 500, "uf_minimum" : 0}, + "OPTION_3" : {"uf_maximum" : 550, "uf_minimum" : 0}, + "OPTION_4" : {"uf_maximum" : 300, "uf_minimum" : 0}, + "OPTION_5" : {"uf_maximum" : 280, "uf_minimum" : 0}, + "OPTION_6" : {"uf_maximum" : 765, "uf_minimum" : 0}, + "OPTION_7" : {"uf_maximum" : 680, "uf_minimum" : 0}, + "OPTION_8" : {"uf_maximum" : 1500, "uf_minimum" : 0}, + "OPTION_9" : {"uf_maximum" : 390, "uf_minimum" : 0}, + "OPTION_10" : {"uf_maximum" : 800, "uf_minimum" : 0}, + "OPTION_11" : {"uf_maximum" : 1000, "uf_minimum" : 0}, + "OPTION_12" : {"uf_maximum" : 1250, "uf_minimum" : 0}, + } -# pretreatment_patient_connection -OUT_OF_RANGE_COLOR = "#c53b33" -IN_RANGE_COLOR = "#fcfcfc" + +#pre-treatment_priming +NOT_VISIBLE = False VISIBLE = True +FOCUS = True +NOT_IN_FOCUS = False + +#Filter Flush + +MAXIMUM_COUNTDOWN_TIME = 300 +MINIMUM_COUNTDOWN_TIME = 0 +TIME_OUT_DURATION_300 = 300 +TIME_OUT_DURATION_200 = 200 +TIME_OUT_DURATION_100 = 100 +COUNT_DOWN_TIME_100 = 100 +MINIMUM_COUNTDOWN_TIME = 0 +CONSUMABLE_SELF_TEST_BICARB_PUMP_CHECK_STATE = 3 + +VALID = True +INVALID = False + +#post treatment review +ACID_CONCENTRATE_POST = ["Fres. Naturalyte", "08-1251-1", "08-2251-0", "08-3251-9", "08-3251-9"] +BRIGHTNESS_MIN_VAL = 20 +BRIGHTNESS_MAX_VAL = 100 +VOLUME_MIN_VAL = 20 +VOLUME_MAX_VAL = 100 + +#dictionary consist of review parameters values of post treatment +POST_TREATMENT_REVIEW_PARAMETER_RANGE = { + "Patient ID": ["abcd", "xyz"], + "Heparin Stop": [0, 101], + "Device ID": [1234, 1234], + "Heparin Delivered Volume": [10.1, 10.5], + "Blood Flow Rate": [100, 125], + "Treatment Start DateTime": [1654519251, 1623382321], + "Dialysate Flow Rate": [100, 150], + "Treatment End DateTime": [1654519251, 1623382321], + "Treatment Duration": [70, 75], + "Water Sample Test Result": [0, 1], + "Actual Treatment Duration": [62, 126], + "Dialysate Volume Used": [4.0, 6.0], + "Acid ConcentrateType": [0, 1], + "Prescribed UF Volume": [0.3, 0.5], + "Bicarbonate Concentrate Type": [0, 0], + "Target UF Volume": [10.1, 10.5], + "Potassium Concentration": [60, 75], + "Actual UF Volume": [0.3, 0.5], + "Calcium Concentration": [3, 56], + "Prescribed UF Rate": [0.1, 0.55], + "Bicarbonate Concentration": [14, 50], + "Target UF Rate": [0.2, 0.56], + "Sodium Concentration": [4, 6], + "Actual UF Rate": [0.5, 0.6], + "Dialysate Temperature": [35.0, 35.5], + "Saline Bolus Volume": [300, 250], + "Dialyzer Type": [0, 1], + "Average Blood Flow": [54.3, 67.3], + "Heparin Type": [0, 0], + "Average Dialysate Flow": [0.6, 0.5], + "Average Dialysate Temp": [35.0, 35.5], + "Heparin Bolus Volume": [0.0, 0.1], + "Average Arterial Pressure": [0.0, 11.56], + "Heparin Dispense Rate": [0.0, 0.1], + "Average Venous Pressure": [20.0, 101.45], +} + +#ui_logs +RESET_BINARY = "0" +SET_BINARY = "1" #Message binaries appending with for easy identification Index: shared/scripts/configuration/strings.py =================================================================== diff -u -r3ffa22d8d37d9fe495e60343f5ded2a8dee50353 -rae1bfa4af97263849cafb3d6964205cce4a10700 --- shared/scripts/configuration/strings.py (.../strings.py) (revision 3ffa22d8d37d9fe495e60343f5ded2a8dee50353) +++ shared/scripts/configuration/strings.py (.../strings.py) (revision ae1bfa4af97263849cafb3d6964205cce4a10700) @@ -18,7 +18,9 @@ BLOOD_PRIMING_TEXT = "Blood Priming" SALINE_UNIT = "mL" -BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" +BLOOD_PRIMING_UNIT = "mL" +BLOOD_PRIMING_VALUE_0 = "0" +BLOOD_PRIMING_DEFAULT_VALUE = BLOOD_PRIMING_VALUE_0 + BLOOD_PRIMING_UNIT #UF treatment ULTRAFILTRATION_PAUSED_TEXT = "Ultrafiltration Paused" Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r4d66e02dce6ed8c33da954937c892dde409f98e5 -rae1bfa4af97263849cafb3d6964205cce4a10700 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 4d66e02dce6ed8c33da954937c892dde409f98e5) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision ae1bfa4af97263849cafb3d6964205cce4a10700) @@ -148,6 +148,12 @@ 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 get_current_date_and_time(date_format='%Y/%b/%d - %H:%M'): + + date = datetime.now() + return str(date.strftime(date_format)) def enter_keypad_value(entry): """ @@ -249,8 +255,7 @@ arterial_min += 10 # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg if arterial_min == arterial_max - config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(low_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) break else: @@ -296,32 +301,27 @@ arterial_max += 10 # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(high_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(high_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) test.log("Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) break else: continue elif arterial_max > art_high: while arterial_max != art_high: - squish.mouseDrag(high_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(high_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) arterial_max -= 10 # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(high_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(high_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) test.log("Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) break else: continue # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: - test.compare(high_handler_parent.maxValue, arterial_max, - "Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) + test.compare(high_handler_parent.maxValue, arterial_max, "Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) else: - test.compare(arterial_max, art_high, - "Actual Arterial range maximum value: {} is equal to Expected value: {}".format(arterial_max, art_high)) + test.compare(arterial_max, art_high, "Actual Arterial range maximum value: {} is equal to Expected value: {}".format(arterial_max, art_high)) test.endSection() def set_venous_ranges_max_val(ven_high): @@ -343,26 +343,22 @@ test.passes("Venous range maximum is already set to {}".format(ven_high)) elif ven_max < ven_high: while ven_max != ven_high: - squish.mouseDrag(high_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(high_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) ven_max += 10 # venous blood pressure low limit should be lower than the high limit by at least 30mmHg if ven_max == ven_min + config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(high_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(high_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) test.log("Venous range maximum value cannot be moved beyond {}".format(ven_max)) break else: continue elif ven_max > ven_high: while ven_max != ven_high: - squish.mouseDrag(high_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(high_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) ven_max -= 10 # venous blood pressure low limit should be lower than the high limit by at least 30mmHg if ven_max == ven_min + config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(high_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(high_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) test.log("Venous range maximum value cannot be moved beyond {}".format(ven_max)) break else: @@ -394,36 +390,30 @@ test.passes("Venous range minimum is already set to {}".format(ven_low)) elif ven_min < ven_low: while ven_min != ven_low: - squish.mouseDrag(low_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) ven_min += 10 if ven_min == ven_max - config.BUFFER_LOW_AND_HIGH_LIMITS: # venous blood pressure low limit should be lower than the high limit by at least 30mmHg - squish.mouseDrag(low_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) test.log("Venous range minimum value cannot be moved beyond {}".format(ven_min)) break else: continue elif ven_min > ven_low: while ven_min != ven_low: - squish.mouseDrag(low_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) ven_min -= 10 # venous blood pressure low limit should be lower than the high limit by at least 30mmHg if ven_min == ven_max - config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(low_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) test.log("Venous range minimum value cannot be moved beyond {}".format(ven_min)) break else: continue # venous blood pressure low limit should be lower than the high limit by at least 30mmHg if ven_min == ven_max - config.BUFFER_LOW_AND_HIGH_LIMITS: - test.compare(low_handler_parent.minValue, ven_min, - "Venous range minimum value cannot be moved beyond {}".format(ven_min)) + test.compare(low_handler_parent.minValue, ven_min, "Venous range minimum value cannot be moved beyond {}".format(ven_min)) else: - test.compare(ven_min, ven_low, - "Actual Venous range minimum value: {} is equal to Expected value: {}".format(ven_min, ven_low)) + test.compare(ven_min, ven_low, "Actual Venous range minimum value: {} is equal to Expected value: {}".format(ven_min, ven_low)) test.endSection() def scroll_to_value_on_pop_up(value=None, container=None): Index: tst_main_treatment_vitals/test.py =================================================================== diff -u -r302953f40b6bbfaf9a0688a0fda72e022258e10e -rae1bfa4af97263849cafb3d6964205cce4a10700 --- tst_main_treatment_vitals/test.py (.../test.py) (revision 302953f40b6bbfaf9a0688a0fda72e022258e10e) +++ tst_main_treatment_vitals/test.py (.../test.py) (revision ae1bfa4af97263849cafb3d6964205cce4a10700) @@ -15,13 +15,10 @@ import names import time -from configuration.config import * -from configuration.utility import * +from configuration import config, utility from dialin.ui import utils -from configuration import utility -from dialin.ui.utils import waitForGUI from dialin.ui.hd_simulator import HDSimulator -from dialin.common.hd_defs import PreTreatmentSubModes, HDOpModes, HDOpSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates +from dialin.common.hd_defs import PreTreatmentSubModes, HDOpModes, HDOpSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates, TreatmentStates hd_simulator = HDSimulator() @@ -37,8 +34,6 @@ HEART_RATE_VAL_60 = "60" HEART_RATE_VAL_70 = "70" HEART_RATE_VAL_85 = "85" -DIASTOLIC_TEXT = "diastolic" -SYSTOLIC_TEXT = "systolic" BLOOD_PRESSURE_DEFAULT_VAL = "__ / __" HEART_RATE_DEFAULT_VAL = "__" INVALID_VALS = {"systolic" : [260, 59, 300, 23], "diastolic": [39, 1, 210, 201], @@ -56,9 +51,8 @@ def keyboard_object_map_helper(text): """ - Method for setting custom object property's for keyboard keys - - @return: required object property's for keys + Method for setting custom object property's for keyboard keys + @return: required object property's for keys """ if text is not None: names.o_keboard_input["text"] = text @@ -70,9 +64,8 @@ def keyboard_switching_section(text): """ - Tests to automate keyboard based on user input - - @return: key text (text displayed on keyboard) + Tests to automate keyboard based on user input + @return: key text (text displayed on keyboard) """ keyboard_value = keyboard_object_map_helper(text) object_status = object.exists(keyboard_value) @@ -129,19 +122,19 @@ if object.exists(names.o_vitals_pop_up_title): vitals_pop_up_title = waitForObject(names.o_vitals_pop_up_title) vitals_pop_up_title = str(vitals_pop_up_title.text) - test.compare(vitals_pop_up_title, VITALS_TITLE,"Vitals title text is displayed") + test.compare(vitals_pop_up_title, config.VITALS_TITLE,"Vitals title text is displayed") bp_title = waitForObject(names.o_pop_up_bp_title) bp_title = str(bp_title.text) - test.compare(bp_title, BLOOD_PRESSURE_TITLE,"Blood pressure title text is displayed") + test.compare(bp_title, config.BLOOD_PRESSURE_TITLE,"Blood pressure title text is displayed") bp_uom = waitForObject(names.o_bp_uom) bp_uom = str(bp_uom.text) - test.compare(bp_uom, BLOOD_PRESSURE_UNIT,"Blood pressure unit should be {}".format(BLOOD_PRESSURE_UNIT)) + test.compare(bp_uom, config.BLOOD_PRESSURE_UNIT,"Blood pressure unit should be {}".format(config.BLOOD_PRESSURE_UNIT)) heart_rate_title = waitForObject(names.o_pop_up_heart_rate_title) heart_rate_title = str(heart_rate_title.text) - test.compare(heart_rate_title, HEART_RATE_TITLE,"Heart rate title text is displayed") + test.compare(heart_rate_title, config.HEART_RATE_TITLE,"Heart rate title text is displayed") hr_uom = waitForObject(names.o_hr_uom) hr_uom = str(hr_uom.text) - test.compare(hr_uom, HEART_RATE_UNIT,"Heart Rate unit should be {}".format(HEART_RATE_UNIT)) + test.compare(hr_uom, config.HEART_RATE_UNIT,"Heart Rate unit should be {}".format(config.HEART_RATE_UNIT)) test.endSection() return start_time @@ -157,21 +150,21 @@ test.startSection("Verify the color of {} value {}".format(vital_parameter, entry)) input_field_color = input_field.color.name entry = builtins.int(entry) - if vital_parameter is SYSTOLIC_TEXT: - if (entry < SYSTOLIC_LOWER_LIMIT) or (entry > SYSTOLIC_UPPER_LIMIT): - test.compare(input_field_color, OUT_OF_RANGE_COLOR, "systolic value {} is out of range, systolic value should be in range of {} and {}".format(entry, SYSTOLIC_LOWER_LIMIT, SYSTOLIC_UPPER_LIMIT)) - elif (entry >= SYSTOLIC_LOWER_LIMIT) and (entry <= SYSTOLIC_UPPER_LIMIT): - test.compare(input_field_color, IN_RANGE_COLOR, "systolic value {} is in range of {} and {}".format(entry, SYSTOLIC_LOWER_LIMIT, SYSTOLIC_UPPER_LIMIT)) - elif vital_parameter is DIASTOLIC_TEXT: - if (entry < DIASTOLIC_LOWER_LIMIT) or (entry > DIASTOLIC_UPPER_LIMIT): - test.compare(input_field_color, OUT_OF_RANGE_COLOR, "diastolic value {} is out of range, diastolic value should be in range of {} and {}".format(entry, DIASTOLIC_LOWER_LIMIT, DIASTOLIC_UPPER_LIMIT)) - elif (entry >= DIASTOLIC_LOWER_LIMIT) and (entry <= DIASTOLIC_UPPER_LIMIT): - test.compare(input_field_color, IN_RANGE_COLOR, "diastolic value {} is in range of {} and {}".format(entry, DIASTOLIC_LOWER_LIMIT, DIASTOLIC_UPPER_LIMIT)) - elif vital_parameter is HEART_RATE_TITLE: - if (entry < HEART_RATE_LOWER_LIMIT) or (entry > HEART_RATE_UPPER_LIMIT): - test.compare(input_field_color, OUT_OF_RANGE_COLOR, "Heart Rate value {} is out of range, Heart Rate value should be in range of {} and {}".format(entry, HEART_RATE_LOWER_LIMIT, HEART_RATE_UPPER_LIMIT)) - elif (entry >= HEART_RATE_LOWER_LIMIT) and (entry <= HEART_RATE_UPPER_LIMIT): - test.compare(input_field_color,IN_RANGE_COLOR, "Heart Rate value {} is in range of {} and {}".format(entry, HEART_RATE_LOWER_LIMIT, HEART_RATE_UPPER_LIMIT)) + if vital_parameter is config.SYSTOLIC_TEXT: + if (entry < config.SYSTOLIC_LOWER_LIMIT) or (entry > config.SYSTOLIC_UPPER_LIMIT): + test.compare(input_field_color, config.OUT_OF_RANGE_COLOR, "systolic value {} is out of range, systolic value should be in range of {} and {}".format(entry, config.SYSTOLIC_LOWER_LIMIT, config.SYSTOLIC_UPPER_LIMIT)) + elif (entry >= config.SYSTOLIC_LOWER_LIMIT) and (entry <= config.SYSTOLIC_UPPER_LIMIT): + test.compare(input_field_color, config.IN_RANGE_COLOR, "systolic value {} is in range of {} and {}".format(entry, config.SYSTOLIC_LOWER_LIMIT, config.SYSTOLIC_UPPER_LIMIT)) + elif vital_parameter is config.DIASTOLIC_TEXT: + if (entry < config.DIASTOLIC_LOWER_LIMIT) or (entry > config.DIASTOLIC_UPPER_LIMIT): + test.compare(input_field_color, config.OUT_OF_RANGE_COLOR, "diastolic value {} is out of range, diastolic value should be in range of {} and {}".format(entry, config.DIASTOLIC_LOWER_LIMIT, config.DIASTOLIC_UPPER_LIMIT)) + elif (entry >= config.DIASTOLIC_LOWER_LIMIT) and (entry <= config.DIASTOLIC_UPPER_LIMIT): + test.compare(input_field_color, config.IN_RANGE_COLOR, "diastolic value {} is in range of {} and {}".format(entry, config.DIASTOLIC_LOWER_LIMIT, config.DIASTOLIC_UPPER_LIMIT)) + elif vital_parameter is config.HEART_RATE_TITLE: + if (entry < config.HEART_RATE_LOWER_LIMIT) or (entry > config.HEART_RATE_UPPER_LIMIT): + test.compare(input_field_color, config.OUT_OF_RANGE_COLOR, "Heart Rate value {} is out of range, Heart Rate value should be in range of {} and {}".format(entry, config.HEART_RATE_LOWER_LIMIT, config.HEART_RATE_UPPER_LIMIT)) + elif (entry >= config.HEART_RATE_LOWER_LIMIT) and (entry <= config.HEART_RATE_UPPER_LIMIT): + test.compare(input_field_color,config.IN_RANGE_COLOR, "Heart Rate value {} is in range of {} and {}".format(entry, config.HEART_RATE_LOWER_LIMIT, config.HEART_RATE_UPPER_LIMIT)) test.endSection() @@ -182,7 +175,7 @@ """ test.startSection("Verify the last read of blood pressure and heart rate") expected_last_read = "Interval: off , Last Read: {}".format(saved_time) - last_read = waitForObject(vitals_reading_obj(expected_last_read)) + last_read = waitForObject(utility.vitals_reading_obj(expected_last_read)) last_read = str(last_read.text) test.compare(last_read, expected_last_read, "Last read time should be {}".format(last_read)) test.endSection() @@ -197,13 +190,12 @@ """ test.startSection("Verify the user entered {} value {} in main-treatment screen".format(vital, value)) if save: - input_field = waitForObject(vitals_reading_obj(value)) + input_field = waitForObject(utility.vitals_reading_obj(value)) entered_value = input_field.text value = str(value) - test.compare(str(entered_value), value, - "Expected {} value: {} should be equal to Actual {} value: {}".format(vital, value, vital, entered_value)) + test.compare(str(entered_value), value, "Expected {} value: {} should be equal to Actual {} value: {}".format(vital, value, vital, entered_value)) else: - if object.exists(vitals_reading_obj(value)) is False: + if object.exists(utility.vitals_reading_obj(value)) is False: test.log("Entered is not saved and is not updated in main-treatment screen") test.endSection() @@ -233,37 +225,31 @@ is entering value (sys/dia/heart rate) """ test.startSection("Verify the range of {}".format(vital_parameter)) - if vital_parameter is SYSTOLIC_TEXT: + if vital_parameter is config.SYSTOLIC_TEXT: systolic = waitForObject(names.o_pop_up_systolic_input_field) mouseClick(systolic) for value in SYSTOLIC_VALUES: - enter_keypad_value(str(value)) - verify_entered_value_in_pop_up(value=str(value), input_field=systolic, - vital=vital_parameter) - verify_color_of_entry(entry=value, vital_parameter=SYSTOLIC_TEXT, - input_field=systolic) - erase_entered_value(input_field=systolic) - elif vital_parameter is DIASTOLIC_TEXT: + utility.enter_keypad_value(str(value)) + verify_entered_value_in_pop_up(value=str(value), input_field=systolic, vital=vital_parameter) + verify_color_of_entry(entry=value, vital_parameter=config.SYSTOLIC_TEXT, input_field=systolic) + utility.erase_entered_value(input_field=systolic) + elif vital_parameter is config.DIASTOLIC_TEXT: diastolic = waitForObject(names.o_pop_up_diastolic_input_field) mouseClick(diastolic) for value in DIASTOLIC_VALUES: - enter_keypad_value(str(value)) - verify_entered_value_in_pop_up(value=str(value), input_field=diastolic, - vital=vital_parameter) - verify_color_of_entry(entry=value, vital_parameter=DIASTOLIC_TEXT, - input_field=diastolic) - erase_entered_value(diastolic) - utils.waitForGUI(1) - elif vital_parameter is HEART_RATE_TITLE: + utility.enter_keypad_value(str(value)) + verify_entered_value_in_pop_up(value=str(value), input_field=diastolic, vital=vital_parameter) + verify_color_of_entry(entry=value, vital_parameter=config.DIASTOLIC_TEXT, input_field=diastolic) + utility.erase_entered_value(diastolic) + utils.waitForGUI(1) + elif vital_parameter is config.HEART_RATE_TITLE: hr = waitForObject(names.o_pop_up_heart_rate_input_field) mouseClick(hr) for value in HEART_RATE_VALUES: - enter_keypad_value(str(value)) - verify_entered_value_in_pop_up(value=str(value), input_field=hr, - vital=vital_parameter) - verify_color_of_entry(entry=value, vital_parameter=HEART_RATE_TITLE, - input_field=hr) - erase_entered_value(hr) + utility.enter_keypad_value(str(value)) + verify_entered_value_in_pop_up(value=str(value), input_field=hr, vital=vital_parameter) + verify_color_of_entry(entry=value, vital_parameter=config.HEART_RATE_TITLE, input_field=hr) + utility.erase_entered_value(hr) test.endSection() @@ -274,43 +260,37 @@ """ test.startSection("Verify the color out of range values of {}".format(vital_parameter)) out_range_val_list = INVALID_VALS[vital_parameter] - if vital_parameter is SYSTOLIC_TEXT: + if vital_parameter is config.SYSTOLIC_TEXT: systolic = waitForObject(names.o_pop_up_systolic_input_field) mouseClick(systolic) for entry in out_range_val_list: - enter_keypad_value(entry=str(entry)) - verify_entered_value_in_pop_up(value=str(entry), input_field=systolic, - vital=vital_parameter) - verify_color_of_entry(entry=entry, vital_parameter=SYSTOLIC_TEXT, - input_field=systolic) - erase_entered_value(input_field=systolic) - elif vital_parameter is DIASTOLIC_TEXT: + utility.enter_keypad_value(entry=str(entry)) + verify_entered_value_in_pop_up(value=str(entry), input_field=systolic, vital=vital_parameter) + verify_color_of_entry(entry=entry, vital_parameter=config.SYSTOLIC_TEXT, input_field=systolic) + utility.erase_entered_value(input_field=systolic) + elif vital_parameter is config.DIASTOLIC_TEXT: diastolic = waitForObject(names.o_pop_up_diastolic_input_field) mouseClick(diastolic) for entry in out_range_val_list: - enter_keypad_value(str(entry)) - verify_entered_value_in_pop_up(value=str(entry), input_field=diastolic, - vital=vital_parameter) - verify_color_of_entry(entry=entry, vital_parameter=DIASTOLIC_TEXT, - input_field=diastolic) - erase_entered_value(diastolic) + utility.enter_keypad_value(str(entry)) + verify_entered_value_in_pop_up(value=str(entry), input_field=diastolic, vital=vital_parameter) + verify_color_of_entry(entry=entry, vital_parameter=config.DIASTOLIC_TEXT, input_field=diastolic) + utility.erase_entered_value(diastolic) utils.waitForGUI(1) - elif vital_parameter is HEART_RATE_TITLE: + elif vital_parameter is config.HEART_RATE_TITLE: hr = waitForObject(names.o_pop_up_heart_rate_input_field) mouseClick(hr) for entry in out_range_val_list: - enter_keypad_value(str(entry)) - verify_entered_value_in_pop_up(value=str(entry), input_field=hr, - vital=vital_parameter) - verify_color_of_entry(entry=entry, vital_parameter=HEART_RATE_TITLE, - input_field=hr) - erase_entered_value(hr) + utility.enter_keypad_value(str(entry)) + verify_entered_value_in_pop_up(value=str(entry), input_field=hr, vital=vital_parameter) + verify_color_of_entry(entry=entry, vital_parameter=config.HEART_RATE_TITLE, input_field=hr) + utility.erase_entered_value(hr) test.endSection() def verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val, dia_val, heart_rate, save): """ - method to enter systolic, diastolic and + Method to enter systolic, diastolic and heart rate value and save or unsave it and verify same is updated in main-treatment screen @@ -322,59 +302,52 @@ test.startSection("Verify the entered systolic, diastolic and heart rate value updated in main-treatement screen") systolic = waitForObject(names.o_pop_up_systolic_input_field) mouseClick(systolic) - erase_entered_value(systolic) - enter_keypad_value(str(sys_val)) - verify_entered_value_in_pop_up(value=str(sys_val), input_field=systolic, - vital=SYSTOLIC_TEXT) - verify_color_of_entry(entry=sys_val, vital_parameter=SYSTOLIC_TEXT, - input_field=systolic) + utility.erase_entered_value(systolic) + utility.enter_keypad_value(str(sys_val)) + verify_entered_value_in_pop_up(value=str(sys_val), input_field=systolic, vital=config.SYSTOLIC_TEXT) + verify_color_of_entry(entry=sys_val, vital_parameter=config.SYSTOLIC_TEXT, input_field=systolic) diastolic = waitForObject(names.o_pop_up_diastolic_input_field) mouseClick(diastolic) - erase_entered_value(diastolic) + utility.erase_entered_value(diastolic) utils.waitForGUI(1) - enter_keypad_value(str(dia_val)) - verify_entered_value_in_pop_up(value=str(dia_val), input_field=diastolic, - vital=DIASTOLIC_TEXT) - verify_color_of_entry(entry=dia_val, vital_parameter=DIASTOLIC_TEXT, - input_field=diastolic) + utility.enter_keypad_value(str(dia_val)) + verify_entered_value_in_pop_up(value=str(dia_val), input_field=diastolic, vital=config.DIASTOLIC_TEXT) + verify_color_of_entry(entry=dia_val, vital_parameter=config.DIASTOLIC_TEXT, input_field=diastolic) hr = waitForObject(names.o_pop_up_heart_rate_input_field) mouseClick(hr) - erase_entered_value(hr) - enter_keypad_value(str(heart_rate)) - verify_entered_value_in_pop_up(value=str(heart_rate), input_field=hr, - vital=HEART_RATE_TITLE) - verify_color_of_entry(entry=heart_rate, vital_parameter=HEART_RATE_TITLE, - input_field=hr) + utility.erase_entered_value(hr) + utility.enter_keypad_value(str(heart_rate)) + verify_entered_value_in_pop_up(value=str(heart_rate), input_field=hr, vital=config.HEART_RATE_TITLE) + verify_color_of_entry(entry=heart_rate, vital_parameter=config.HEART_RATE_TITLE, input_field=hr) if save: test.log("Clicking confirm button") confirm_button = waitForObjectExists(names.o_vitals_confrim_btn) test.compare(confirm_button.enabled, True, "Valid Blood Pressure and Heart is entered therefore confirm button is enabled") - saved_time = get_current_date_and_time() - saved_time = get_current_date_and_time(date_format='%Y/%b/%d - %H:%M') + saved_time = utility.get_current_date_and_time() + saved_time = utility.get_current_date_and_time(date_format='%Y/%b/%d - %H:%M') mouseClick(confirm_button) verify_last_read_time(saved_time) elif save is False: mouseClick(waitForObject(names.o_vitals_close_btn)) test.log("'Vitals pop is closed") expected_blood_pressure = "{sys} / {dia}".format(sys=sys_val, dia=dia_val) - verify_entered_value_in_main_treatment_screen(value=expected_blood_pressure, - vital=BLOOD_PRESSURE_TITLE, save=save) - verify_entered_value_in_main_treatment_screen(value=heart_rate, vital=HEART_RATE_TITLE, save=save) + verify_entered_value_in_main_treatment_screen(value=expected_blood_pressure, vital=config.BLOOD_PRESSURE_TITLE, save=save) + verify_entered_value_in_main_treatment_screen(value=heart_rate, vital=config.HEART_RATE_TITLE, save=save) test.endSection() def verify_request_continue_mode(): """ - Method to accept treatment response. + Method to accept treatment response. """ 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 ]) test.compare(treatment_status, True, "custom treatment should be accepted") def verify_create_custom_treatment_parameter(): """ - Method to set create custom treatment slider value based on slider buffer + Method to set create custom treatment slider value based on slider buffer """ test.startSection("Set create custom treatment slider based on positive slider buffer") test.compare(waitForObject(names.o_PreTreatmentCreate_Create_a_Custom_Treatment_Text).text, config.TREATMENT_TITLE, "Title text should be -> "+str(config.TREATMENT_TITLE)) @@ -398,7 +371,7 @@ test.endSection() #scroll the screen to the title heparin bolus volume - parameter_object = set_parameter_type(text = config.HEPARIN_BOLUS_VOLUME) + parameter_object = set_parameter_type(text=config.HEPARIN_BOLUS_VOLUME) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of heparin dispensing rate values") @@ -414,7 +387,7 @@ test.endSection() #scroll the screen to the title acid concentrate type - parameter_object = set_parameter_type(text = config.HEPARIN_TYPE_TITLE) + parameter_object = set_parameter_type(text=config.HEPARIN_TYPE_TITLE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of heparin stop time values") @@ -429,7 +402,7 @@ test.endSection() #scroll the screen to the title acid concentrate type - parameter_object = set_parameter_type(text = config.ACID_CONCENTRATE_TITLE) + parameter_object = set_parameter_type(text=config.ACID_CONCENTRATE_TITLE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of heparin type") @@ -440,7 +413,7 @@ test.endSection() #scroll the screen to the title dialyste rectangle - parameter_object = set_parameter_type(text = config.DIALYZER_TYPE_TITLE) + parameter_object = set_parameter_type(text=config.DIALYZER_TYPE_TITLE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of acid concentrate type") @@ -451,7 +424,7 @@ test.endSection() #scroll the screen to the title dialyste rectangle - parameter_object = set_parameter_type(text = config.DIALYZER_TYPE_TITLE) + parameter_object = set_parameter_type(text=config.DIALYZER_TYPE_TITLE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of bicarbonate concentrate rectangle") @@ -462,7 +435,7 @@ test.endSection() #scroll the screen to the title dialyste temperature value - parameter_object = set_parameter_type(text = config.DIALYSATE_TEMPERATURE) + parameter_object = set_parameter_type(text=config.DIALYSATE_TEMPERATURE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of dialysate rectangle") @@ -475,7 +448,7 @@ test.endSection() #scroll the screen to the title blood pressure measurement interval - parameter_object = set_parameter_type(text = config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) + parameter_object = set_parameter_type(text=config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of dialysate temperature values") @@ -484,7 +457,7 @@ test.endSection() #scroll the screen to the title rinseback flow rate - parameter_object = set_parameter_type(text = config.RINSEBACK_FLOW_RATE) + parameter_object = set_parameter_type(text=config.RINSEBACK_FLOW_RATE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) set_arterial_low_and_high() @@ -505,7 +478,7 @@ def set_venous_low_and_high(): """ - Method to set the venous low and high limits using slider + Method to set the venous low and high limits using slider """ test.startSection("Set the venous low and high limits using slider") utility.set_venous_ranges_min_val(ven_low) @@ -516,7 +489,7 @@ def set_arterial_low_and_high(): """ - Method to set the arterial low and high limits using slider + Method to set the arterial low and high limits using slider """ test.startSection("Set the arterial low and high limits using slider") utility.set_arterial_ranges_max_val(art_high) @@ -526,21 +499,21 @@ def verify_vital_entries_in_main_treatment_screen(sys_val, dia_val, heart_rate): """ - method to enter systolic, diastolic and heart rate value and save or unsave it and verify - same is updated in pre-treatment screen. - @param sys_val - (int) user expected systolic pressure - @param dia_val - (int) user expected diastolic pressure - @param heart_rate - (int) user expected heart rate - @param save - (bool) True/False + Method to enter systolic, diastolic and heart rate value and save or unsave it and verify + same is updated in pre-treatment screen. + @param sys_val - (int) user expected systolic pressure + @param dia_val - (int) user expected diastolic pressure + @param heart_rate - (int) user expected heart rate + @param save - (bool) True/False """ test.startSection("Verify the entered systolic, diastolic and heart rate value updated in main-treatement screen") mouseClick(waitForObject(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry)) utility.erase_entered_value(names.o_PreTreatmentBase_input_TextInput_2) utility.enter_keypad_value(sys_val) test.verify(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).enabled, "systolic combo box should be enabled.") - test.compare(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).text, str(sys_val), "systolic value should be : "+str(sys_val)) - verify_color_of_entry(entry = sys_val, vital_parameter = config.SYSTOLIC_TEXT, input_field = waitForObject(names.o_PreTreatmentBase_input_TextInput_2)) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).text, str(sys_val), "systolic value should be : " + str(sys_val)) + verify_color_of_entry(entry=sys_val, vital_parameter=config.SYSTOLIC_TEXT, input_field=waitForObject(names.o_PreTreatmentBase_input_TextInput_2)) mouseClick(waitForObject(names.o_PreTreatmentBase_input_TextInput_3)) @@ -564,9 +537,7 @@ def verify_entered_vitals_in_patient_connection_screen(): """ - Method to verify BP/HR section from patient connection. - @param : N/A - @return: N/A + Method to verify BP/HR section from patient connection. """ test.startSection("verification of BP/HR section from patient connection") test.compare(waitForObjectExists(names.o_PreTreatmentBase_BP_HR_Text).text, config.BP_HR_TEXT, "BP/HR title text should be :" + str(config.BP_HR_TEXT)) @@ -588,7 +559,7 @@ def set_venous_high_and_low_limits_using_slider(): """ - Method to set the venous low and high limits using slider + Method to set the venous low and high limits using slider """ test.startSection("Set the venous low and high limits using slider") utils.waitForGUI(1) @@ -602,7 +573,7 @@ def set_arterial_high_and_low_limits_using_slider(): """ - Method to set the arterial low and high limits using slider + Method to set the arterial low and high limits using slider """ test.startSection("Set the arterial low and high limits using slider") utils.waitForGUI(1) @@ -612,7 +583,7 @@ test.endSection() -def drag_and_drop_ultrafiltration_slider(slider_value = 0, maximum_ultrafiltration = 0): +def drag_and_drop_ultrafiltration_slider(slider_value=0, maximum_ultrafiltration=0): """ Tests to verify ultrafiltration slider range @param slider_value: (int) value of the slider to set. @@ -630,25 +601,25 @@ navigate to main treatment screen to reset vital """ test.startSection("Verify last read and interval of blood pressure and heart rate") - hd_simulator.cmd_send_hd_operation_mode(op_mode = HDOpModes.MODE_TPAR.value , sub_mode = HDOpSubModes.SUBMODE_START.value) + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TPAR.value, sub_mode=HDOpSubModes.SUBMODE_START.value) mouseClick(waitForObject(names.o_input_patient_id)) type(waitForObject(names.o_input_patient_id), "abcd") mouseClick(waitForObject(names.o_confirm_button)) verify_create_custom_treatment_parameter() verify_request_continue_mode() utils.waitForGUI(1) - hd_simulator.cmd_initiate_treatment_response(response = 1, reason =0) - hd_simulator.cmd_send_hd_operation_mode(op_mode = HDOpModes.MODE_PRET.value , sub_mode = HDOpSubModes.SUBMODE_START.value) + hd_simulator.cmd_initiate_treatment_response(response=1, reason=0) + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_PRET.value , sub_mode=HDOpSubModes.SUBMODE_START.value) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=PreTreatmentSubModes.HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_INSTALL_STATE.value, no_cartridge_self_test_state=PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value,installation_state=PreTreatmentCartridgeInstallStates.CARTRIDGE_INSTALL_STATE.value, dry_self_test_state=PreTreatmentDrySelfTestsStates.DRY_SELF_TESTS_START_STATE.value, prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value,recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) - hd_simulator.cmd_send_uf_treatment_response(accepted =True, reason =0, volume = 300) + hd_simulator.cmd_send_uf_treatment_response(accepted=True, reason=0, volume=300) verify_entered_vitals_in_patient_connection_screen() utils.waitForGUI(1) - hd_simulator.cmd_send_hd_operation_mode(op_mode = 6 , sub_mode = 2) + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TREA.value, sub_mode=TreatmentStates.TREATMENT_DIALYSIS_STATE.value) utils.waitForGUI(1) hd_simulator.cmd_set_treatment_states_data(sub_mode = 1, uf_state= 0, saline_state=0, heparin_state= 0, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, @@ -668,14 +639,14 @@ from main treatment to patient connection verifying the same by navigating from patient connection to main treatment to reset """ - hd_simulator.cmd_send_hd_operation_mode(op_mode = 6 , sub_mode = 2) + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TREA.value, sub_mode=TreatmentStates.TREATMENT_DIALYSIS_STATE.value) utils.waitForGUI(1) - hd_simulator.cmd_set_treatment_states_data(sub_mode = 1, 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) - 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) + hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_BLOOD_PRIME_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) + hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_DIALYSIS_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) def set_parameter_type(text): """ @@ -718,7 +689,7 @@ end_time = time.time() total_elapsed_time = end_time - start_time test.log("Total elapsed time : {}".format(total_elapsed_time)) - test.compare(bp_uom.text, BLOOD_PRESSURE_UNIT, "{} should displayed when pop up is closed".format(BLOOD_PRESSURE_UNIT)) + test.compare(bp_uom.text, config.BLOOD_PRESSURE_UNIT, "{} should displayed when pop up is closed".format(config.BLOOD_PRESSURE_UNIT)) test.endSection() def verify_vitals_pop_up_is_opened_automatically_after_an_interval(interval): @@ -741,18 +712,18 @@ close_btn = waitForObject(names.o_vitals_close_btn) total_elapsed_time = end_time - start_time test.log("Total elapsed time : {}".format(total_elapsed_time)) - test.compare(close_btn.visible, VISIBLE, "Dialog close button should be visible after the vitals pop up is opened automatically") + test.compare(close_btn.visible, config.VISIBLE, "Dialog close button should be visible after the vitals pop up is opened automatically") test.endSection() def main(): utils.tstStart(__file__) - startApplication(AUT_NAME) + startApplication(config.AUT_NAME) 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) + hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_DIALYSIS_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) hd_simulator.cmd_set_treatment_parameter_ranges(min_treatment_duration=0, max_treatment_duration=480, min_uf_volume=0.0, max_uf_volume=8000.0, @@ -762,65 +733,35 @@ utils.waitForGUI(1) open_vitals_pop_up() - verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_120, - dia_val=DIASTOLIC_PRESSSURE_80, - heart_rate=HEART_RATE_VAL_101, - save=True) + verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_120, dia_val=DIASTOLIC_PRESSSURE_80, heart_rate=HEART_RATE_VAL_101, save=True) utils.waitForGUI(1) open_vitals_pop_up() - verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_120, - input_field=names.o_pop_up_systolic_input_field, - vital=SYSTOLIC_TEXT) - verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_80, - input_field=names.o_pop_up_diastolic_input_field, - vital=DIASTOLIC_TEXT) - verify_entered_value_in_pop_up(value=HEART_RATE_VAL_101, - input_field=names.o_pop_up_heart_rate_input_field, - vital=HEART_RATE_TITLE) - verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_175, - dia_val=DIASTOLIC_PRESSSURE_60, - heart_rate=HEART_RATE_VAL_85, - save=False) + verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_120,input_field=names.o_pop_up_systolic_input_field, vital=config.SYSTOLIC_TEXT) + verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_80, input_field=names.o_pop_up_diastolic_input_field, vital=config.DIASTOLIC_TEXT) + verify_entered_value_in_pop_up(value=HEART_RATE_VAL_101, input_field=names.o_pop_up_heart_rate_input_field, vital=config.HEART_RATE_TITLE) + verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_175, dia_val=DIASTOLIC_PRESSSURE_60, heart_rate=HEART_RATE_VAL_85, save=False) utils.waitForGUI(1) open_vitals_pop_up() - verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_175, - input_field=names.o_pop_up_systolic_input_field, - vital=SYSTOLIC_TEXT) - verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_60, - input_field=names.o_pop_up_diastolic_input_field, - vital=DIASTOLIC_TEXT) - verify_entered_value_in_pop_up(value=HEART_RATE_VAL_85, - input_field=names.o_pop_up_heart_rate_input_field, - vital=HEART_RATE_TITLE) - verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_113, - dia_val=DIASTOLIC_PRESSSURE_74, - heart_rate=HEART_RATE_VAL_70, - save=True) + verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_175, input_field=names.o_pop_up_systolic_input_field, vital=config.SYSTOLIC_TEXT) + verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_60, input_field=names.o_pop_up_diastolic_input_field, vital=config.DIASTOLIC_TEXT) + verify_entered_value_in_pop_up(value=HEART_RATE_VAL_85, input_field=names.o_pop_up_heart_rate_input_field, vital=config.HEART_RATE_TITLE) + verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_113, dia_val=DIASTOLIC_PRESSSURE_74, heart_rate=HEART_RATE_VAL_70, save=True) utils.waitForGUI(1) open_vitals_pop_up() - verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_113, - input_field=names.o_pop_up_systolic_input_field, - vital=SYSTOLIC_TEXT) - verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_74, - input_field=names.o_pop_up_diastolic_input_field, - vital=DIASTOLIC_TEXT) - verify_entered_value_in_pop_up(value=HEART_RATE_VAL_70, - input_field=names.o_pop_up_heart_rate_input_field, - vital=HEART_RATE_TITLE) - verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_200, - dia_val=DIASTOLIC_PRESSSURE_150, - heart_rate=HEART_RATE_VAL_60, - save=False) + verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_113, input_field=names.o_pop_up_systolic_input_field, vital=config.SYSTOLIC_TEXT) + verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_74, input_field=names.o_pop_up_diastolic_input_field, vital=config.DIASTOLIC_TEXT) + verify_entered_value_in_pop_up(value=HEART_RATE_VAL_70, input_field=names.o_pop_up_heart_rate_input_field, vital=config.HEART_RATE_TITLE) + verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_200,dia_val=DIASTOLIC_PRESSSURE_150, heart_rate=HEART_RATE_VAL_60, save=False) utils.waitForGUI(1) open_vitals_pop_up() - verify_ranges_of_vital(vital_parameter=SYSTOLIC_TEXT) - verify_ranges_of_vital(vital_parameter=DIASTOLIC_TEXT) - verify_ranges_of_vital(vital_parameter=HEART_RATE_TITLE) + verify_ranges_of_vital(vital_parameter=config.SYSTOLIC_TEXT) + verify_ranges_of_vital(vital_parameter=config.DIASTOLIC_TEXT) + verify_ranges_of_vital(vital_parameter=config.HEART_RATE_TITLE) - verify_the_color_of_out_of_range(vital_parameter=SYSTOLIC_TEXT) - verify_the_color_of_out_of_range(vital_parameter=DIASTOLIC_TEXT) - verify_the_color_of_out_of_range(vital_parameter=HEART_RATE_TITLE) + verify_the_color_of_out_of_range(vital_parameter=config.SYSTOLIC_TEXT) + verify_the_color_of_out_of_range(vital_parameter=config.DIASTOLIC_TEXT) + verify_the_color_of_out_of_range(vital_parameter=config.HEART_RATE_TITLE) verify_interval_for_bpm()