Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r885d84508080eb00e01a756e33c5109c9da761fe -r31ee85c3b363ea427b129b8f8f640242f0ae6a03 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 885d84508080eb00e01a756e33c5109c9da761fe) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 31ee85c3b363ea427b129b8f8f640242f0ae6a03) @@ -4,8 +4,6 @@ import names from squish import * from leahi_dialin.ui import utils -from builtins import int as pyInt - def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ @@ -76,28 +74,22 @@ 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) try: current_value = round(float(findObject(obj).value),1) except LookupError: current_value = float(findObject(obj).property("value")) - # Determine direction while current_value != float(target_value): if current_value < float(target_value): squish.mouseClick(squish.waitForObject(right_arrow)) elif current_value > float(target_value): squish.mouseClick(squish.waitForObject(left_arrow)) - # Update current value after click + try: current_value = round(float(findObject(obj).value),1) except Exception: @@ -128,19 +120,17 @@ """ try: + value_field = waitForObject(value_field_obj) value_field = waitForObject(value_field_obj,1000) test.log(f"Opening slider for {parameter}...") - - # Try right-click first squish.mousePress(value_field, squish.Qt.LeftButton) - # utils.waitForGUI(0.2) value = value_field.value # If not visible, try left long-press if not object.exists(slider_obj): test.log(f"{parameter}: Slider not opened by left-click, trying long left-press...") squish.mousePress(value_field, squish.Qt.LeftButton) - # utils.waitForGUI(1) + if not object.exists(slider_obj): test.fail(f"{parameter}: Slider did not appear.") @@ -150,11 +140,11 @@ final_value = waitForObject(value_field_obj).value test.verify(final_value!= value, f"{parameter} slider adjusted correctly to {final_value}") squish.mouseRelease(slider, squish.Qt.LeftButton) - # utils.waitForGUI(0.2) + if object.exists(slider_obj): test.log(f"Waiting for {parameter} slider to close...") waitFor(lambda: not object.exists(slider_obj), 1000) - # utils.waitForGUI(0.2) + except LookupError as e: test.fail(f"{parameter}: LookupError - {e}") @@ -170,10 +160,4 @@ while findObject(object_name).value != 0.0: squish.mouseClick(waitForObject(left_arrow)) utils.waitForGUI(0.2) # Small delay to allow UI to update - -def button_text_obj(text): - """ - To get the text from Validate and confirm button - """ - names.o_PreTreatmentCreate_Text["text"] = text - return names.o_PreTreatmentCreate_Text + \ No newline at end of file