Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r0bb330c1823aad987899f72b12c302551d575c5a -rb421c6c45a7e2c173565968657a2f76139200c8f --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 0bb330c1823aad987899f72b12c302551d575c5a) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision b421c6c45a7e2c173565968657a2f76139200c8f) @@ -19,10 +19,12 @@ salineProgressBar = {"container": mainTreatmentScreen, "id": "_fluidProgressBar", "type": "ProgressBar", "unnamed": 1 } # 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_ServiceText = {"container": o_SettingsHome, "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 } @@ -31,9 +33,6 @@ 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_DeviceSettingsPageExportLogs= {"container": o_SettingsHome, "id": "_touchItem", "occurrence": 7, "type": "TouchRect", "unnamed": 1, "visible": True } +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 } + Index: suite_leahi/tst_service_export_logs/test.py =================================================================== diff -u -r0bb330c1823aad987899f72b12c302551d575c5a -rb421c6c45a7e2c173565968657a2f76139200c8f --- suite_leahi/tst_service_export_logs/test.py (.../test.py) (revision 0bb330c1823aad987899f72b12c302551d575c5a) +++ suite_leahi/tst_service_export_logs/test.py (.../test.py) (revision b421c6c45a7e2c173565968657a2f76139200c8f) @@ -33,6 +33,11 @@ # - Close Application import names +import os +import glob +import shutil + +from pathlib import Path from configuration import application_init as application_init from configuration import config, utility from leahi_dialin.ui.td_messaging import TD_Messaging @@ -56,9 +61,16 @@ Method to navigate to "Service" screen """ td_simulator.td_operation_mode( - op_mode=TDOpModes.MODE_SERV.value, - sub_mode=TDStandbyStates.STANDBY_START_STATE.value, + TDOpModes.MODE_STAN.value, 0 ) + settings_menu_object = utility.get_object_from_names( + names.o_Settings_Menu, + error_message="Settings menu object missing", + timeout_ms=1000, + ) + if settings_menu_object is not None: + mouseClick(settings_menu_object) + device_setting_screen_title_text = utility.get_object_from_names( names.o_DeviceSettingsTitleText, error_message="Device Settings Screen title text object missing", @@ -72,17 +84,26 @@ config.DEVICE_SETTINGS_SCREEN_TITLE_TEXT ), ) + +def findChildByText(parent_object, target_text): + """Recursively finds a child object by its text property.""" + for child in object.children(parent_object): + if hasattr(child, 'text') and str(child.text) == target_text: + return child + found = findChildByText(child, target_text) + if found: + return found + return None + def navigate_to_export_logs(): - export_log_subscreen_menu_element = utility.get_object_from_names( - names.o_DeviceSettingsPageExportLogs, - error_message="export log menu element object missing", - timeout_ms=1000, - ) - if export_log_subscreen_menu_element is not None: - mouseClick(export_log_subscreen_menu_element) + grid_container = waitForObject(names.o_DeviceSettingsGrid) + export_logs_item = findChildByText(grid_container, "Export Logs") + if export_logs_item is not None: + mouseClick(export_logs_item) + export_log_screen_title_text = utility.get_object_from_names( names.o_ExportLogsPageTitleText, error_message="export log screen title text object missing", @@ -105,7 +126,7 @@ eject_usb_button = utility.get_object_from_names( names.o_USBEjectButton, error_message="eject usb button object not found", - timeout_ms=1000, + timeout_ms=3000, ) if eject_usb_button is not None: test.compare( @@ -217,15 +238,53 @@ test.endSection() +def copy_all_files_from_testdata_to_sdcard_service(): + + # Getting the directory of the currently executing script file + script_dir = os.path.dirname(os.path.abspath(__file__)) + + # Join the script's directory with the testdata subfolder path. + source_subfolder = os.path.join(script_dir, "testdata") + + # Defining the destination directory (OS Desktop sd-card service ) + destination_dir = os.path.expanduser("~/Desktop/sd-card/service") + + # Check if the destination directory exists, and create it if not + if not os.path.exists(destination_dir): + try: + os.makedirs(destination_dir) + test.log("Directory created successfully.") + except OSError as e: + test.log(f"Failed to create destination directory {destination_dir}: {e}") + return # Stop execution if folder cannot be created + + # Find all files in the source_subfolder using '*' + files_to_copy = glob.glob(os.path.join(source_subfolder, "*")) + + if not files_to_copy: + test.log(f"No files found in the source directory: {source_subfolder}") + return + + # Using shutil.copy() to copy all files + for file_path in files_to_copy: + file_name = os.path.basename(file_path) + destination_path = os.path.join(destination_dir, file_name) + shutil.copy(file_path, destination_path) + + test.log("Finished processing files from testdata folder.") + + def main(): utils.tstStart(__file__) application_init.setup_post_log_successful_start() + #copy all files from testdata to sdcard service folder + copy_all_files_from_testdata_to_sdcard_service() test.startSection("Export Application log files") - + application_init.delete_existing_files_usb_folders() - startApplication(config.AUT_NAME + "-q") + startApplication(config.AUT_NAME) navigate_to_service_menu() navigate_to_export_logs() test_export_logs_eject_usb_case() @@ -234,17 +293,17 @@ test.startSection("Export Service log files") - startApplication(config.AUT_NAME + "-q") + startApplication(config.AUT_NAME) navigate_to_service_menu() navigate_to_export_logs() select_different_log_type(1) closeWindow(names.o_Gui_MainView) test.endSection() test.startSection("Export single log file") - + application_init.delete_existing_files_usb_folders() - startApplication(config.AUT_NAME + "-q") + startApplication(config.AUT_NAME) navigate_to_service_menu() navigate_to_export_logs() select_a_log_file_and_export()