Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r7efa97786e2bec643a1cb59ee33ca9cdaf9660b4 -r62ee1e1804a02e62964febd3618a660d080bb437 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 7efa97786e2bec643a1cb59ee33ca9cdaf9660b4) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 62ee1e1804a02e62964febd3618a660d080bb437) @@ -57,21 +57,7 @@ return True return False - -def pressure_pop_up_text_obj(text): - names.o_pop_up_pressure_text_obj["text"] = text - return names.o_pop_up_pressure_text_obj - -def pressure_text_obj(text): - names.o_pressure_text_obj["text"] = text - return names.o_pressure_text_obj -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): """ Method to enter user desired @@ -101,10 +87,6 @@ test.compare(str(input_field.text), "", "Input field should be empty") test.endSection() -def vitals_reading_obj(reading): - names.o_vitals_reading["text"] = reading - return names.o_vitals_reading - def keypad_input(key_value): names.o_keypad_input["text"] = key_value return names.o_keypad_input @@ -137,20 +119,7 @@ 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_alarm_id_obj(id): - names.o_alarm_id["text"] = id - return names.o_alarm_id -def get_alarm_msg_obj(msg): - names.o_alarm_message["text"] = msg - return names.o_alarm_message - -def rejection_msg(text): - names.o_rejection_msg["text"] = text - return names.o_rejection_msg - - def set_arterial_ranges_min_val(art_low): """ Method to set the Arterial range maximum value to user expected value @@ -340,37 +309,6 @@ 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): - """ - scroll to the to the value if object is hidden - @param value - (obj) value object - @param container - (obj) Container of the value - @return boolean true and false - """ - counter = 0 - while counter <= 100: - try: - counter += 1 - squish.findObject(value) - squish.snooze(0.5) - if check_if_object_is_within_the_container(obj=value, container=container): - return True - else: - raise RuntimeError - except RuntimeError: - ScreenObj = squish.waitForObject(container) - screenHeight = pyInt(ScreenObj.height) - screenWidth = pyInt(ScreenObj.width) - squish.mouseWheel(ScreenObj, screenWidth//2, screenHeight//2, 0, -50, squish.Qt.NoModifier) - - raise LookupError("value object is not in view to the user after trying 100 times") - - -def expected_heparin_value(val): - names.o_heparin_value["text"] = val - return names.o_heparin_value - - def msg(string): """ Added ### at the right side of the string to make sure that it is a message. @@ -509,99 +447,6 @@ squish.testSettings.objectNotFoundDebugging = True -def set_arterial_ranges_min_val(art_low): - """ - Method to set the Arterial range maximum value to user expected value - @param art_low - (int) user expected value - """ - test.startSection("Set Arterial range minimum value to {}".format(art_low)) - arterial_min = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) - arterial_min = pyInt(arterial_min.minimum) - arterial_max = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) - arterial_max = pyInt(arterial_max.maximum) - low_handler_parent = object.parent(squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery)) - low_handler_children = object.children(low_handler_parent) - low_handler = low_handler_children[-2] - width = pyInt(low_handler.width) - 8 - height = pyInt(low_handler.height)- 10 - if arterial_min == art_low: - test.passes("Arterial range minimum is already set to {}".format(art_low)) - elif arterial_min < art_low: - while arterial_min != art_low: - squish.mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - 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) - test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) - break - else: - continue - elif arterial_min > art_low: - while arterial_min != art_low: - squish.mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - 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) - test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) - break - else: - continue - # arterial blood pressure low limit should be lower than the high limit by atleast 30mmHg - if arterial_min == arterial_max - config.BUFFER_LOW_AND_HIGH_LIMITS: - test.compare(low_handler_parent.minValue, 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: {} 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 - (int) user expected value - """ - test.startSection("Set Arterial range maximum value to {}".format(art_high)) - arterial_max = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) - arterial_max = pyInt(arterial_max.maximum) - arterial_min = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) - arterial_min = pyInt(arterial_min.minimum) - high_handler_parent = object.parent(squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery)) - high_handler_children = object.children(high_handler_parent) - high_handler = high_handler_children[-1] - width = pyInt(high_handler.width) - 20 - height = pyInt(high_handler.height) - 25 - if arterial_max == art_high: - test.passes("Arterial range maximum is already set to {}".format(art_high)) - elif arterial_max < art_high: - while arterial_max != art_high: - squish.mouseDrag(high_handler, -1, height, width, 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) - 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) - 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) - 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)) - else: - test.compare(arterial_max, art_high, "Actual Arterial range maximum value: {} is equal to Expected value: {}".format(arterial_max, art_high)) - test.endSection() - def get_text_object(screen_obj, txt): """ To obtain a text object based on text provided @@ -612,34 +457,6 @@ names.o_text_object["text"] = txt return names.o_text_object -def verify_color_of_entry(entry, vital_parameter, input_field): - """ - Method to verify the color of entry - of systolic, diastolic and heart rate - @param entry: (int) user user entered value - @param vital_parameter - (str) parameter name under which user is entering value (sys/dia/heart rate) - @param input_field - (obj) object of input field - """ - test.startSection("Verify the color of {} value {}".format(vital_parameter, entry)) - input_field_color = input_field.color.name - entry = pyInt(entry) - 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() - def get_bullet_object(screen_obj, num): """ To obtain a bullet object based on occurrence provided. @@ -662,36 +479,7 @@ else: test.log("Invalid text for object.") names.o_keypad_input["text"] = None - - -def enter_keypad_value(entry): - """ - Method to enter user desired - value using keypad - @param entry: (str) User expected value - """ - test.startSection("Entering {}".format(entry)) - entry = pyStr(entry) #type casted into string format - for value in entry: - squish.mouseClick(squish.waitForObject(keypad_input(value))) - test.endSection() - - -def erase_entered_value(input_field): - """ - Method to erase the entered value - @param input_field - (obj) object of input field - """ - test.startSection("Erasing value") - input_field= squish.waitForObject(input_field) - entered_value = str(input_field.text) - for value in range(len(entered_value)+1): - utils.waitForGUI(1) - squish.mouseClick(squish.waitForObjectExists(names.o_back_space_key)) - - test.compare(str(input_field.text), "", "Input field should be empty") - test.endSection() - + def get_indicators(screen_obj, txt): """ Verifying the busy indicators for BiCarb Pump Check and Acid Pump Check.