Index: suite_leahi/tst_service_export_logs/test.py =================================================================== diff -u -rb421c6c45a7e2c173565968657a2f76139200c8f -r98661ca0120138f0a071a0444750c7a39f03b5d9 --- suite_leahi/tst_service_export_logs/test.py (.../test.py) (revision b421c6c45a7e2c173565968657a2f76139200c8f) +++ suite_leahi/tst_service_export_logs/test.py (.../test.py) (revision 98661ca0120138f0a071a0444750c7a39f03b5d9) @@ -37,69 +37,14 @@ 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 -from leahi_dialin.common.td_defs import TDOpModes, TDStandbyStates -from leahi_dialin.ui import utils +from configuration import application_init +from configuration import config, utility, navigation +from leahi_dialin.ui import utils -td_simulator = TD_Messaging() - -def custom_object_for_export_log(text): - """ - Method to set custom object property for export option - @param text : (string) parameter text - """ - names.o_OptionComboBox["text"] = text - return names.o_OptionComboBox - - -def navigate_to_service_menu(): - """ - Method to navigate to "Service" screen - """ - td_simulator.td_operation_mode( - 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", - timeout_ms=2000, - ) - if device_setting_screen_title_text is not None: - test.compare( - device_setting_screen_title_text.text, - config.DEVICE_SETTINGS_SCREEN_TITLE_TEXT, - "{} screen is displayed and Comparison of Device Settings Screen Title text".format( - 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(): grid_container = waitForObject(names.o_DeviceSettingsGrid) - export_logs_item = findChildByText(grid_container, "Export Logs") + export_logs_item = utility.findChildByText(grid_container, "Export Logs") if export_logs_item is not None: mouseClick(export_logs_item) @@ -170,7 +115,7 @@ if log_type_combo_box is not None: mouseClick(waitForObjectExists(names.o_LogTypeComboBox)) log_type_option = utility.get_object_from_names( - custom_object_for_export_log( + utility.setObjectText(names.o_OptionComboBox, config.EXPORT_LOGS_OPTIONS[whichTypeIndex]), error_message=f"Option {config.EXPORT_LOGS_OPTIONS[whichTypeIndex]} object is missing", timeout_ms=500, @@ -285,7 +230,7 @@ application_init.delete_existing_files_usb_folders() startApplication(config.AUT_NAME) - navigate_to_service_menu() + navigation.navigate_to_device_settings_screen() navigate_to_export_logs() test_export_logs_eject_usb_case() closeWindow(names.o_Gui_MainView) @@ -294,7 +239,7 @@ test.startSection("Export Service log files") startApplication(config.AUT_NAME) - navigate_to_service_menu() + navigation.navigate_to_device_settings_screen() navigate_to_export_logs() select_different_log_type(1) closeWindow(names.o_Gui_MainView) @@ -304,7 +249,7 @@ application_init.delete_existing_files_usb_folders() startApplication(config.AUT_NAME) - navigate_to_service_menu() + navigation.navigate_to_device_settings_screen() navigate_to_export_logs() select_a_log_file_and_export()