#-*- 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 builtins import names from configuration import config, utility from configuration.config import SERVICE_CONF_LOCATION from dialin.ui.hd_simulator import HDSimulator from dialin.common.hd_defs import HDOpModes, HDOpSubModes from dialin.ui import utils from builtins import str from cgitb import text EXPORT_LOGS = "Export Logs" SERVICE_SCREEN_OPTIONS = ["Information", "Volume And Brightness", "Wi-Fi", "Bluetooth Cuff", "DG Cleaning", "Service", "Export Logs"] hd_simulator = HDSimulator() def custom_object_for_export_log(text): """ Method to set object property based on text @param text : (string) parameter text """ names.o_option_combo_box["text"] = text return names.o_option_combo_box def settings_text_obj(text): names.o_settings_home_text_obj["text"] = text return names.o_settings_home_text_obj def services_screen_text_obj(text): names.o_services_screen_text_obj["text"] = text return names.o_services_screen_text_obj def export_log_text(text): names.o_usb_folder_file["text"]= text return names.o_usb_folder_file test.log(text) def export_log_id(id): names.o_usb_folder_id["text"] = id return names.o_usb_folder_id test.log(id) 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 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(settings_text_obj(EXPORT_LOGS))) test.compare(waitForObjectExists(names.o_export_logs_text).text,config.EXPORT_TEXT,"{} should be under export logs screen ".format(config.EXPORT_TEXT)) 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.log("verifying slider in export logs") mouseClick(waitForObjectExists(names.o_usb_folder_slider)) # parameter_object = export_log_id(text = config.USB_SLIDER_1) # utility.scroll_to_zone(names.o_usb_folder_slider, direction = "Top") parameter_object = export_log_id(id = config.USB_SLIDER_1) utility.scroll_to_zone(parameter_object, names.o_slider_text) def verify_export_functionality(): """ verify log before clicking export button and after clicking export button """ test.startSection("Verifying the the export button clicking") mouseClick(waitForObjectExists(names.o_export_btn )) utils.waitForGUI(1) test.compare(waitForObjectExists(names.o_export_btn).text, config.EXPORT_BUTTON_TEXT,"{} screen is displayed".format(config.EXPORT_BUTTON_TEXT)) test.endSection() def verify_device_shutdown(): """ verify shutdown button after clicking export button """ mouseClick(waitForObjectExists(names.o_shutdown_btn)) test.compare(waitForObjectExists(names.o_shutdown_btn).text, config.SHUTDOWN_BUTTON_TEXT, "User should able to click {}".format(config.SHUTDOWN_BUTTON_TEXT)) test.endSection() # for logs in config.EXPORT_LOGS_OPTIONS: # logs_export = waitForObjectExists(services_screen_text_obj(logs)) # test.compare(logs_export.text, logs, "{} should be available under export logs screen".format(logs)) # # mouseClick(waitForObjectExists(names.o_back_btn)) # test.compare(services_screen_text_obj.text, config.BACK_BUTTON_TEXT, "{} screen is displayed".format(config.BACK_BUTTON_TEXT)) # mouseClick(waitForObjectExists(settings_text_obj(EXPORT_LOGS))) # combobox_dropdown = waitForObjectExists(names.o_combo_box ) # for option in range(3): # mouseClick(waitForObjectExists(names.o_combo_box )) # test.compare(combobox_dropdown.text.option[0], config.EXPORT_LOGS_OPTIONS[0], "{} combo box is displayed".format(config.EXPORT_LOGS_OPTIONS[0])) # mouseClick(waitForObjectExists(names.o_combo_box )) # test.compare(waitForObjectExists(names.o_combo_box).text, config.EXPORT_LOGS_OPTIONS, "{} combo box is displayed".format(config.EXPORT_LOGS_OPTIONS)) # def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) navigate_to_settings_screen() verify_export_logs_screen() verify_export_functionality() verify_device_shutdown() utils.tstDone()