Index: suite_leahi/tst_service_export_logs/test.py =================================================================== diff -u -r739f2dc38df443ffc1d30a76720dbd08dd99e43d -r2e13d6d0385ee3f37a29885e91bfd8a44b098b84 --- suite_leahi/tst_service_export_logs/test.py (.../test.py) (revision 739f2dc38df443ffc1d30a76720dbd08dd99e43d) +++ suite_leahi/tst_service_export_logs/test.py (.../test.py) (revision 2e13d6d0385ee3f37a29885e91bfd8a44b098b84) @@ -1,23 +1,16 @@ -# -*- coding: utf-8 -*- - -# Python - import names import os import glob -from pathlib import Path -from configuration import application_init as application_init -from configuration import config, utility +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 leahi_dialin.ui import utils td =TD_Messaging() -EXPORT_LOG_STATUS ="Application log export to USB is complete" -EXPORT_LOG_PROGRESS_STATUS ="Service log export to USB in progress ... " - def custom_object_for_export_log(text): """ Method to set custom object property for export option @@ -36,47 +29,22 @@ """ test.startSection("Navigating to 'Service' menu") td.td_operation_mode(op_mode=TDOpModes.MODE_SERV.value, sub_mode=TDStandbyStates.STANDBY_START_STATE.value) - utils.waitForGUI(0.5) - service_screen_text = utility.get_object_from_names(service_text_obj(config.SERVICE_SCREEN_TITLE_TEXT), error_message="Service Screen title object missing") + service_screen_text = utility.get_object_from_names(service_text_obj(config.SERVICE_SCREEN_TITLE_TEXT), error_message="Service Screen title object missing", timeout_ms=2000) if service_screen_text is not None: test.compare(service_screen_text.text, config.SERVICE_SCREEN_TITLE_TEXT, "{} screen is displayed".format(config.SERVICE_SCREEN_TITLE_TEXT)) test.endSection() def navigate_to_export_logs(): test.startSection("Verifying the the export logs screen") - export_log_subscreen_menu_element = utility.get_object_from_names(names.settingsHomeExportLogs, error_message = "export log menu element object missing") + export_log_subscreen_menu_element = utility.get_object_from_names(names.settingsHomeExportLogs, 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) - - utils.waitForGUI(1) - - export_log_text = utility.get_object_from_names(names.exportLogsText, error_message = "export log text object missing") + + export_log_text = utility.get_object_from_names(names.exportLogsText, error_message = "export log text object missing", timeout_ms=1000) if export_log_text is not None: test.compare(export_log_text.text,config.EXPORT_LOG_TEXT,"{} should be under export logs screen ".format(config.EXPORT_LOG_TEXT)) test.endSection() -def select_different_log_type(whichTypeIndex): - log_type_combo_box = utility.get_object_from_names(names.comboBox, error_message="Combo box object is missing") - if log_type_combo_box is not None: - mouseClick(waitForObjectExists(names.comboBox)) - log_type_option = utility.get_object_from_names(custom_object_for_export_log(config.EXPORT_LOGS_OPTIONS[whichTypeIndex]), - error_message=f"Option {config.EXPORT_LOGS_OPTIONS[whichTypeIndex]} object is missing", timeout_ms = 500) - if log_type_option is not None: - mouseClick(log_type_option) - utils.waitForGUI(2) - test.compare(config.EXPORT_LOGS_OPTIONS[whichTypeIndex], waitForObjectExists(names.comboBox ).displayText, "User should able to select {}".format(config.EXPORT_LOGS_OPTIONS[whichTypeIndex])) - utils.waitForGUI(1) - mouseClick(waitForObjectExists(names.exportButton)) - - export_log_progress_status = utility.get_object_from_names(names.notificationBar, error_message = "export log progress status missing") - if export_log_progress_status is not None: - test.compare(export_log_progress_status.text,EXPORT_LOG_PROGRESS_STATUS,"{}".format(EXPORT_LOG_PROGRESS_STATUS)) - - utils.waitForGUI(3) - mouseClick(waitForObjectExists(names.usbEjectButton)) - return True - return False # default return if not successful - def check_eject_usb_button(is_enabled, is_clicking_button = False): """ For checking enabled/disabled state of the usb eject button @@ -85,9 +53,7 @@ if eject_usb_button is not None: test.compare(eject_usb_button.enabled, is_enabled, f"Check if the USB eject button enabled = {is_enabled}") if is_clicking_button: - utils.waitForGUI(0.5) mouseClick(eject_usb_button) - utils.waitForGUI(0.5) app_context = None; def init_application_service_export_logs(): @@ -110,22 +76,47 @@ init_application_service_export_logs() mouseClick(waitForObjectExists(names.exportButton)) - utils.waitForGUI(1) - export_log_status = utility.get_object_from_names(names.notificationBar, error_message = "export log status missing") + export_log_status = utility.get_object_from_names(names.notificationBar, error_message = "export log status missing", timeout_ms = 3000) if export_log_status is not None: - test.compare(export_log_status.text,EXPORT_LOG_STATUS,"{}".format(EXPORT_LOG_STATUS)) + test.compare(export_log_status.text,config.EXPORT_LOG_STATUS,"{}".format(config.EXPORT_LOG_STATUS)) check_eject_usb_button(config.ENABLED, is_clicking_button=True) - utils.waitForGUI(1) stop_application() +def select_different_log_type(whichTypeIndex): + log_type_combo_box = utility.get_object_from_names(names.comboBox, error_message="Combo box object is missing") + if log_type_combo_box is not None: + mouseClick(waitForObjectExists(names.comboBox)) + log_type_option = utility.get_object_from_names(custom_object_for_export_log(config.EXPORT_LOGS_OPTIONS[whichTypeIndex]), error_message= f"Option {config.EXPORT_LOGS_OPTIONS[whichTypeIndex]} object is missing", timeout_ms = 500) + if log_type_option is not None: + mouseClick(log_type_option) + combo_box_text = utility.get_object_from_names(names.comboBox, error_message = "unable to select from Combo Box", timeout_ms=1000) + test.compare(config.EXPORT_LOGS_OPTIONS[whichTypeIndex], combo_box_text.displayText, "User should able to select {}".format(config.EXPORT_LOGS_OPTIONS[whichTypeIndex])) + + export_button = utility.get_object_from_names(names.exportButton, error_message = "Export button was not enabled", timeout_ms=2000) + if export_button is not None: + mouseClick(export_button) + + export_log_progress_status = utility.get_object_from_names(names.notificationBar, error_message = "export log progress status missing", timeout_ms=2000) + if export_log_progress_status is not None: + test.compare(export_log_progress_status.text,config.EXPORT_LOG_PROGRESS_STATUS,"{}".format(config.EXPORT_LOG_PROGRESS_STATUS)) + + usb_eject_button = utility.get_object_from_names(names.usbEjectButton, error_message = "USB eject button was not enabled", timeout_ms=2000) + if usb_eject_button is not None: + mouseClick(usb_eject_button) + return True + return False # default return if not successful + def select_a_log_file_and_export(): test.startSection("Selecting a log file and exporting it") - mouseClick(waitForObjectExists(names.progressRect)) - utils.waitForGUI(1) + mouseClick(waitForObjectExists(names.progressRect)) mouseClick(waitForObjectExists(names.exportButton)) - mouseClick(waitForObjectExists(names.usbEjectButton)) - + usb_eject_button = utility.get_object_from_names(names.usbEjectButton, error_message = "USB eject button not enabled", timeout_ms=2000) + if usb_eject_button is not None: + mouseClick(usb_eject_button) + test.endSection() + + def delete_existing_files_usb_folders(): base_path = Path.home() / "Desktop/usb-disk"