Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r7d316b6ea5f8bfeeea912930b6ab587ec8ad5868 -r0917bcb39a7346b452e56e961d19c928a71ef608 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 7d316b6ea5f8bfeeea912930b6ab587ec8ad5868) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 0917bcb39a7346b452e56e961d19c928a71ef608) @@ -1,7 +1,10 @@ import squish import test import object +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): @@ -37,7 +40,7 @@ names.o_text_object["text"] = txt return names.o_text_object -def set_parameter_type(text,obj): +def set_property_text(text,obj): """ Method to set object property based on text @param text : (string) treatment parameter text @@ -104,26 +107,18 @@ test.log(f"✅ Target value reached: {current_value}") -def custom_object_for_combo_box(text): - """ - Method to set custom object property for export option - @param text : (string) parameter text - """ - names.o_option_combo_box["text"] = text - return names.o_option_combo_box - def select_different_dropdown(object,type,whichTypeIndex): - type_combo_box = utility.get_object_from_names(object, error_message="Combo box object is missing") + type_combo_box = get_object_from_names(object, error_message="Combo box object is missing") if type_combo_box is not None: squish.mouseClick(squish.waitForObjectExists(object)) - type_option = utility.get_object_from_names(custom_object_for_combo_box(type[whichTypeIndex]),error_message=f"Option {DIALYZER_TYPE[whichTypeIndex]} object is missing",timeout_ms=5000) + type_option = get_object_from_names(set_property_text(obj = names.o_option_combo_box,text = type[whichTypeIndex]),error_message=f"Option {type[whichTypeIndex]} object is missing",timeout_ms=5000) if type_option is not None: squish.mouseClick(type_option) return True return False # default return if not successful -def set_value_with_slider(value_field_obj, slider_obj): +def set_value_with_slider(value_field_obj, slider_obj,parameter): """ Opens the slider and moves it gradually to the target value (step of 10). Uses controlled arrow key input for fine adjustment. @@ -134,37 +129,37 @@ test.log(f"Opening slider for {parameter}...") # Try right-click first - mousePress(value_field, Qt.LeftButton) - utils.waitForGUI(0.2) + 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...") - mousePress(value_field, Qt.LeftButton) - snooze(1) + squish.mousePress(value_field, squish.Qt.LeftButton) + # utils.waitForGUI(1) if not object.exists(slider_obj): test.fail(f"{parameter}: Slider did not appear.") slider = waitForObject(slider_obj) test.log(f"{parameter}: Slider appeared successfully.") - mousePress(slider,Qt.LeftButton) + squish.mousePress(slider,squish.Qt.LeftButton) final_value = waitForObject(value_field_obj).value test.verify(final_value!= value, f"{parameter} slider adjusted correctly to {final_value}") - mouseRelease(slider, Qt.LeftButton) - utils.waitForGUI(0.2) + 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) + # utils.waitForGUI(0.2) except LookupError as e: test.fail(f"{parameter}: LookupError - {e}") def click_left_until_off(object_name): parent_obj = waitForObject(object_name) - left_arrow = utility.findObjectById(object,parent_obj, "_leftArrow") + left_arrow = findObjectById(parent_obj, "_leftArrow") # Loop until the value becomes "off" while findObject(object_name).value != 0.0: - mouseClick(waitForObject(left_arrow)) + squish.mouseClick(waitForObject(left_arrow)) utils.waitForGUI(0.2) # Small delay to allow UI to update \ No newline at end of file