#-*- coding: utf-8 -*-" ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_settings_date_and_time # date 05/26/2022 # author Papiya Mandal # author Amrita Debnath import names from configuration import config from dialin.ui.hd_simulator import HDSimulator from dialin.common.hd_defs import HDOpModes, HDOpSubModes from dialin.ui import utils hd_simulator = HDSimulator() SERVICE_SCREEN_OPTIONS = ["Information", "Volume And Brightness", "Wi-Fi", "Bluetooth Cuff", "DG Cleaning", "Service", "Export Logs"] def custom_object_for_export_log(text): """ Method to set custom object property for export option @param text : (string) parameter text """ names.o_option_combo_box["text"] = text return names.o_option_combo_box def settings_text_obj(text): """ Method to set custom object property for settings screen. @param text : (string) parameter text """ names.o_settings_home_text_obj["text"] = text return names.o_settings_home_text_obj def navigate_to_settings_screen(): """ Method to navigate to "Settings" screen """ test.startSection("Navigating to 'Service' screen") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) device_settings_text = waitForObjectExists(settings_text_obj(config.SERIVCES_TITLE)) test.compare(device_settings_text.text, config.SERIVCES_TITLE, "{} screen is displayed".format(config.SERIVCES_TITLE)) test.endSection() def get_storage_data_status(file_name): """ Method to verify the storage data exported or not exported. @return: (bool) - True - if export data list is present in dash board, else return False """ test.log("verification of storage data before exporting the data") export_list_count = 0 export_list = object.children(waitForObjectExists(file_name))[0] for child in object.children(export_list): export_list_count += 1 if export_list_count >= 1: return True else: return False def verify_export_logs_screen(): """ Method to verify the export logs screen """ test.startSection("Verifying the the export logs screen") test.log("Navigating to service screen to export log screen") mouseClick(waitForObjectExists(names.o_SettingsHome_export_log_mouseArea_MouseArea)) test.compare(waitForObjectExists(names.o_export_logs_text).text,config.EXPORT_LOG_TEXT,"{} should be under export logs screen ".format(config.EXPORT_LOG_TEXT)) log_status = get_storage_data_status(names.o_usb_folder_slider) test.verify(log_status == False, "export data rectangles should not be filled with contents under USB drive.") log_status = get_storage_data_status(names.o_SettingsBase_sdcFolderView_ListView) test.verify(log_status == False, "export data rectangles should be not filled with contents under SD card.") for option in range(len(config.EXPORT_LOGS_OPTIONS)): utils.waitForGUI(1) mouseClick(waitForObjectExists(names.o_combo_box)) export_option = waitForObjectExists(custom_object_for_export_log(config.EXPORT_LOGS_OPTIONS[option])) utils.waitForGUI(1) mouseClick(export_option) test.compare(config.EXPORT_LOGS_OPTIONS[option], waitForObjectExists(names.o_combo_box ).displayText, "User should able to select {}".format(config.EXPORT_LOGS_OPTIONS[option])) utils.waitForGUI(1) test.endSection() def verify_export_functionality(): """ verify export log section before and after export button click. """ test.startSection("Verifying the the export button functionality") test.log("verification of progress bar color before exporting data") test.compare(waitForObjectExists(names.o_SettingsBase_progressCircle_ProgressCircle).color.name, config.RED_COLOR,"{} color progress bar is displayed for sd-card".format(config.RED_COLOR)) test.compare(waitForObjectExists(names.o_SettingsBase_progressCircle_ProgressCircle_2).color.name, config.GREEN_COLOR,"{} color progress bar is displayed for usb-drive".format(config.GREEN_COLOR)) mouseClick(waitForObjectExists(names.o_SettingsBase_export_button_mouseArea_MouseArea_2)) utils.waitForGUI(2) log_status = get_storage_data_status(names.o_usb_folder_slider) test.verify(log_status == False, "export data rectangles should be empty after export button click under USB drive.") log_status = get_storage_data_status(names.o_SettingsBase_sdcFolderView_ListView) test.verify(log_status == False, "export data rectangles should be empty after export button click under SD card.") test.compare(waitForObjectExists(names.o_SettingsBase_progressCircle_ProgressCircle).color.name, config.RED_COLOR,"{} color progress bar is displayed for sd-card".format(config.RED_COLOR)) test.compare(waitForObjectExists(names.o_SettingsBase_progressCircle_ProgressCircle_2).color.name, config.GREEN_COLOR,"{} color progress bar is displayed for usb-drive".format(config.GREEN_COLOR)) mouseClick(waitForObjectExists(names.o_SettingsBase_image_Image )) test.compare(waitForObjectExists(names.o_export_btn).text, config.EXPORT_BUTTON_TEXT,"Export button text should be {}".format(config.EXPORT_BUTTON_TEXT)) test.compare(waitForObjectExists(names.o_export_btn).enabled, False, "Export button should be disabled") test.log("verification of progress bar color after exporting data") test.compare(waitForObjectExists(names.o_SettingsBase_progressCircle_ProgressCircle).color.name, config.RED_COLOR,"{} color progress bar is displayed for sd-card".format(config.RED_COLOR)) test.compare(waitForObjectExists(names.o_SettingsBase_progressCircle_ProgressCircle_2).color.name, config.RED_COLOR,"{} color progress bar is displayed for usb-drive".format(config.RED_COLOR)) test.endSection() def verify_device_shutdown(): """ verify shutdown button after clicking export button """ test.startSection("verification of system shutdown option") mouseClick(waitForObjectExists(names.o_SettingsBase_export_log_backButton_BackButton)) test.compare(waitForObjectExists(names.o_keyboard_object).text, config.SHUTDOWN_BUTTON_TEXT, "User should able to click {}".format(config.SHUTDOWN_BUTTON_TEXT)) utils.waitForGUI(1) mouseClick(waitForObjectExists(names.o_SettingsHome_service_confirmButton_TouchRect)) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME+ "-l") navigate_to_settings_screen() verify_export_logs_screen() verify_export_functionality() verify_device_shutdown() utils.tstDone()