# -*- 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_information # date 04/29/2022 # author Papiya Mandal # author Akshay Dhawan import names from configuration import config, utility from dialin.ui.hd_simulator import HDSimulator from dialin.common.hd_defs import HDOpModes from dialin.ui import utils hd_simulator = HDSimulator() def settings_text_obj(text): names.o_settings_home_text_obj["text"] = text return names.o_settings_home_text_obj def settings_base_text_obj(text): names.o_settings_base_text_obj["text"] = text return names.o_settings_base_text_obj def verify_clear_alarm_condition_button(): """ Method to verify the 'Clear Alarm Condition' button """ test.startSection("Verifying Clear Alarm Condition button") clear_condition_button = waitForObjectExists(settings_text_obj(config.CLEAR_ALARM_CONDITION_TEXT)) test.compare(clear_condition_button.text, config.CLEAR_ALARM_CONDITION_TEXT, "Clear Alarm Condition button text should be {}".format(config.CLEAR_ALARM_CONDITION_TEXT)) test.compare(clear_condition_button.enabled, config.ENABLED, "Clear Alarm Condition button should be enabled") test.endSection() def verify_export_button(state): """ Method to verify the 'Export' button """ test.startSection("Verifying Export button") export_btn = waitForObjectExists(settings_text_obj(config.EXPORT_TEXT)) test.compare(export_btn.text, config.EXPORT_TEXT, "Export button text should be {}".format(config.EXPORT_TEXT)) if state == config.ENABLED: test.compare(export_btn.enabled, config.ENABLED, "Export button should be enabled") else: test.compare(export_btn.enabled, config.DISABLED, "Export button should be disabled") test.endSection() def verify_settings_parameters(): """ Method to verify the buttons and parameters of 'Device Settings screen """ test.startSection("Verify the buttons and parameters of 'Device Settings' screen") verify_clear_alarm_condition_button() mouseClick(waitForObjectExists(settings_text_obj(config.CLEAR_ALARM_CONDITION_TEXT))) verify_export_button(config.ENABLED) mouseClick(waitForObjectExists(settings_text_obj(config.EXPORT_TEXT))) eject_btn = waitForObject(names.o_eject_btn) test.compare(eject_btn.enabled, config.ENABLED, "Eject button should be enabled") mouseClick(eject_btn) test.log("Verifying the state of 'Export' button after clicking on Eject button") verify_export_button(config.DISABLED) for parameter in config.DEVICE_SETTINGS_SCREEN_PARAMETER: parameter_text = waitForObjectExists(settings_text_obj(parameter)) test.compare(parameter_text.text, parameter, "{} should be available under 'Device Settings' screen".format(parameter)) test.endSection() def verify_parameters_under_information(): """ Method to verify the parameter under 'Information'\ and 'Services' """ test.startSection("Verify the parameter under 'Information' and 'Services'") test.log("Navigating to 'Information' screen") mouseClick(waitForObjectExists(names.o_arrow_btn)) for title in config.INFORMATION_TITLES: title_text = waitForObjectExists(settings_base_text_obj(title)) test.compare(title_text.text, title, "{} should be available".format(title)) for info_parameter in config.INFORMATION_PARAMETERS: info_parameter_text = waitForObjectExists(settings_base_text_obj(info_parameter)) test.compare(info_parameter_text.text, info_parameter, "{} should be available under 'Information'".format(info_parameter)) test.log("Verifying 'Serivces title and") services_text = waitForObjectExists(settings_base_text_obj(config.SERIVCES_TITLE)) test.compare(services_text.text, config.SERIVCES_TITLE, "Services title should be {}".format(config.SERIVCES_TITLE)) for services_parameter in config.SERVICES_PARAMETERS: services_par_text = waitForObjectExists(settings_base_text_obj(services_parameter)) test.compare(services_par_text.text, services_parameter, "{} should be available under services".format(services_parameter)) test.endSection() def navigate_to_settings_screen(): """ Method to navigate to "Settings" screen """ test.startSection("Navigating to 'Device Settings' screen") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_STAN.value, sub_mode=HDOpModes.MODE_FAUL.value) utils.waitForGUI(1) mouseClick(waitForObjectExists(names.o_settings_Text)) device_settings_text = waitForObjectExists(settings_text_obj(config.DEVICE_SETTINGS_TEXT)) test.compare(device_settings_text.text, config.DEVICE_SETTINGS_TEXT, "{} screen is displayed".format(config.DEVICE_SETTINGS_TEXT)) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) navigate_to_settings_screen() verify_settings_parameters() verify_parameters_under_information() utils.tstDone()