# Subject/Title: Device Settings - SW - 02 - Wifi - Q&R # # Functionalities: Testing items of Device Settings WiFi Screen # # Steps: # 1 Set OS version, start Leahi Application, simulate TD standby mode, # First, navigate to the Device Settings screen and Compare Device Settings title text # Then, navigate to the WiFi screen and Compare WiFi screen title text # 2 Verify the parameter under Device Settings WiFi screen # 3 Set and Compare Information Parameters texts # 4 Verify SCAN button is Disabled and Compare WiFi Screen Scan Button text # 5 Click on WiFi Screen Back Button to navigate back from WiFi Screen 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.common.td_defs import TDOpModes td_simulator = TD_Messaging() def text_obj(text): """ Method to set custom object property for WiFi screen. @param text: (string) parameter text """ names.o_SettingsBase_Information_Text["text"] = text return names.o_SettingsBase_Information_Text def navigate_to_device_settings_screen(): """ Method to navigate to "Device Settings" 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=3000, ) 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 findChildByText(parent_object, target_text): """Recursively finds a child object by its text property.""" for child in object.children(parent_object): if hasattr(child, "text") and str(child.text) == target_text: return child found = findChildByText(child, target_text) if found: return found return None def navigate_to_wifi_settings_screen(): grid_container = waitForObject(names.o_DeviceSettingsGrid) wifi_option = findChildByText(grid_container, "Wi-Fi") if wifi_option is not None: mouseClick(wifi_option) wifi_screen_title_text = utility.get_object_from_names( names.o_InformationPageTitleText, error_message="Wi-Fi screen title text object missing", timeout_ms=1000, ) if wifi_screen_title_text is not None: test.compare( wifi_screen_title_text.text, config.WIFI_TEXT, "{} screen is displayed and Comparison of WiFi Screen Title text".format( config.WIFI_TEXT ), ) def verify_wifi_setting_parameters(): """ Method to verify "Wi-Fi" screen in service """ test.startSection("Verifying Wi-Fi Setting Parameters") for wifi_parameter in config.WIFI_PARAMETERS_TEXTS: wifi_parameter_text = waitForObjectExists(text_obj(wifi_parameter)) test.compare( wifi_parameter_text.text, wifi_parameter, "{} should be available under Wi-Fi title".format(wifi_parameter), ) wifi_screen_scan_button = waitForObjectExists( names.o_SettingsBase_WifiScreen_ScanButton, 2000 ) if wifi_screen_scan_button is not None: test.compare( wifi_screen_scan_button.textString, config.WIFI_SCREEN_SCAN_BUTTON_TEXT, "{} button is displayed and Comparison of WiFi Screen Scan Button text".format( config.WIFI_SCREEN_SCAN_BUTTON_TEXT ), ) if wifi_screen_scan_button is True: test.compare( wifi_screen_scan_button.enabled, config.ENABLED, f"Check if the WiFi Screen Scan Button enabled = {config.ENABLED}", ) else: test.compare( wifi_screen_scan_button.enabled, config.DISABLED, f"Check if the WiFi Screen Scan Button disabled = {config.DISABLED}", ) wifi_screen_back_button = utility.get_object_from_names( names.o_SettingsBase_WifiScreen_BackButton, error_message="WiFi Screen Back Button missing", timeout_ms=1000, ) if wifi_screen_back_button is not None: mouseClick(wifi_screen_back_button) # Verify that UI navigated back to Device Setting Screen by Comparing Device Settings title after clicking on Back Button 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 after navigating back and Comparison of Device Settings Screen Title text".format( config.DEVICE_SETTINGS_SCREEN_TITLE_TEXT ), ) def main(): utils.tstStart(__file__) test.startSection( "Launch Leahi application and Navigate to Device Settings WiFi screen" ) startApplication(config.AUT_NAME + "-q") navigate_to_device_settings_screen() navigate_to_wifi_settings_screen() test.endSection() verify_wifi_setting_parameters() test.endSection()