Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r8f9df8e70510cbd35fcefa54812b16bf0ee0e3ff -r733e6e27c1d88e9615ab0d2ac422d8e5d87de89e --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 8f9df8e70510cbd35fcefa54812b16bf0ee0e3ff) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 733e6e27c1d88e9615ab0d2ac422d8e5d87de89e) @@ -3,12 +3,12 @@ import object import names from leahi_dialin.ui.td_messaging import TD_Messaging -from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates -from configuration import config, navigation +from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates +from configuration import config, navigation +from leahi_dialin.ui import utils +from builtins import int as pyInt td =TD_Messaging() -from leahi_dialin.ui import utils -from builtins import int as pyInt def aut(*args): """ @@ -18,7 +18,7 @@ return " ".join(('leahi', *args)) -def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): +def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 3000): """ To get an object with try..except catching to prevent script errors when the object is not found on the GUI @param names_dict - the dictionary element from the names.py file (ie: names.some_variable_name_of_element) @@ -51,7 +51,7 @@ names.o_text_object["text"] = txt return names.o_text_object -def setObjectText(text,obj): +def setObjectText(obj,text): """ Method to set object property based on text @param text : (string) treatment parameter text @@ -259,6 +259,7 @@ test.fail("ERROR : " + error_message) return None + def get_object_source_path(names_dict, error_message = "Missing object source path", timeout_ms = 2000): """ To get an object source path with try..except catching to prevent script errors when the object is not found on the GUI @@ -281,16 +282,19 @@ return squish.waitForObject(names_dict, timeout_ms).text except LookupError: test.fail("ERROR : " + error_message) - return None + return None + + results.append(parent) + def findAllObjectsByText(parent, target_text): """ Recursively finds all child objects that have a 'text' property - """ matching the target_text. Returns a list of matches. + """ results = [] # Use hasattr to safely check for 'text' property before comparing - results.append(parent) if hasattr(parent, 'text') and str(parent.text) == target_text: + results.append(parent) # Recurse through all children for child in object.children(parent): Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r8f9df8e70510cbd35fcefa54812b16bf0ee0e3ff -r733e6e27c1d88e9615ab0d2ac422d8e5d87de89e --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 8f9df8e70510cbd35fcefa54812b16bf0ee0e3ff) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 733e6e27c1d88e9615ab0d2ac422d8e5d87de89e) @@ -6,6 +6,8 @@ o_Gui_MainView = { "type": "Gui::MainView", "unnamed": 1 } o_QQuickView = { "type": "QQuickView" } o_Overlay = {"container": o_QQuickView, "type": "Overlay" } +o_mainMenu_MainMenu = {"container": o_Gui_MainView, "id": "_mainMenu", "type": "MainMenu", "unnamed": 1 } +o_headerBar_HeaderBar = {"container": o_Gui_MainView, "id": "_headerBar", "type": "HeaderBar", "unnamed": 1 } # Solution Infusion o_standByScreen_MainHome = {"container": o_Gui_MainView, "type": "MainHome" } @@ -38,27 +40,39 @@ o_dialyste_cond_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } o_treatmentTimeNotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "notification", "type": "NotificationBarSmall" } -# settings_service_export_logs -o_listView_ListView = {"container": o_Gui_MainView, "id": "_listView", "type": "ListView", "unnamed": 1 } -o_listView_delegateControl = {"container": o_listView_ListView, "index": 2, "objectName": "delegateControl", "type": "Item" } -o_Settings_Menu = {"container": o_listView_delegateControl, "objectName": "_touchRect2", "type": "TouchRect" } -o_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome" } -o_SettingsExportLogs = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsExportLogs" } -o_DeviceSettingsTitleText = {"container": o_SettingsHome, "id":"_titleText", "type": "Text", "unnamed": 1 } -o_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } -o_USBEjectButton = {"container": o_SettingsExportLogs, "id": "_usbEjectButton", "type": "USBButton", "unnamed": 1 } -o_ExportLogsPageTitleText = {"container": o_SettingsInformation, "id":"_titleText", "type": "Text", "unnamed": 1 } -o_LogTypeComboBox = {"container": o_SettingsInformation, "id": "_logTypeCombo", "type": "ComboBox", "unnamed": 1 } -o_OptionComboBox = {"container": o_Overlay, "type": "Text", "unnamed": 1 } -o_ExportButton = {"container": o_SettingsExportLogs, "id": "_logTypeExportButton", "type": "ExportButton", "unnamed": 1 } -o_ExportLogsProgressRect = {"container": o_SettingsExportLogs, "id": "_progressRect", "type": "ProgressRect", "unnamed": 1 } -o_ExportLogsNotificationBar = {"container": o_SettingsExportLogs, "id": "_information", "type": "NotificationBarSmall" } -o_DeviceSettingsGrid = {"container": o_SettingsHome, "id": "_grid", "type": "Grid", } +# settings_service_export_logs +o_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome", } +o_SettingsExportLogs = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsExportLogs", } +o_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase", } +o_USBEjectButton = {"container": o_SettingsExportLogs, "id": "_usbEjectButton", "type": "USBButton", "unnamed": 1 } +o_LogTypeComboBox = {"container": o_SettingsInformation, "id": "_logTypeCombo", "type": "ComboBox", "unnamed": 1 } +o_OptionComboBox = {"container": o_Overlay, "type": "Text", "unnamed": 1 } +o_ExportButton = {"container": o_SettingsExportLogs, "id": "_logTypeExportButton", "type": "ExportButton", "unnamed": 1 } +o_ExportLogsProgressRect = {"container": o_SettingsExportLogs, "id": "_progressRect", "type": "ProgressRect", "unnamed": 1 } +o_ExportLogsNotificationBar = {"container": o_SettingsExportLogs, "id": "_information", "type": "NotificationBarSmall", } +o_DeviceSettingsGrid = {"container": o_SettingsHome, "id": "_grid", "type": "Grid", } + +# o_listView_ListView = {"container": o_Gui_MainView, "id": "_listView", "type": "ListView", "unnamed": 1 } +# o_listView_delegateControl = {"container": o_listView_ListView, "index": 2, "objectName": "delegateControl", "type": "Item" } +# o_Settings_Menu = {"container": o_listView_delegateControl, "objectName": "_touchRect2", "type": "TouchRect" } +# o_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome" } +# o_SettingsExportLogs = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsExportLogs" } +# o_DeviceSettingsTitleText = {"container": o_SettingsHome, "id":"_titleText", "type": "Text", "unnamed": 1 } +# o_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } +# o_USBEjectButton = {"container": o_SettingsExportLogs, "id": "_usbEjectButton", "type": "USBButton", "unnamed": 1 } +# o_ExportLogsPageTitleText = {"container": o_SettingsInformation, "id":"_titleText", "type": "Text", "unnamed": 1 } +# o_LogTypeComboBox = {"container": o_SettingsInformation, "id": "_logTypeCombo", "type": "ComboBox", "unnamed": 1 } +# o_OptionComboBox = {"container": o_Overlay, "type": "Text", "unnamed": 1 } +# o_ExportButton = {"container": o_SettingsExportLogs, "id": "_logTypeExportButton", "type": "ExportButton", "unnamed": 1 } +# o_ExportLogsProgressRect = {"container": o_SettingsExportLogs, "id": "_progressRect", "type": "ProgressRect", "unnamed": 1 } +# o_ExportLogsNotificationBar = {"container": o_SettingsExportLogs, "id": "_information", "type": "NotificationBarSmall" } +# o_DeviceSettingsGrid = {"container": o_SettingsHome, "id": "_grid", "type": "Grid", } #HeaderBar Information Pop up o_InformationIconButton = {"container": o_Gui_MainView, "id": "_informationButton", "type": "IconButton", "unnamed": 1 } o_InformationParameters = {"container": o_Overlay, "type": "Text", "unnamed": 1 } o_VersionColumn = {"container": o_Overlay, "id": "_versionColumn", "type": "Column", "unnamed": 1 } + # General Alarm Requirements Instruction o_AlarmButton_Mute = {"container": o_Overlay, "id": "_muteButton", "type": "MuteButton" } o_AlarmButton_Mute_Min = {"container": o_AlarmButton_Mute, "id": "_hourText", "type": "Text" } @@ -224,28 +238,27 @@ o_preTreatmentStack_Text = {"container": o_preTreatmentStack_PreTreatmentStack, "type": "Text", "unnamed": 1 } o_preTreatmentStack_stepIndicator_StepIndicator = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_stepIndicator", "type": "StepIndicator", "unnamed": 1 } - # Settings Service -o_SettingsStack_SettingsStack = {"container": o_Gui_MainView, "objectName": "_SettingsStack", "type": "SettingsStack", } -o_UserConfirmation_SettingsServicePassword = {"container": o_SettingsStack_SettingsStack, "objectName": "UserConfirmation", "type": "SettingsServicePassword" } -o_loginPage_Titletext = {"container": o_UserConfirmation_SettingsServicePassword, "id":"_titleText", "type": "Text", "unnamed": 1 } -o_userConfirmation_TextInput = {"container": o_UserConfirmation_SettingsServicePassword, "id": "_input", "type": "TextInput", "unnamed": 1 } -o_headerBar_HeaderBar = {"container": o_Gui_MainView, "id": "_headerBar", "type": "HeaderBar", "unnamed": 1 } -o_userConfirmation_ConfirmButton = {"container": o_UserConfirmation_SettingsServicePassword, "objectName": "_confirmButton", "type": "ConfirmButton" } -o_SettingsHome_confirmButton = {"container": o_SettingsHome, "objectName": "_confirmButton", "type": "ConfirmButton" } -o_SettingsBase_SettingsAdvancedMode = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsAdvancedMode" } -o_settingsAdvancedMode_BaseSwitch = {"checkable": True, "container": o_SettingsBase_SettingsAdvancedMode, "id": "_settingsAdvancedMode", "type": "BaseSwitch", "unnamed": 1 } -o_SettingsBase_backButton_AdvancedMode = {"container": o_SettingsBase_SettingsAdvancedMode, "objectName": "_backButton", "type": "BackButton" } -o_SettingsBase_SettingsDateTime = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsDateTime" } -o_SettingsBase_ntpSwitch_BaseSwitch = {"checkable": True, "container": o_SettingsBase_SettingsDateTime, "id": "_ntpSwitch", "type": "BaseSwitch", "unnamed": 1 } -o_SettingsBase_backButton_NTP_Switch = {"container": o_SettingsBase_SettingsDateTime, "objectName": "_backButton", "type": "BackButton" } -o_timeContainer_LabelUnitContainer = {"container": o_SettingsBase_SettingsDateTime, "id": "_timeContainer", "type": "LabelUnitContainer", "unnamed": 1 } -o_SettingsBase_SettingsRootSSHAccess = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsRootSSHAccess" } -o_SettingsBase_SSH_LoginSwitch = {"checkable": True, "container": o_SettingsBase_SettingsRootSSHAccess, "id": "_settingsRootSSHAccess_SSHDSwitch", "type": "BaseSwitch", "unnamed": 1 } -o_SettingsBase_Root_LoginSwitch = {"checkable": True, "container": o_SettingsBase_SettingsRootSSHAccess, "id": "_settingsRootSSHAccess_RootSwitch", "type": "BaseSwitch", "unnamed": 1 } -o_SettingsBase_backButton_RootSSH = {"container": o_SettingsBase_SettingsRootSSHAccess, "objectName": "_backButton", "type": "BackButton" } -o_userConfirmation_SettingsFactoryReset = {"container": o_Gui_MainView, "objectName": "UserConfirmation", "type": "SettingsFactoryReset" } -o_userConfirmation_backButton_FactoryReset = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_backButton", "type": "BackButton" } -o_factoryReset_ConfirmButton = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_confirmButton", "type": "ConfirmButton" } -o_cancelTouch_TouchRect = {"container": o_Overlay, "id": "_cancelTouch", "type": "TouchRect", "unnamed": 1 } -o_confirmTouch_ConfirmButton = {"container": o_Overlay, "id": "_confirmTouch", "type": "ConfirmButton", "unnamed": 1 } \ No newline at end of file +o_SettingsStack_SettingsStack = {"container": o_Gui_MainView, "objectName": "_SettingsStack", "type": "SettingsStack", } +o_UserConfirmation_SettingsServicePassword = {"container": o_SettingsStack_SettingsStack, "objectName": "UserConfirmation", "type": "SettingsServicePassword", } +o_loginPage_Titletext = {"container": o_UserConfirmation_SettingsServicePassword, "id":"_titleText", "type": "Text", "unnamed": 1 } +o_userConfirmation_TextInput = {"container": o_UserConfirmation_SettingsServicePassword, "id": "_input", "type": "TextInput", "unnamed": 1 } +o_headerBar_HeaderBar = {"container": o_Gui_MainView, "id": "_headerBar", "type": "HeaderBar", "unnamed": 1 } +o_userConfirmation_ConfirmButton = {"container": o_UserConfirmation_SettingsServicePassword, "objectName": "_confirmButton", "type": "ConfirmButton", } +o_SettingsHome_confirmButton = {"container": o_SettingsHome, "objectName": "_confirmButton", "type": "ConfirmButton", } +o_SettingsBase_SettingsAdvancedMode = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsAdvancedMode", } +o_settingsAdvancedMode_BaseSwitch = {"container": o_SettingsBase_SettingsAdvancedMode, "id": "_settingsAdvancedMode", "type": "BaseSwitch", "unnamed": 1 } +o_SettingsBase_backButton_AdvancedMode = {"container": o_SettingsBase_SettingsAdvancedMode, "objectName": "_backButton", "type": "BackButton", } +o_SettingsBase_SettingsDateTime = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsDateTime", } +o_SettingsBase_ntpSwitch_BaseSwitch = {"container": o_SettingsBase_SettingsDateTime, "id": "_ntpSwitch", "type": "BaseSwitch", "unnamed": 1 } +o_SettingsBase_backButton_NTP_Switch = {"container": o_SettingsBase_SettingsDateTime, "objectName": "_backButton", "type": "BackButton", } +o_timeContainer_LabelUnitContainer = {"container": o_SettingsBase_SettingsDateTime, "id": "_timeContainer", "type": "LabelUnitContainer", "unnamed": 1 } +o_SettingsBase_SettingsRootSSHAccess = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsRootSSHAccess", } +o_SettingsBase_SSH_LoginSwitch = {"container": o_SettingsBase_SettingsRootSSHAccess, "id": "_settingsRootSSHAccess_SSHDSwitch", "type": "BaseSwitch", "unnamed": 1 } +o_SettingsBase_Root_LoginSwitch = {"container": o_SettingsBase_SettingsRootSSHAccess, "id": "_settingsRootSSHAccess_RootSwitch", "type": "BaseSwitch", "unnamed": 1 } +o_SettingsBase_backButton_RootSSH = {"container": o_SettingsBase_SettingsRootSSHAccess, "objectName": "_backButton", "type": "BackButton", } +o_userConfirmation_SettingsFactoryReset = {"container": o_Gui_MainView, "objectName": "UserConfirmation", "type": "SettingsFactoryReset", } +o_userConfirmation_backButton_FactoryReset = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_backButton", "type": "BackButton", } +o_factoryReset_ConfirmButton = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_confirmButton", "type": "ConfirmButton", } +o_cancelTouch_TouchRect = {"container": o_Overlay, "id": "_cancelTouch", "type": "TouchRect", "unnamed": 1 } +o_confirmTouch_ConfirmButton = {"container": o_Overlay, "id": "_confirmTouch", "type": "ConfirmButton", "unnamed": 1 } Index: suite_leahi/tst_service_export_logs/test.py =================================================================== diff -u -re0f0f1fbb5525cf1c192091f3e017eb174fb6548 -r733e6e27c1d88e9615ab0d2ac422d8e5d87de89e --- suite_leahi/tst_service_export_logs/test.py (.../test.py) (revision e0f0f1fbb5525cf1c192091f3e017eb174fb6548) +++ suite_leahi/tst_service_export_logs/test.py (.../test.py) (revision 733e6e27c1d88e9615ab0d2ac422d8e5d87de89e) @@ -49,7 +49,7 @@ if export_logs_item is not None: mouseClick(export_logs_item) - headerbar_container = utility.get_object_from_names(names.o_headerBar_HeaderBar) + headerbar_container = utility.get_object_from_names(names.o_headerBar_HeaderBar, 2000) export_log_screen_title_text = utility.findChildByText( headerbar_container, "Export Logs" ) @@ -91,7 +91,6 @@ ) if export_button is not None: mouseClick(export_button) - utils.waitForGUI( 1 ) # This wait is to verify that the Application log export to USB is complete. Increase seconds in waitForGUI if the test compare fails. @@ -116,7 +115,7 @@ names.o_LogTypeComboBox, error_message="Combo box object is missing", ) if log_type_combo_box is not None: - mouseClick(utility.get_object_from_names(names.o_LogTypeComboBox)) + mouseClick(waitForObjectExists(names.o_LogTypeComboBox)) log_type_option = utility.get_object_from_names( utility.setObjectText(names.o_OptionComboBox, config.EXPORT_LOGS_OPTIONS[whichTypeIndex]), @@ -163,7 +162,6 @@ def select_a_log_file_and_export(): - select_a_file = utility.get_object_from_names( names.o_ExportLogsProgressRect, error_message="eject o_ExportLogsProgressRect object not found",