Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rf6d23e89ccf01b57313b0e920f013dc1027706d4 -r605b0d914ce80d7252b16dcadfd88c214d2fe236 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 605b0d914ce80d7252b16dcadfd88c214d2fe236) @@ -1,6 +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): """ @@ -14,9 +18,13 @@ test.fail("ERROR : " + error_message) return None -def setObjectText(obj, text): +def setObjectText(text,obj): + """ + Method to set object property based on text + @param text : (string) treatment parameter text + """ obj["text"] = text - return obj + return obj def findObjectById(parent, id): """ @@ -25,7 +33,7 @@ """ if str(parent.id) == id: return parent - + for child in object.children(parent): found = findObjectById(child, id) if found: @@ -40,3 +48,49 @@ found = findChildByText(child, target_text) if found: return found + + return None + +def set_value_based_on_target(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) + 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: + current_value = float(findObject(obj).property("value")) + + test.log(f"Updated value: {current_value}") + + test.log(f"✅ Target value reached: {current_value}") Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -rf6d23e89ccf01b57313b0e920f013dc1027706d4 -r605b0d914ce80d7252b16dcadfd88c214d2fe236 --- suite_leahi/shared/scripts/names.py (.../names.py) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 605b0d914ce80d7252b16dcadfd88c214d2fe236) @@ -60,6 +60,24 @@ o_InformationParameters = {"container": o_Overlay, "type": "Text", "unnamed": 1 } o_VersionColumn = {"container": o_Overlay, "id": "_versionColumn", "type": "Column", "unnamed": 1 } +#ultrafiltration +o_treatmentUltrafiltration = {"container": mainTreatmentScreen, "objectName": "treatmentUltrafiltration", "type": "TreatmentUltrafiltration" } +o_editButton_ultrafiltration_IconButton = {"container": o_treatmentUltrafiltration, "id": "_editButton", "type": "IconButton", "unnamed": 1 } +o_uf_Volume_LabelValue = {"container": mainTreatmentScreen, "id": "_ufVolume", "type": "LabelValue", "unnamed": 1 } +o_uf_Rate_LabelValue = {"container": mainTreatmentScreen, "id": "_ufRate", "type": "LabelValue", "unnamed": 1 } +o_volume_Delivered = {"container": mainTreatmentScreen, "id": "_valueText", "type": "Text", "unnamed": 1 } +o_ufVolumeRemovedItem_ValueItem = {"container": o_Overlay, "id": "_ufVolumeRemovedItem", "type": "ValueItem", "unnamed": 1 } +o_ufVolumeGoalItem_ValueItem = {"container": o_Overlay, "id": "_ufVolumeGoalItem", "type": "ValueItem", "unnamed": 1 } +o_editButton_TouchRect = {"container": o_Overlay, "objectName": "_editButton", "type": "TouchRect" } +o_volumeGoalAdjuster_ValueAdjuster = {"container": o_Overlay, "objectName": "_volumeGoalAdjuster", "type": "ValueAdjuster" } +o_continueButton_TouchRect = {"container": o_Overlay, "objectName": "_continueButton", "type": "TouchRect" } +o_newVolumeContainer_ValueContainer = {"container": o_Overlay, "objectName": "_newVolumeContainer", "type": "ValueContainer" } +o_newRateContainer_ValueContainer = {"container": o_Overlay, "objectName": "_newRateContainer", "type": "ValueContainer" } +o_confirmButton_TouchRect = {"container": o_Overlay, "objectName": "_confirmButton", "type": "TouchRect" } +o_backButton_BackButton = {"container": o_Overlay, "id": "_backButton", "type": "BackButton", "unnamed": 1 } +o_notificationBar_NotificationBarSmall = {"container": o_Overlay, "objectName": "NotificationBar", "type": "NotificationBarSmall" } +o_title_Text = {"container": o_Overlay, "type": "Text", "unnamed": 1 } + # Device Settings Information Version o_DeviceSettingsInformation = {"container": o_SettingsHome, "id": "_touchItem", "type": "TouchRect", "unnamed": 1 } o_InformationPageTitleText = {"container": o_SettingsInformation, "id": "_titleText", "type": "Text", "unnamed": 1 } Index: suite_leahi/suite.conf =================================================================== diff -u -rf6d23e89ccf01b57313b0e920f013dc1027706d4 -r605b0d914ce80d7252b16dcadfd88c214d2fe236 --- suite_leahi/suite.conf (.../suite.conf) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/suite.conf (.../suite.conf) (revision 605b0d914ce80d7252b16dcadfd88c214d2fe236) @@ -1,6 +1,6 @@ AUT=leahi LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_solution_infusion tst_main_treatment tst_service_export_logs tst_device_settings_information_version tst_headerbar_information_popup tst_headerbar_wifi_indicator tst_device_settings_wifi +TEST_CASES=tst_solution_infusion tst_main_treatment tst_service_export_logs tst_device_settings_information_version tst_headerbar_information_popup tst_headerbar_wifi_indicator tst_device_settings_wifi tst_ultrafiltration VERSION=3 WRAPPERS=Qt