Index: suite_leahi/tst_settings_service/test.py =================================================================== diff -u -rce164b0ef964275d2d15799391c031c4073e8d07 -r4de5be406334f420c6a7fe8cc6347d73f45ba74a --- suite_leahi/tst_settings_service/test.py (.../test.py) (revision ce164b0ef964275d2d15799391c031c4073e8d07) +++ suite_leahi/tst_settings_service/test.py (.../test.py) (revision 4de5be406334f420c6a7fe8cc6347d73f45ba74a) @@ -3,25 +3,27 @@ # Functionalities: Testing items of Service Screen # # Steps: -# 1 Start Leahi Application with Argument to navigate to Manufacturing Screen, +# 1 Update Password to Default Manufacture Password +# 2 Start Leahi Application with Argument to navigate to Manufacturing Screen, # simulate TD Service mode, and In Manufacture screen Reset Password -# 2 Start Leahi Application and Simulate TD Service mode, Compare Device Settings -# title text, navigate to the Screen screen and Compare Service Screen title and +# 3 Update Password to Default Manufacture Password +# 4 Start Leahi Application and simulate TD standby mode and navigate to the Device Settings screen +# then Simulate TD Service mode, navigate to the Screen screen and Compare Service Screen title and # Enter Password and Click conform Then Navigate to User Mode Screen and # Toggle the user mode, Verify Switch state and Click Back Button -# 3 Navigate to Date and Time Screen and verify and compare Title bar text +# 5 Navigate to Date and Time Screen and verify and compare Title bar text # And Verify the parameter under Date and Time screen, Toggle the NTP mode switch # Button and Verify Switch state, Click Back Button -# 4 Navigate to Enable Root SSH Screen and verify and compare Title bar text +# 6 Navigate to Enable Root SSH Screen and verify and compare Title bar text # And Verify the parameter under Enable Root SSH screen and Click Back Button -# 5 Navigate to Factory Reset Screen and verify and compare Title bar text +# 7 Navigate to Factory Reset Screen and verify and compare Title bar text # And Verify the parameter under Factory Reset screen and Click Conform button # for factory reset then Click Cancel on Popup. Again Click conform on Factory Reset # then Click conform on Popup and Click Back Button import names -from configuration import config, utility, navigation +from configuration import config, utility, navigation, application_init from leahi_dialin.ui import utils from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes, TDStandbyStates @@ -35,7 +37,18 @@ Method to navigate to "Manufacture Login" screen """ test.startSection("Navigating to 'Manufacture Login' menu") - + headerbar_container = waitForObject(names.o_headerBar_HeaderBar) + service_screen_headerbar_title_text = utility.findChildByText( + headerbar_container, "Manufacturing Setup" + ) + if service_screen_headerbar_title_text is not None: + test.compare( + service_screen_headerbar_title_text.text, + config.MANUFACTURING_SCREEN_TITLE_TEXT, + "{} screen is displayed and Comparison of Device Settings Screen Title text".format( + config.MANUFACTURING_SCREEN_TITLE_TEXT + ), + ) test_password_requirements_in_loop("a1b@C3d*E", False, "Missing 10 character (9 chars)") test_password_requirements_in_loop("noupper1@3", False, "Missing Upper Case") test_password_requirements_in_loop("NOLOWER1@3", False, "Missing Lower Case") @@ -56,6 +69,17 @@ type(input_field, config.NEW_PASSWORD_RAW) mouseClick(names.o_userConfirmation_ConfirmButton) + + confirm_button = utility.get_object_from_names( + names.o_SettingsHome_confirmButton, + "Error Missing Confirm Button", + 2000 + ) + if confirm_button is not None: + mouseClick(confirm_button) + + currentApplicationContext().detach() + test.endSection() @@ -96,19 +120,9 @@ def service_login(): test.startSection("Navigating to 'Service Login' menu") + navigation.navigate_to_device_settings_screen() + td_simulator.td_operation_mode(TDOpModes.MODE_SERV.value, 0) - headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) - device_setting_screen_headerbar_title_text = utility.findChildByText( - headerbar_container, "Device Settings" - ) - if device_setting_screen_headerbar_title_text is not None: - test.compare( - device_setting_screen_headerbar_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 - ), - ) grid_container = waitForObject(names.o_DeviceSettingsGrid) service_option = utility.findChildByText(grid_container, "Service") @@ -130,60 +144,60 @@ ) input_field = waitForObject(names.o_userConfirmation_TextInput) - type(input_field, config.NEW_PASSWORD_RAW) + type(input_field, config.DEFAULT_SERVICE_PASSWORD_RAW) confirm_button = waitForObject(names.o_userConfirmation_ConfirmButton) mouseClick(confirm_button) grid_container = waitForObject(names.o_DeviceSettingsGrid) - user_modes_option = utility.findChildByText(grid_container, "User Modes") + user_modes_option = utility.findChildByText(grid_container, "Advanced Mode") if user_modes_option is not None: mouseClick(user_modes_option) headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) - user_modes_screen_headerbar_title_text = utility.findChildByText( - headerbar_container, "Service" + advanced_modes_screen_headerbar_title_text = utility.findChildByText( + headerbar_container, "Advanced Mode" ) - if user_modes_screen_headerbar_title_text is not None: + if advanced_modes_screen_headerbar_title_text is not None: test.compare( - user_modes_screen_headerbar_title_text.text, - config.USER_MODES_SCREEN_TITLE_TEXT, + advanced_modes_screen_headerbar_title_text.text, + config.ADVANCED_MODES_SCREEN_TITLE_TEXT, "{} screen is displayed and Comparison of Device Settings Screen Title text".format( - config.USER_MODES_SCREEN_TITLE_TEXT + config.ADVANCED_MODES_SCREEN_TITLE_TEXT ), ) # Wait for the toggle switch object - user_mode_switch = waitForObject( - names.o_SettingsBase_settingsUserMode_BaseSwitch, 1000 + advanced_mode_switch = waitForObject( + names.o_settingsAdvancedMode_BaseSwitch, 1000 ) # Check current state and toggle it # store the initial state - was_checked = user_mode_switch.checked + was_checked = advanced_mode_switch.checked test.log(f"Initial switch state: {'Checked' if was_checked else 'Unchecked'}") # Perform the toggle action - mouseClick(user_mode_switch) + mouseClick(advanced_mode_switch) # Verify the toggle state has inverted expected_state = not was_checked test.compare( - user_mode_switch.checked, + advanced_mode_switch.checked, expected_state, f"Verify switch changed state to {expected_state}", ) # Toggle it back to original state - mouseClick(user_mode_switch) + mouseClick(advanced_mode_switch) test.compare( - user_mode_switch.checked, + advanced_mode_switch.checked, was_checked, "Verify switch returned to original state", ) - mouseClick(names.o_SettingsBase_backButton_BackButton) + mouseClick(names.o_SettingsBase_backButton_AdvancedMode) def date_and_time_screen(): @@ -267,7 +281,7 @@ ntp_mode_switch.checked, was_checked, "Verify switch returned to original state" ) - mouseClick(names.o_SettingsBase_backButton_BackButton_2) + mouseClick(names.o_SettingsBase_backButton_NTP_Switch) def enable_root_ssh_screen(): @@ -312,7 +326,7 @@ f"'{enable_root_ssh_parameter}' found and verified in Enable Root SSH Screen", ) - mouseClick(names.o_SettingsBase_backButton_BackButton_3) + mouseClick(names.o_SettingsBase_backButton_RootSSH) def factory_reset_screen(): @@ -354,11 +368,13 @@ mouseClick(names.o_cancelTouch_TouchRect) mouseClick(names.o_factoryReset_ConfirmButton) mouseClick(names.o_confirmTouch_ConfirmButton) - mouseClick(names.o_userConfirmation_backButton_BackButton) + mouseClick(names.o_userConfirmation_backButton_FactoryReset) def main(): utils.tstStart(__file__) + application_init.update_password_back_to_default_password() + startApplication(config.AUT_NAME_AND_ARGUMENT) td_simulator.td_operation_mode(TDOpModes.MODE_SERV.value, 0) login_page_title_text = utility.get_object_from_names( @@ -370,6 +386,8 @@ manufacture_login() else: closeWindow(names.o_Gui_MainView) + + application_init.update_password_back_to_default_password() startApplication(config.AUT_NAME) service_login()