Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rdc699ba85fda9e7196a496a1b5ee79a3ea248be1 -r3cf9dbe47566f44e8b0186297be4ccbb029678f0 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision dc699ba85fda9e7196a496a1b5ee79a3ea248be1) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 3cf9dbe47566f44e8b0186297be4ccbb029678f0) @@ -172,7 +172,6 @@ test.log(f"✅ Target value reached: {current_value}") - def select_different_dropdown(object,type,whichTypeIndex): """ Selects a value from a dropdown using a doc string. @@ -377,3 +376,69 @@ except LookupError: test.fail("ERROR : " + error_message) return None + +def keyboard_object_map_helper(text): + """ + Method for setting custom object property's for keyboard keys + @return: required object property's for keys + """ + if text is not None: + names.keyboard_input["text"] = text + return names.keyboard_input + else: + test.log("Invalid ", text, " for object.") + names.o_keyboard_input["text"] = "Q" + +def verify_valid_vitals_through_keypad( + title_name, input_field_obj, expected_value, actual_value +): + """ + Tests verifies valid patient id set through application keyboard setup . + @return: N/A + """ + input_field = squish.waitForObject(input_field_obj) + squish.mouseClick(input_field) + + for text in expected_value: + keyboard_value = keyboard_object_map_helper(text) + utils.waitForGUI(0.2) + squish.mouseClick(squish.waitForObjectExists(keyboard_value)) + utils.waitForGUI(0.2) + +def set_value_based_on_target_patientvitals(obj, target_value): + """ + obj: dictionary containing object paths + Example: + { + "value_obj": ":mainTreatmentScreen.PressureText", + "left_arrow": ":mainTreatmentScreen.LeftArrow", + "right_arrow": ":mainTreatmentScreen.RightArrow" + } + + target_value: integer or string number, e.g. 220 + """ + target_value = target_value + + # Wait for all objects + parent_obj = squish.waitForObjectExists(obj) + # change range as per your screen count + + left_arrow = findObjectById(parent_obj, "_leftArrow") + right_arrow = findObjectById(parent_obj, "_rightArrow") + + # Read current value (supports invisible text too) + parent = squish.waitForObject(parent_obj) + current_value = findObjectById(parent, "_currentItem") + current_value = str(current_value.text) + + # Determine direction + while float(current_value) != float(target_value): + if float(current_value) < float(target_value): + squish.mouseClick(squish.waitForObject(right_arrow)) + + elif float(current_value) > float(target_value): + squish.mouseClick(squish.waitForObject(left_arrow)) + + parent = squish.waitForObject(parent_obj) + current_value = findObjectById(parent, "_currentItem") + current_value = str(current_value.text)