# Subject/Title: LDT-1078 Device Settings - SW - 02 - Information - Version - Q&R # # Functionalities: Testing items of Device Settings Information Screen # # Steps: # 1 Set OS version, start Leahi Application, simulate TD standby mode, # First, navigate to the Device Settings screen. Then, navigate to the Information screen # 2 Verify the parameter under Device Settings Information screen # 3 Set and Compare Information Parameters values # 4 Set and Compare Information Parameters at their Maximum values # 5 Set and Compare Information Parameters at their Minimum values # 6 Set and Compare Information Parameters at their values Beyond the Maximum Allowed # 7 Set and Compare Information Parameters at their values Below the Minimum Allowed import names from configuration import config, utility from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.ui import utils from leahi_dialin.ui.dd_messaging import DD_Messaging from configuration import application_init from leahi_dialin.common.td_defs import TDOpModes, TDStandbyStates td_simulator = TD_Messaging() dd_simulator = DD_Messaging() def navigate_to_device_settings_screen(): """ Method to navigate to "Service" screen """ td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value, 0) settings_menu_object = utility.get_object_from_names( names.o_Settings_Menu, error_message="Settings menu object missing", timeout_ms=1000, ) if settings_menu_object is not None: mouseClick(settings_menu_object) device_setting_screen_title_text = utility.get_object_from_names( names.o_DeviceSettingsTitleText, error_message="Device Settings Screen title text object missing", timeout_ms=2000, ) if device_setting_screen_title_text is not None: test.compare( device_setting_screen_title_text.text, config.DEVICE_SETTINGS_SCREEN_TITLE_TEXT, "{} screen is displayed and Comparison of Device Settings Screen Title text".format( config.DEVICE_SETTINGS_SCREEN_TITLE_TEXT ), ) def navigate_to_information_screen(): infromation_subscreen_menu_element = utility.get_object_from_names( names.o_DeviceSettingsInformation, error_message="Information menu element object missing", timeout_ms=1000, ) if infromation_subscreen_menu_element is not None: mouseClick(infromation_subscreen_menu_element) information_screen_title_text = utility.get_object_from_names( names.o_InformationPageTitleText, error_message="Information screen title text object missing", timeout_ms=1000, ) if information_screen_title_text is not None: test.compare( information_screen_title_text.text, config.INFORMATION_SCREEN_TITLE_TEXT, "{} screen is displayed and Comparison of Information Screen Title text".format( config.INFORMATION_SCREEN_TITLE_TEXT ), ) def text_obj(text): """ Method to set custom object property for information screen. @param text: (string) parameter text """ names.o_SettingsBase_Information_Text["text"] = text return names.o_SettingsBase_Information_Text def verify_parameters_under_information(): """ Method to verify the parameter under 'Information' """ for title in config.INFORMATION_TITLES: title_text = waitForObjectExists(text_obj(title)) test.compare(title_text.text, title, "{} should be available".format(title)) for info_parameter in config.VERSION_PARAMETERS: info_parameter_text = waitForObjectExists(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(text_obj(config.SERIVCES_TITLE)) test.compare( services_text.text, config.SERIVCES_TITLE, "Service title should be {}".format(config.SERIVCES_TITLE), ) for services_parameter in config.SERVICES_PARAMETERS: services_par_text = waitForObjectExists(text_obj(services_parameter)) test.compare( services_par_text.text, services_parameter, "{} should be available under service tile".format( services_parameter), ) for water_parameter in config.WATER_PARAMETERS: water_par_text = waitForObjectExists(text_obj(water_parameter)) test.compare( water_par_text.text, water_parameter, "{} should be available under service tile".format( water_parameter), ) def verify_td_and_dd_versions( td_major, td_minor, td_micro, td_build, td_fpga_id, td_fpga_major, td_fpga_minor, td_fpga_lab, td_compatibility_rev, td_serial, dd_major, dd_minor, dd_micro, dd_build, dd_fpga_id, dd_fpga_major, dd_fpga_minor, dd_fpga_lab, dd_compatibility_rev, dd_serial, ): """ Method to verify the OS, UI, 'TD' and 'DD' version @param td_major : (uint) - TD Major version number @param td_minor : (uint) - TD Minor version number @param td_micro : (uint) - TD Micro version number @param td_build : (uint) - TD Build version number @param td_fpga_id : (int) - TD FPGA id version number @param td_fpga_major : (int) - TD FPGA Major version number @param td_fpga_minor : (int) - TD FPGA Minor version number @param td_fpga_lab : (int) - TD FPGA Lab version number @param dd_major : (uint) - DD Major version number @param dd_minor : (uint) - DD Minor version number @param dd_micro : (uint) - DD Micro version number @param dd_build : (uint) - DD Build version number @param dd_fpga_id : (int) - DD FPGA id version number @param dd_pga_major : (int) - DD FPGA Major version number @param dd__fpga_minor : (int) - DD FPGA Minor version number @param dd_fpga_lab : (int) - DD FPGA Lab version number @param compatibility_rev: (uint) - The FWs/UI compatibility revision """ td_simulator.td_versions( major = td_major, minor = td_minor, micro = td_micro, build = td_build, fpga_id = td_fpga_id, fpga_major = td_fpga_major, fpga_minor = td_fpga_minor, fpga_lab = td_fpga_lab, compatibility_rev = td_compatibility_rev, ) td_simulator.td_serial(td_serial) dd_simulator.dd_versions( major = dd_major, minor = dd_minor, micro = dd_micro, build = dd_build, fpga_id = dd_fpga_id, fpga_major = dd_fpga_major, fpga_minor = dd_fpga_minor, fpga_lab = dd_fpga_lab, compatibility_rev = dd_compatibility_rev, ) dd_simulator.dd_serial(dd_serial) version_details = { "OS Version" : "123.123.123.20230628230011", "UI Version" : "staging-10161748-0", "TD Version" : None, "TD FPGA Version" : None, "TD Serial Number": None, "DD Version" : None, "DD FPGA Version" : None, "DD Serial Number": None, } td_version = f"{td_major}.{td_minor}.{td_micro}.{td_build}.{td_compatibility_rev}" td_fpga_version = f"{td_fpga_id}.{td_fpga_major}.{td_fpga_minor}.{td_fpga_lab}" dd_version = f"{dd_major}.{dd_minor}.{dd_micro}.{dd_build}.{dd_compatibility_rev}" dd_fpga_version = f"{dd_fpga_id}.{dd_fpga_major}.{dd_fpga_minor}.{dd_fpga_lab}" version_details["TD Version"] = td_version version_details["TD FPGA Version"] = td_fpga_version version_details["TD Serial Number"] = td_serial version_details["DD Version"] = dd_version version_details["DD FPGA Version"] = dd_fpga_version version_details["DD Serial Number"] = dd_serial column = waitForObject(names.o_SettingsBase_grid_Grid) # Get a list of the children children = object.children(column) # Create an iterator for the version_details items version_details_iter = iter(version_details.items()) count = 0 for child in children: value = findObjectById(child, "_itemsValue") value_text = str(value.text) if value_text != "": key, expected_value = next(version_details_iter) # Compare the non-empty value with the expected value test.compare( value_text, expected_value, "Comparison of Information Parameter '" + key + "'", ) count += 1 if count >= 8: break # Exit the loop after 8 items are processed def findObjectById(parent, id): """ Recursively searches for a child object by its id. Returns the found object or None if not found. """ if str(parent.id) == id: return parent for child in object.children(parent): found = findObjectById(child, id) if found: return found return None def main(): utils.tstStart(__file__) # Set OS version application_init.setup_post_log_successful_start() test.startSection( "Launch Leahi application and Navigate to Device Settings Information screen" ) startApplication(config.AUT_NAME + "-q") navigate_to_device_settings_screen() navigate_to_information_screen() test.endSection() test.startSection("Verify the parameter under Information screen") verify_parameters_under_information() test.endSection() test.startSection("Set and Compare Information Parameters values") verify_td_and_dd_versions( td_major = 10, td_minor = 20, td_micro = 30, td_build = 4000, td_fpga_id = 50, td_fpga_major = 60, td_fpga_minor = 70, td_fpga_lab = 80, td_compatibility_rev = 9999, td_serial = "TD1234567890123", dd_major = 100, dd_minor = 95, dd_micro = 105, dd_build = 1000, dd_fpga_id = 124, dd_fpga_major = 75, dd_fpga_minor = 65, dd_fpga_lab = 125, dd_compatibility_rev = 4000, dd_serial = "DD1234567890123", ) test.endSection() test.startSection( "Set and Compare Information Parameters at their Maximum values") verify_td_and_dd_versions( td_major = 99, td_minor = 99, td_micro = 99, td_build = 99, td_fpga_id = 99, td_fpga_major = 99, td_fpga_minor = 99, td_fpga_lab = 99, td_compatibility_rev = 99, td_serial = "TD9876543210123", dd_major = 99, dd_minor = 99, dd_micro = 99, dd_build = 99, dd_fpga_id = 99, dd_fpga_major = 99, dd_fpga_minor = 99, dd_fpga_lab = 99, dd_compatibility_rev = 99, dd_serial = "DD9876543210123", ) test.endSection() test.startSection( "Set and Compare Information Parameters at their Minimum values") verify_td_and_dd_versions( td_major = 1, td_minor = 1, td_micro = 1, td_build = 1, td_fpga_id = 1, td_fpga_major = 1, td_fpga_minor = 1, td_fpga_lab = 1, td_compatibility_rev = 1, td_serial = "TD1", dd_major = 1, dd_minor = 1, dd_micro = 1, dd_build = 1, dd_fpga_id = 1, dd_fpga_major = 1, dd_fpga_minor = 1, dd_fpga_lab = 1, dd_compatibility_rev = 1, dd_serial = "DD1", ) test.endSection() test.startSection( "Set and Compare Information Parameters at their values Beyond the Maximum Allowed" ) verify_td_and_dd_versions( td_major = 102, td_minor = 102, td_micro = 102, td_build = 102, td_fpga_id = 102, td_fpga_major = 102, td_fpga_minor = 102, td_fpga_lab = 102, td_compatibility_rev = 102, td_serial = "TD9876543210123", dd_major = 102, dd_minor = 102, dd_micro = 102, dd_build = 102, dd_fpga_id = 102, dd_fpga_major = 102, dd_fpga_minor = 102, dd_fpga_lab = 102, dd_compatibility_rev = 102, dd_serial = "DD9876543210123", ) test.endSection() test.startSection( "Set and Compare Information Parameters at their values Below the Minimum Allowed" ) verify_td_and_dd_versions( td_major = 0, td_minor = 0, td_micro = 0, td_build = 0, td_fpga_id = 0, td_fpga_major = 0, td_fpga_minor = 0, td_fpga_lab = 0, td_compatibility_rev = 0, td_serial = "0", dd_major = 0, dd_minor = 0, dd_micro = 0, dd_build = 0, dd_fpga_id = 0, dd_fpga_major = 0, dd_fpga_minor = 0, dd_fpga_lab = 0, dd_compatibility_rev = 0, dd_serial = "0", ) test.endSection() utils.tstDone()