# -*- 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 from dialin.ui.hd_simulator import HDSimulator from dialin.ui.dg_simulator import DGSimulator from dialin.common.hd_defs import HDOpModes from dialin.ui import utils hd_simulator = HDSimulator() dg_simulator = DGSimulator() 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_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 services title and parameters") 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 verify_hd_and_dg_versions(hd_major, hd_minor, hd_micro, hd_build, hd_fpga_id, hd_fpga_major, hd_fpga_minor, hd_fpga_lab, hd_compatibility_rev, hd_serial, dg_major, dg_minor, dg_micro, dg_build, dg_fpga_id, dg_fpga_major, dg_fpga_minor, dg_fpga_lab, dg_compatibility_rev, dg_serial): """ Method to verify the 'hd' and 'dg' version @param hd_major: (uint) - HD Major version number @param hd_minor: (uint) - HD Minor version number @param hd_micro: (uint) - HD Micro version number @param hd_build: (uint) - HD Build version number @param hd_fpga_id: (int) - HD FPGA id version number @param hd_fpga_major: (int) - HD FPGA Major version number @param hd_fpga_minor: (int) - HD FPGA Minor version number @param hd_fpga_lab: (int) - HD FPGA Lab version number @param dg_major: (uint) - DG Major version number @param dg_minor: (uint) - DG Minor version number @param dg_micro: (uint) - DG Micro version number @param dg_build: (uint) - DG Build version number @param dg_fpga_id: (int) - DG FPGA id version number @param dg_pga_major: (int) - DG FPGA Major version number @param dg__fpga_minor: (int) - DG FPGA Minor version number @param dg_fpga_lab: (int) - DG FPGA Lab version number @param compatibility_rev: (uint) - The FWs/UI compatibility revision """ test.startSection("Set 'HD' and 'DG' version and verify") hd_simulator.cmd_send_version_hd_data(major=hd_major, minor=hd_minor, micro=hd_micro, build=hd_build, fpga_id=hd_fpga_id, fpga_major=hd_fpga_major, fpga_minor=hd_fpga_minor, fpga_lab=hd_fpga_lab, compatibility_rev=hd_compatibility_rev) hd_simulator.cmd_send_serial_hd_data(hd_serial) dg_simulator.cmd_send_version_dg_data(major=dg_major, minor=dg_minor, micro=dg_micro, build=dg_build, fpga_id=dg_fpga_id, fpga_major=dg_fpga_major, fpga_minor=dg_fpga_minor, fpga_lab=dg_fpga_lab, compatibility_rev=dg_compatibility_rev) dg_simulator.cmd_send_serial_dg_data(dg_serial) version_details = {"HD Version": None, "HD FPGA Version": None, "HD Serial Number": None, "DG Version": None, "DG FPGA Version": None, "DG Serial Number": None} version_details["HD Serial Number"] = hd_serial version_details["DG Serial Number"] = dg_serial hd_version = "{hd_major}.{hd_minor}.{hd_micro}.{hd_build}.{hd_compatibility_rev}".format(hd_major=hd_major, hd_minor=hd_minor, hd_micro=hd_micro, hd_build=hd_build, hd_compatibility_rev=hd_compatibility_rev) version_details["HD Version"] = hd_version hd_fpga_version = "{hd_fpga_id}.{hd_fpga_major}.{hd_fpga_minor}.{hd_fpga_lab}".format(hd_fpga_id=hd_fpga_id, hd_fpga_major=hd_fpga_major, hd_fpga_minor=hd_fpga_minor, hd_fpga_lab=hd_fpga_lab) version_details["HD FPGA Version"] = hd_fpga_version dg_version = "{dg_major}.{dg_minor}.{dg_micro}.{dg_build}.{dg_compatibility_rev}".format(dg_major=dg_major, dg_minor=dg_minor, dg_micro=dg_micro, dg_build=dg_build, dg_compatibility_rev=dg_compatibility_rev) version_details["DG Version"] = dg_version dg_fpga_version = "{dg_fpga_id}.{dg_fpga_major}.{dg_fpga_minor}.{dg_fpga_lab}".format(dg_fpga_id=dg_fpga_id, dg_fpga_major=dg_fpga_major, dg_fpga_minor=dg_fpga_minor, dg_fpga_lab=dg_fpga_lab) version_details["DG FPGA Version"] = dg_fpga_version screen_parent_obj = object.parent(waitForObjectExists(settings_base_text_obj(("Information")))) screen_children_objs = object.children(screen_parent_obj) touch_grid = screen_children_objs[5] touch_grid_child_obj = object.children(touch_grid) touch_grid_children_obj = object.children(touch_grid_child_obj[0]) touch_grid_children_obj = touch_grid_children_obj[2:] count = 0 for title, version in version_details.items(): item_childrens = object.children(touch_grid_children_obj[count]) title_obj = item_childrens[1] count +=1 version_detail = item_childrens[3] if (title_obj.text) == title: test.compare(title_obj.text, title, "{} title should be {}".format(title, title)) test.compare(version_detail.text, version, "{}'s version detail should be {}".format(title, version)) else: continue test.endSection() 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 @param state - (bool) True/False state of 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 main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) navigate_to_settings_screen() verify_settings_parameters() verify_parameters_under_information() verify_hd_and_dg_versions(hd_major=10, hd_minor=20, hd_micro=30, hd_build=4000, hd_fpga_id=50, hd_fpga_major=60, hd_fpga_minor=70, hd_fpga_lab=80, hd_compatibility_rev=9999, hd_serial="HD1234567890123", dg_major=100, dg_minor=95, dg_micro=105, dg_build=1000, dg_fpga_id=124, dg_fpga_major=75, dg_fpga_minor=65, dg_fpga_lab=125, dg_compatibility_rev=4000, dg_serial="DG1234567890123") utils.waitForGUI(0.5) verify_hd_and_dg_versions(hd_major=12, hd_minor=25, hd_micro=32, hd_build=4100, hd_fpga_id=53, hd_fpga_major=66, hd_fpga_minor=72, hd_fpga_lab=84, hd_compatibility_rev=8888, hd_serial="HD9876543210123", dg_major=101, dg_minor=92, dg_micro=115, dg_build=1001, dg_fpga_id=121, dg_fpga_major=72, dg_fpga_minor=62, dg_fpga_lab=124, dg_compatibility_rev=3000, dg_serial="DG9876543210123") utils.waitForGUI(0.5) verify_hd_and_dg_versions(hd_major=91, hd_minor=33, hd_micro=42, hd_build=4240, hd_fpga_id=10, hd_fpga_major=50, hd_fpga_minor=10, hd_fpga_lab=20, hd_compatibility_rev=1234, hd_serial="HD1234512345123", dg_major=101, dg_minor=85, dg_micro=115, dg_build=1240, dg_fpga_id=122, dg_fpga_major=71, dg_fpga_minor=66, dg_fpga_lab=122, dg_compatibility_rev=4290, dg_serial="DG1234512345123") utils.waitForGUI(0.5) verify_hd_and_dg_versions(hd_major=40, hd_minor=30, hd_micro=33, hd_build=3210, hd_fpga_id=55, hd_fpga_major=68, hd_fpga_minor=71, hd_fpga_lab=88, hd_compatibility_rev=2345, hd_serial="HD09876543210987", dg_major=100, dg_minor=95, dg_micro=105, dg_build=1000, dg_fpga_id=124, dg_fpga_major=75, dg_fpga_minor=65, dg_fpga_lab=125, dg_compatibility_rev=4000, dg_serial="DG9876543210987") utils.tstDone()