Index: tst_main_treatment_pressure/test.py =================================================================== diff -u -r3875e7eedf54949d63d04e8c88b34e76d02d31ed -r8b2acf92efde9ddbeb292e0fb420b595dbd8c618 --- tst_main_treatment_pressure/test.py (.../test.py) (revision 3875e7eedf54949d63d04e8c88b34e76d02d31ed) +++ tst_main_treatment_pressure/test.py (.../test.py) (revision 8b2acf92efde9ddbeb292e0fb420b595dbd8c618) @@ -8,7 +8,7 @@ # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_main_treatment_pressure -# date 18/feb/2022 +# date 02/25/2022 # author Papiya Mandal import names @@ -18,9 +18,7 @@ from configuration.utility import * from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator -from reportlab.graphics.samples.excelcolors import color10Light - in_range_color = "#ffffff" out_of_range_color = "#c53b33" ART_LOW_VAL_MINUS_120 = -120 @@ -31,6 +29,7 @@ ART_HIGH_VAL_70 = 70 ART_LOW_VAL_MINUS_80 = -80 ART_HIGH_VAL_175 = 175 +BUFFER_LOW_AND_HIGH_LIMITS = 30 VENOUS_LOW_VAL_MINUS_200 = -200 VENOUS_HIGH_VAL_150 = 150 VENOUS_LOW_VAL_MINUS_310 = -310 @@ -39,16 +38,13 @@ VENOUS_HIGH_VAL_300 = 300 VENOUS_LOW_VAL_110 = 110 VENOUS_HIGH_VAL_250 = 250 -VAL_MINUS_100 = -100 -VAL_MINUS_250 = -250 -VAL_MINUS_120 = -120 -VAL_MINUS_270 = -270 -VAL_MINUS_300 = -300 -VAL_0 = 0 +ARTERIAL_LOW_SLIDER_VALS = [-200, -100, -250, -270, -300] +ARTERIAL_HIGH_SLIDER_VALS = [-100, -90, -110, -250, 0] +VENOUS_HIGH_SLIDER_VALS = [500, 550, 200, 600] +VENOUS_LOW_SLIDER_VALS = [500, 200, 50, 20] + +hd_simulator = HDSimulator() - -hd = HDSimulator() - def verify_arterial_and_venous_value_in_main_treatment_screen(accepted, art_low, art_high, ven_low, ven_high): """ @@ -63,41 +59,36 @@ @return: none """ - test.startSection("Verifying Arterial low and high " + - "and Venous low and high value on main treatment screen") + test.startSection("Verifying Arterial low and high and Venous low and high value on main treatment screen") if accepted==ACCEPTED: - arterial_low = waitForObject(names.pressure_text_obj(text=art_low)) + arterial_low = waitForObject(pressure_text_obj(art_low)) arterial_low = arterial_low.text.toInt() - arterial_high = waitForObject(names.pressure_text_obj(text=art_high)) + arterial_high = waitForObject(pressure_text_obj(art_high)) arterial_high = arterial_high.text.toInt() - venous_low = waitForObject(names.pressure_text_obj(text=ven_low)) + venous_low = waitForObject(pressure_text_obj(ven_low)) venous_low = venous_low.text.toInt() - venous_high = waitForObject(names.pressure_text_obj(text=ven_high)) + venous_high = waitForObject(pressure_text_obj(ven_high)) venous_high = venous_high.text.toInt() test.compare(arterial_low, art_low, - "Arterial low value should be " + - "'{low_val}'".format(low_val=art_low)) + "Arterial low value should be '{}'".format(art_low)) test.compare(arterial_high, art_high, - "Arterial high value should be " + - "'{high_val}'".format(high_val=art_high)) + "Arterial high value should be '{}'".format(art_high)) test.compare(venous_low, ven_low, - "Venous low value should be " + - "'{low_val}'".format(low_val=ven_low)) + "Venous low value should be '{}'".format(ven_low)) test.compare(venous_high, ven_high, - "Venous high value should not be " + - "'{high_val}'".format(high_val=ven_high)) - elif accepted==REJECTED: - if object.exists(names.pressure_text_obj(text=art_low)): - test.fail("{art_low} should not exists".format(art_low=art_low)) - if object.exists(names.pressure_text_obj(text=art_high)): - test.fail("{art_high} should not exists".format(art_high=art_high)) - if object.exists(names.pressure_text_obj(text=ven_low)): - test.fail("{ven_low} should not exists".format(ven_low=ven_low)) - if object.exists(names.pressure_text_obj(text=ven_high)): - test.fail("{ven_high} should not exists".format(ven_high=ven_high)) + "Venous high value should not be '{}'".format(ven_high)) + else: + if object.exists(pressure_text_obj(art_low)): + test.fail("{} should not exists".format(art_low)) + if object.exists(pressure_text_obj(art_high)): + test.fail("{} should not exists".format(art_high)) + if object.exists(pressure_text_obj(ven_low)): + test.fail("{} should not exists".format(ven_low)) + if object.exists(pressure_text_obj(ven_high)): + test.fail("{} should not exists".format(ven_high)) test.endSection() @@ -107,31 +98,26 @@ and verify the arterial and venous scale minimum and maximum range value """ - test.startSection("Open the pressure pop up and verify " + - "the arterial and venous scale minimum and maximum range value") + test.startSection("Open the pressure pop up and verify the arterial and venous scale minimum and maximum range value") open_pressure_pop_up() arterial_scale = waitForObject(names.o_arterial_range_slider) arterial_scale_min = arterial_scale.minimum arterial_scale_max = arterial_scale.maximum test.log("Verifying Arterial scale range minimum value") test.compare(arterial_scale_min, ARTERIAL_PRESSURE_MINIMUM, - "Arterial scale range minimum value should be " + - "{min}".format(min=ARTERIAL_PRESSURE_MINIMUM)) + "Arterial scale range minimum value should be {}".format(ARTERIAL_PRESSURE_MINIMUM)) test.log("Verifying Arterial scale range maximum value") test.compare(arterial_scale_max, ARTERIAL_PRESSURE_MAXIMUM, - "Arterial scale range maximum value should be " + - "{max}".format(max=ARTERIAL_PRESSURE_MAXIMUM)) + "Arterial scale range maximum value should be {}".format(ARTERIAL_PRESSURE_MAXIMUM)) venous_scale = waitForObject(names.o_venous_range_slider) venous_scale_min = venous_scale.minimum venous_scale_max = venous_scale.maximum test.log("Verifying Venous scale range minimum value") test.compare(venous_scale_min, VENOUS_PRESSURE_MINIMUM, - "Venous scale range minimum value should be " + - "{min}".format(min=VENOUS_PRESSURE_MINIMUM)) + "Venous scale range minimum value should be {}".format(VENOUS_PRESSURE_MINIMUM)) test.log("Verifying Arterial scale range maximum value") test.compare(venous_scale_max, VENOUS_PRESSURE_MAXIMUM, - "Venous scale range maximum value should be " + - "{max}".format(max=VENOUS_PRESSURE_MAXIMUM)) + "Venous scale range maximum value should be {}".format(VENOUS_PRESSURE_MAXIMUM)) close_the_pop_up() test.endSection() @@ -140,35 +126,32 @@ """ Method to set the Arterial range maximum value to user expected value - @param art_low - user expected value + @param art_low - (int) user expected value """ - test.startSection("Set Arterial range minimum value " + - "to {val}".format(val=art_low)) + test.startSection("Set Arterial range minimum value to {}".format(art_low)) arterial_min = waitForObjectExists(names.o_arterial_limitbar) arterial_min = pyInt(arterial_min.minimum) arterial_max = waitForObjectExists(names.o_arterial_limitbar) arterial_max = pyInt(arterial_max.maximum) - low_handler_parent = object.parent(\ - waitForObjectExists(names.o_arterial_text_low)) + low_handler_parent = object.parent(waitForObjectExists(names.o_arterial_text_low)) low_handler_children = object.children(low_handler_parent) low_handler = low_handler_children[-2] width = pyInt(low_handler.width) height = pyInt(low_handler.height) - width = width - 15 + #adjusting the width and height of arterial low limit slider to click on the center of the object + width = width - 15 height = height - 10 if arterial_min == art_low: - test.passes("Arterial range minimum is already set to " + - "{minimum}".format(minimum=art_low)) + test.passes("Arterial range minimum is already set to {}".format(art_low)) elif arterial_min < art_low: while arterial_min != art_low: mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) arterial_min += 10 - if arterial_min == arterial_max - 30: + if arterial_min == arterial_max - BUFFER_LOW_AND_HIGH_LIMITS: # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Arterial range minimum value cannot be " + - "moved beyond {min}".format(min=arterial_min)) + test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) break else: continue @@ -177,58 +160,52 @@ mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) arterial_min -= 10 - if arterial_min == arterial_max - 30: + if arterial_min == arterial_max - BUFFER_LOW_AND_HIGH_LIMITS: # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Arterial range minimum value cannot be " + - "moved beyond {min}".format(min=arterial_min)) + test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) break else: continue - if arterial_min == arterial_max - 30: - test.passes("Arterial range minimum value cannot be " + - "moved beyond {min}".format(min=arterial_min)) + if arterial_min == arterial_max - BUFFER_LOW_AND_HIGH_LIMITS: # arterial blood pressure low limit should be lower than the high limit by atleast 30mmHg + test.compare(waitForObjectExists(names.o_arterial_limitbar).minimum, arterial_min, + "Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) else: test.compare(arterial_min, art_low, - "Actual Arterial range minimum value: " + - "{min_range} is ".format(min_range=arterial_min) + - "equal to Expected value: {exp}".format(exp=art_low)) + "Actual Arterial range minimum value: {} is equal to Expected value: {}".format(arterial_min, art_low)) test.endSection() def set_arterial_ranges_max_val(art_high): """ Method to set the Arterial range maximum value to user expected value - @param art_high - user expected value + @param art_high - (int) user expected value """ - test.startSection("Set Arterial range maximum value " + - "to {val}".format(val=art_high)) + test.startSection("Set Arterial range maximum value to {}".format(art_high)) arterial_max = waitForObjectExists(names.o_arterial_limitbar) arterial_max = pyInt(arterial_max.maximum) arterial_min = waitForObjectExists(names.o_arterial_limitbar) arterial_min = pyInt(arterial_min.minimum) - high_handler_parent = object.parent(\ - waitForObjectExists(names.o_arterial_text_low)) + high_handler_parent = object.parent(waitForObjectExists(names.o_arterial_text_low)) high_handler_children = object.children(high_handler_parent) high_handler = high_handler_children[-1] width = pyInt(high_handler.width) - height = pyInt(high_handler.height) + height = pyInt(high_handler.height) + #adjusting the width and height of arterial high limit slider to click on the center of the object width = width - 15 height = height - 10 if arterial_max == art_high: - test.passes("Arterial range maximum is already set to " + - "{maximum}".format(maximum=art_high)) + test.passes("Arterial range maximum is already set to {}".format(art_high)) elif arterial_max < art_high: while arterial_max != art_high: mouseDrag(high_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) arterial_max += 10 - if arterial_max == arterial_min + 30: + if arterial_max == arterial_min + BUFFER_LOW_AND_HIGH_LIMITS: # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg mouseDrag(high_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Arterial range maximum value cannot be " + - "moved beyond {max}".format(max=arterial_max)) + test.log("Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) break else: continue @@ -237,58 +214,52 @@ mouseDrag(high_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) arterial_max -= 10 - if arterial_max == arterial_min + 30: + if arterial_max == arterial_min + BUFFER_LOW_AND_HIGH_LIMITS: # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg mouseDrag(high_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Arterial range maximum value cannot be " + - "moved beyond {max}".format(max=arterial_max)) + test.log("Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) break else: continue - if arterial_max == arterial_min + 30: - test.passes("Arterial range maximum value cannot be " + - "moved beyond {max}".format(max=arterial_max)) + if arterial_max == arterial_min + BUFFER_LOW_AND_HIGH_LIMITS: # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg + test.compare(waitForObjectExists(names.o_arterial_limitbar).maximum, 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: " + - "{max_range} is ".format(max_range=arterial_max) + - "equal to Expected value: {exp}".format(exp=art_high)) + "Actual Arterial range maximum value: {} is equal to Expected value: {}".format(arterial_max, art_high)) test.endSection() def set_venous_ranges_min_val(ven_low): """ Method to set the Venous range maximum value to user expected value - @param ven_low - user expected value + @param ven_low - (int) user expected value """ - test.startSection("Set Venous range minimum value " + - "to {val}".format(val=ven_low)) + test.startSection("Set Venous range minimum value to {}".format(ven_low)) ven_min = waitForObjectExists(names.o_venous_limitbar) ven_min = pyInt(ven_min.minimum) ven_max = waitForObjectExists(names.o_venous_limitbar) ven_max = pyInt(ven_max.maximum) - low_handler_parent = object.parent(\ - waitForObjectExists(names.o_venous_text_low)) + low_handler_parent = object.parent(waitForObjectExists(names.o_venous_text_low)) low_handler_children = object.children(low_handler_parent) low_handler = low_handler_children[-2] width = pyInt(low_handler.width) - height = pyInt(low_handler.height) + height = pyInt(low_handler.height) + #adjusting the width and height of venous low limit slider to click on the center of the object width = width - 15 height = height - 10 if ven_min == ven_low: - test.passes("Venous range minimum is already set to " + - "{minimum}".format(minimum=ven_low)) + test.passes("Venous range minimum is already set to {}".format(ven_low)) elif ven_min < ven_low: while ven_min != ven_low: mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) ven_min += 10 - if ven_min == ven_max - 30: + if ven_min == ven_max - BUFFER_LOW_AND_HIGH_LIMITS: # venous blood pressure low limit should be lower than the high limit by at least 30mmHg mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Venous range minimum value cannot be " + - "moved beyond {min}".format(min=ven_min)) + test.log("Venous range minimum value cannot be moved beyond {}".format(ven_min)) break else: continue @@ -297,58 +268,52 @@ mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) ven_min -= 10 - if ven_min == ven_max - 30: + if ven_min == ven_max - BUFFER_LOW_AND_HIGH_LIMITS: # venous blood pressure low limit should be lower than the high limit by at least 30mmHg mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Venous range minimum value cannot be " + - "moved beyond {min}".format(min=ven_min)) + test.log("Venous range minimum value cannot be moved beyond {}".format(ven_min)) break else: continue - if ven_min == ven_max - 30: - test.passes("Venous range minimum value cannot be " + - "moved beyond {min}".format(min=ven_min)) + if ven_min == ven_max - BUFFER_LOW_AND_HIGH_LIMITS: # venous blood pressure low limit should be lower than the high limit by at least 30mmHg + test.compare(waitForObjectExists(names.o_venous_limitbar).minimum, 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: " + - "{min_range} is ".format(min_range=ven_min) + - "equal to Expected value: {exp}".format(exp=ven_low)) + "Actual Venous range minimum value: {} is equal to Expected value: {}".format(ven_min, ven_low)) test.endSection() def set_venous_ranges_max_val(ven_high): """ Method to set the Venous range maximum value to user expected value - @param art_high - user expected value + @param ven_high - (int) user expected value """ - test.startSection("Set Venous range maximum value " + - "to {val}".format(val=ven_high)) + test.startSection("Set Venous range maximum value to {}".format(ven_high)) ven_max = waitForObjectExists(names.o_venous_limitbar) ven_max = pyInt(ven_max.maximum) ven_min = waitForObjectExists(names.o_venous_limitbar) ven_min = pyInt(ven_min.minimum) - high_handler_parent = object.parent(\ - waitForObjectExists(names.o_venous_text_low)) + high_handler_parent = object.parent(waitForObjectExists(names.o_venous_text_low)) high_handler_children = object.children(high_handler_parent) high_handler = high_handler_children[-1] width = pyInt(high_handler.width) height = pyInt(high_handler.height) + #adjusting the width and height of venous high limit slider to click on the center of the object width = width - 15 height = height - 10 if ven_max == ven_high: - test.passes("Venous range maximum is already set to " + - "{maximum}".format(maximum=ven_high)) + test.passes("Venous range maximum is already set to {}".format(ven_high)) elif ven_max < ven_high: while ven_max != ven_high: mouseDrag(high_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) ven_max += 10 - if ven_max == ven_min + 30: + if ven_max == ven_min + BUFFER_LOW_AND_HIGH_LIMITS: # venous blood pressure low limit should be lower than the high limit by at least 30mmHg mouseDrag(high_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Venous range maximum value cannot be " + - "moved beyond {max}".format(max=ven_max)) + test.log("Venous range maximum value cannot be moved beyond {}".format(ven_max)) break else: continue @@ -357,22 +322,19 @@ mouseDrag(high_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) ven_max -= 10 - if ven_max == ven_min + 30: + if ven_max == ven_min + BUFFER_LOW_AND_HIGH_LIMITS: # venous blood pressure low limit should be lower than the high limit by at least 30mmHg mouseDrag(high_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Venous range maximum value cannot be " + - "moved beyond {max}".format(max=ven_max)) + test.log("Venous range maximum value cannot be moved beyond {}".format(ven_max)) break else: continue - if ven_max == ven_min + 30: - test.passes("Venous range maximum value cannot be " + - "moved beyond {max}".format(max=ven_max)) + if ven_max == ven_min + BUFFER_LOW_AND_HIGH_LIMITS: # venous blood pressure low limit should be lower than the high limit by at least 30mmHg + test.compare(waitForObjectExists(names.o_venous_limitbar).maximum, ven_max, + "Venous range maximum value cannot be moved beyond {}".format(ven_max)) else: test.compare(ven_max, ven_high, - "Actual Venous range maximum value: " + - "{max_range} is ".format(max_range=ven_max) + - "equal to Expected value: {exp}".format(exp=ven_high)) + "Actual Venous range maximum value: {} is equal to Expected value: {}".format(ven_max, ven_high)) test.endSection() @@ -381,25 +343,12 @@ Method to set the arterial low and high limits using slider """ - test.startSection("Set the arterial low and " + - "high limits using slider") + test.startSection("Set the arterial low and high limits using slider") open_pressure_pop_up() - utils.waitForGUI(1) - set_arterial_ranges_max_val(art_high=VAL_MINUS_100) - utils.waitForGUI(1) - set_arterial_ranges_min_val(art_low=VAL_MINUS_250) - utils.waitForGUI(1) - set_arterial_ranges_max_val(art_high=VAL_MINUS_250) - utils.waitForGUI(1) - set_arterial_ranges_max_val(art_high=VAL_MINUS_120) - utils.waitForGUI(1) - set_arterial_ranges_min_val(art_low=VAL_MINUS_270) - utils.waitForGUI(1) - set_arterial_ranges_min_val(art_low=VAL_MINUS_120) - utils.waitForGUI(1) - set_arterial_ranges_min_val(art_low=VAL_MINUS_300) - utils.waitForGUI(1) - set_arterial_ranges_max_val(art_high=VAL_0) + for index in range(len(ARTERIAL_HIGH_SLIDER_VALS)): + set_arterial_ranges_max_val(ARTERIAL_HIGH_SLIDER_VALS[index]) + utils.waitForGUI(1) + set_arterial_ranges_min_val(ARTERIAL_LOW_SLIDER_VALS[index]) close_the_pop_up() test.endSection() @@ -409,25 +358,13 @@ Method to set the venous low and high limits using slider """ - test.startSection("Set the venous low and " + - "high limits using slider") + test.startSection("Set the venous low and high limits using slider") open_pressure_pop_up() utils.waitForGUI(1) - set_venous_ranges_max_val(ven_high=500) - utils.waitForGUI(1) - set_venous_ranges_min_val(ven_low=500) - utils.waitForGUI(1) - set_venous_ranges_min_val(ven_low=50) - utils.waitForGUI(1) - set_venous_ranges_max_val(ven_high=200) - utils.waitForGUI(1) - set_venous_ranges_max_val(ven_high=450) - utils.waitForGUI(1) - set_venous_ranges_min_val(ven_low=450) - utils.waitForGUI(1) - set_venous_ranges_min_val(ven_low=20) - utils.waitForGUI(1) - set_venous_ranges_max_val(ven_high=600) + for index in range(len(VENOUS_HIGH_SLIDER_VALS)): + set_venous_ranges_max_val(VENOUS_HIGH_SLIDER_VALS[index]) + utils.waitForGUI(1) + set_venous_ranges_min_val(VENOUS_LOW_SLIDER_VALS[index]) close_the_pop_up() test.endSection() @@ -447,48 +384,42 @@ @return: none """ - test.startSection("Verifying Arterial low and high " + - "and Venous low and high value on pressure pop up screen") - arterial_low = waitForObject(names.pressure_pop_up_text_obj(text=art_low)) + test.startSection("Verifying Arterial low and high and Venous low and high value on pressure pop up screen") + arterial_low = waitForObject(pressure_pop_up_text_obj(art_low)) arterial_low = arterial_low.text.toInt() - arterial_high = waitForObject(names.pressure_pop_up_text_obj(text=art_high)) + arterial_high = waitForObject(pressure_pop_up_text_obj(art_high)) arterial_high = arterial_high.text.toInt() - venous_low = waitForObject(names.pressure_pop_up_text_obj(text=ven_low)) + venous_low = waitForObject(pressure_pop_up_text_obj(ven_low)) venous_low = venous_low.text.toInt() - venous_high = waitForObject(names.pressure_pop_up_text_obj(text=ven_high)) + venous_high = waitForObject(pressure_pop_up_text_obj(ven_high)) venous_high = venous_high.text.toInt() if accepted==ACCEPTED: test.compare(arterial_low, art_low, - "Arterial low value should be " + - "'{low_val}'".format(low_val=art_low)) + "Arterial low value should be '{}'".format(art_low)) test.compare(arterial_high, art_high, - "Arterial high value should be " + - "'{high_val}'".format(high_val=art_high)) + "Arterial high value should be '{}'".format(art_high)) test.compare(venous_low, ven_low, - "Venous low value should be " + - "'{low_val}'".format(low_val=ven_low)) + "Venous low value should be '{}'".format(ven_low)) test.compare(venous_high, ven_high, - "Venous high value should be " + - "'{high_val}'".format(high_val=ven_high)) - elif accepted==REJECTED: - if object.exists(names.pressure_text_obj(text=art_low)): - test.fail("{art_low} should not exists".format(art_low=art_low)) - if object.exists(names.pressure_text_obj(text=art_high)): - test.fail("{art_high} should not exists".format(art_high=art_high)) - if object.exists(names.pressure_text_obj(text=ven_low)): - test.fail("{ven_low} should not exists".format(ven_low=ven_low)) - if object.exists(names.pressure_text_obj(text=ven_high)): - test.fail("{ven_high} should not exists".format(ven_low=ven_high)) + "Venous high value should be '{}'".format(ven_high)) + else: + if object.exists(pressure_text_obj(art_low)): + test.fail("{art_low} should not exists".format(art_low)) + if object.exists(pressure_text_obj(art_high)): + test.fail("{} should not exists".format(art_high)) + if object.exists(pressure_text_obj(ven_low)): + test.fail("{} should not exists".format(ven_low)) + if object.exists(pressure_text_obj(ven_high)): + test.fail("{} should not exists".format(ven_high)) verify_reject_msg_on_pop_up(reason_id) test.endSection() -def set_arterial_and_venous_pressure(accepted, reason, \ - art_low, art_high, ven_low, ven_high): +def set_arterial_and_venous_pressure(accepted, reason, art_low, art_high, ven_low, ven_high): """ Method to set the Arterial and Venous high and low pressure value @@ -500,18 +431,13 @@ @param venous_high: (int) Venous Pressure Limit High (mmHg) @return: none """ - test.startSection("Set Arterial Low to '{art_low}' ".format(art_low=art_low) + - "Arterial High to '{art_high}' ".format(art_high=art_high) + - "Venous Low to '{ven_low}' ".format(ven_low=ven_low) + - "and Venous High to '{ven_high}'".format(ven_high=ven_high)) - - hd.cmd_send_treatment_adjust_pressures_limit_response(accepted=accepted, + test.log("Set Arterial Low to '{art_low}', Arterial High to '{art_high}', Venous Low to '{ven_low}', and Venous High to '{ven_high}'".format(art_low=art_low, art_high=art_high, ven_low=ven_low, ven_high=ven_high)) + hd_simulator.cmd_send_treatment_adjust_pressures_limit_response(accepted=accepted, reason=reason, arterial_low=art_low, arterial_high=art_high, venous_low=ven_low, venous_high=ven_high) - test.endSection() def open_pressure_pop_up(): @@ -520,41 +446,34 @@ and verify pop is opened """ test.startSection("Open 'Pressure' pop up") - utils.waitForGUI(delay_s=2) + utils.waitForGUI(2) pressure_touch_area = object.parent(waitForObjectExists(names.o_arterial_title)) mouseClick(pressure_touch_area) test.log("Verifying 'pressure' pop up is opened") test.log("Verifying 'Pressure' title") - pressure_title = waitForObject(names.pressure_pop_up_text_obj(\ - text=PRESSURE_TITLE)) + pressure_title = waitForObject(pressure_pop_up_text_obj(PRESSURE_TITLE)) pressure_title = pressure_title.text.toUtf8().constData() test.compare(pressure_title, PRESSURE_TITLE, - "Pressure title should be '{title}'".format(title=PRESSURE_TITLE)) + "Pressure title should be '{}'".format(PRESSURE_TITLE)) - arterial_title = waitForObject(names.pressure_pop_up_text_obj(\ - text=ARTERIAL_TITLE)) + arterial_title = waitForObject(pressure_pop_up_text_obj(ARTERIAL_TITLE)) arterial_title = arterial_title.text.toUtf8().constData() test.compare(arterial_title, ARTERIAL_TITLE, - "Arterial title should be '{title}'".format(title=ARTERIAL_TITLE)) - art_uom = waitForObject(names.pressure_pop_up_text_obj(\ - text=ARTERIAL_UOM)) + "Arterial title should be '{}'".format(ARTERIAL_TITLE)) + art_uom = waitForObject(pressure_pop_up_text_obj(ARTERIAL_UOM)) art_uom = art_uom.text.toUtf8().constData() test.compare(art_uom, ARTERIAL_UOM, - "Arterial unit of measurement should be " + - "'{uom}'".format(uom=ARTERIAL_UOM)) + "Arterial unit of measurement should be '{}'".format(ARTERIAL_UOM)) - venous_title = waitForObject(names.pressure_pop_up_text_obj(\ - text=VENOUS_TITLE)) + venous_title = waitForObject(pressure_pop_up_text_obj(VENOUS_TITLE)) venous_title = venous_title.text.toUtf8().constData() test.compare(venous_title, VENOUS_TITLE, - "Venous title should be '{title}'".format(title=VENOUS_TITLE)) - ven_uom = waitForObject(names.pressure_pop_up_text_obj(\ - text=VENOUS_UOM)) + "Venous title should be '{}'".format(VENOUS_TITLE)) + ven_uom = waitForObject(pressure_pop_up_text_obj(VENOUS_UOM)) ven_uom = ven_uom.text.toUtf8().constData() test.compare(ven_uom, VENOUS_UOM, - "Venous unit of measurement should be " + - "'{uom}'".format(uom=VENOUS_UOM)) + "Venous unit of measurement should be '{}'".format(VENOUS_UOM)) test.endSection() @@ -567,14 +486,13 @@ """ Method verify the rejection message on pop up screen + @param reason_id - (int) reason id """ - test.startSection("Verify the rejection message " + - "on pop up screen") + test.startSection("Verify the rejection message on pop up screen") reason_msg = waitForObject(names.o_pop_up_rejected_msg) reason_msg = reason_msg.text.toUtf8().constData() test.compare(reason_msg, REJECTION_REASON[reason_id], - "{reason} should display on ".format(reason=REJECTION_REASON[reason_id]) - + "on pop up when values are rejected") + "{} should display on on pop up when values are rejected".format(REJECTION_REASON[reason_id])) test.endSection() @@ -585,19 +503,23 @@ and venous low and high pressure and verify the same on main-treatment screen and pressures pop up screen + @param accepted: (int) boolean accept/reject response + @param reason: (int) rejection reason + @param arterial_low: (int) Arterial Pressure Limit Low (mmHg) + @param arterial_high: (int) Arterial Pressure Limit High (mmHg) + @param venous_low: (int) Venous Pressure Limit Low (mmHg) + @param venous_high: (int) Venous Pressure Limit High (mmHg) + @return: none """ - test.startSection("Set the arterial low and high pressure " + - "and venous low and high pressure and verify the " + - "same on main-treatment screen and pressures " + - "pop up screen") + test.startSection("Set the arterial low and high pressure and venous low and high pressure and verify the same on main-treatment screen and pressures pop up screen") set_arterial_and_venous_pressure(accepted=accepted, reason=reason, art_low=art_low, art_high= art_high, ven_low=ven_low, ven_high=ven_high) verify_arterial_and_venous_value_in_main_treatment_screen(accepted=accepted, art_low=art_low, art_high= art_high, ven_low=ven_low, ven_high=ven_high) - utils.waitForGUI(delay_s=3) + utils.waitForGUI(3) open_pressure_pop_up() verify_arterial_and_venous_value_on_pressure_pop_up(accepted=accepted, reason_id=reason, art_low=art_low, art_high= art_high, @@ -612,35 +534,26 @@ """ test.startSection("Set arterial pressure and verify value and color") open_pressure_pop_up() - for arterial_prs in range(ARTERIAL_PRESSURE_MINIMUM , \ - ARTERIAL_PRESSURE_MAXIMUM + PRESSURE_STEPS, \ - PRESSURE_STEPS * 10): - test.log("Setting arterial pressure {prs}".format(prs=arterial_prs)) - hd.cmd_set_pressure_occlusion_data(arterial_prs=arterial_prs, venous_prs=0, + for arterial_prs in range(ARTERIAL_PRESSURE_MINIMUM , ARTERIAL_PRESSURE_MAXIMUM + PRESSURE_STEPS, PRESSURE_STEPS * 10): + test.log("Setting arterial pressure {}".format(arterial_prs)) + hd_simulator.cmd_set_pressure_occlusion_data(arterial_prs=arterial_prs, venous_prs=0, blood_pump_occlusion=0, dialysate_inlet_pump_occlusion=0, dialysate_outlet_pump_occlusion=0) arterial_current_value = waitForObjectExists(names.o_arterial_marker).value arterial_limit_min = waitForObjectExists(names.o_arterial_limitbar).minimum arterial_limit_max = waitForObjectExists(names.o_arterial_limitbar).maximum arterial_slider_value = waitForObjectExists(names.o_arterial_range_slider).value - test.compare(arterial_slider_value, arterial_prs, "Actual arterial pressure: " + - "{act} ".format(act=arterial_slider_value) + "should be equal to " + - "expected arterial pressure: {exp}".format(exp=arterial_prs)) + test.compare(arterial_slider_value, arterial_prs, "Actual arterial pressure: {} should be equal to expected arterial pressure: {}".format(arterial_slider_value, arterial_prs)) arterial_progress_value = waitForObjectExists(names.o_arterial_progress_text_value) test.compare(arterial_progress_value.text.toInt(), arterial_prs, - "Actual arterial pressure: " + "{act} ".format(\ - act=arterial_progress_value.text.toInt()) + - "should be equal to expected arterial " + - "pressure: {exp}".format(exp=arterial_prs)) + "Actual arterial pressure: {} should be equal to expected arterial pressure: {}".format(arterial_progress_value.text.toInt(), arterial_prs)) if arterial_limit_min <= arterial_current_value <= arterial_limit_max: test.compare(arterial_progress_value.color.name, in_range_color, - "Arterial progress value {val} is in range".format(\ - val=arterial_current_value)) + "Arterial progress value {} is in range".format(arterial_current_value)) else: test.compare(arterial_progress_value.color.name, out_of_range_color, - "Arterial progress value {val} is out of range".format(\ - val=arterial_current_value)) + "Arterial progress value {} is out of range".format(arterial_current_value)) close_the_pop_up() test.endSection() @@ -652,35 +565,26 @@ """ test.startSection("Set Venous pressure and verify value and color") open_pressure_pop_up() - for venous_prs in range(VENOUS_PRESSURE_MINIMUM, \ - VENOUS_PRESSURE_MAXIMUM + \ - PRESSURE_STEPS, PRESSURE_STEPS * 10): - test.log("Setting Venous pressure {prs}".format(prs=venous_prs)) - hd.cmd_set_pressure_occlusion_data(arterial_prs=0, venous_prs=venous_prs, + for venous_prs in range(VENOUS_PRESSURE_MINIMUM, VENOUS_PRESSURE_MAXIMUM + PRESSURE_STEPS, PRESSURE_STEPS * 10): + test.log("Setting Venous pressure {}".format(venous_prs)) + hd_simulator.cmd_set_pressure_occlusion_data(arterial_prs=0, venous_prs=venous_prs, blood_pump_occlusion=0, dialysate_inlet_pump_occlusion=0, dialysate_outlet_pump_occlusion=0) venous_current_value = waitForObjectExists(names.o_venous_marker).value venous_limit_min = waitForObjectExists(names.o_venous_limitbar).minimum venous_limit_max = waitForObjectExists(names.o_venous_limitbar).maximum venous_slider_value = waitForObjectExists(names.o_venous_range_slider).value - test.compare(venous_slider_value, venous_prs, "Actual venous pressure: " + - "{act} ".format(act=venous_slider_value) + "should be equal to " + - "expected venous pressure: {exp}".format(exp=venous_prs)) + test.compare(venous_slider_value, venous_prs, "Actual venous pressure: {} should be equal to expected venous pressure: {}".format(venous_slider_value, venous_prs)) venous_progress_value = waitForObjectExists(names.o_venous_progress_text_value) test.compare(venous_progress_value.text.toInt(), venous_prs, - "Actual venous pressure: " + "{act} ".format(\ - act=venous_progress_value.text.toInt()) + - "should be equal to expected venous " + - "pressure: {exp}".format(exp=venous_prs)) + "Actual venous pressure: {} should be equal to expected venous pressure: {}".format(venous_progress_value.text.toInt(), venous_prs)) if venous_limit_min <= venous_current_value <= venous_limit_max: test.compare(venous_progress_value.color.name, in_range_color, - "Venous progress value {val} is in range".format(\ - val=venous_current_value)) + "Venous progress value {} is in range".format(venous_current_value)) else: test.compare(venous_progress_value.color.name, out_of_range_color, - "Venous progress value {val} is out of range".format(\ - val=venous_current_value)) + "Venous progress value {} is out of range".format(venous_current_value)) close_the_pop_up() test.endSection() @@ -690,8 +594,8 @@ utils.tstStart(__file__) startApplication(AUT_NAME) - hd.cmd_send_power_on_self_test_version_request() - hd.cmd_set_treatment_states_data(sub_mode=2, uf_state=0, saline_state=0, + 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) @@ -719,5 +623,6 @@ verify_pressures_on_treatment_and_pop_up_screen(accepted=REJECTED, reason=21, art_low=ART_LOW_VAL_MINUS_30, art_high=ART_HIGH_VAL_100, ven_low=VENOUS_LOW_VAL_MINUS_390, ven_high=VENOUS_HIGH_VAL_300) + utils.tstDone()