Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -r4de5be406334f420c6a7fe8cc6347d73f45ba74a -r29b13ab71d918d768cabc78211bb586d947d0908 --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 4de5be406334f420c6a7fe8cc6347d73f45ba74a) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 29b13ab71d918d768cabc78211bb586d947d0908) @@ -4,7 +4,6 @@ AUT_NAME = "leahi -k -K -S -q" AUT_NAME_ONLY = "leahi" # Need only the AUT name for tst_ui_logs, do not add options -AUT_NAME_AND_ARGUMENT = "leahi -E" # Configuration application_init.py TMP_DIR = "/tmp/" Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rce164b0ef964275d2d15799391c031c4073e8d07 -r29b13ab71d918d768cabc78211bb586d947d0908 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision ce164b0ef964275d2d15799391c031c4073e8d07) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 29b13ab71d918d768cabc78211bb586d947d0908) @@ -1,6 +1,14 @@ import squish import test import object + +def aut(name, *args): + """ + Joins the executable name and argument + into a single command string + """ + return " ".join((name, *args)) + def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r4de5be406334f420c6a7fe8cc6347d73f45ba74a -r29b13ab71d918d768cabc78211bb586d947d0908 --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 4de5be406334f420c6a7fe8cc6347d73f45ba74a) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 29b13ab71d918d768cabc78211bb586d947d0908) @@ -101,6 +101,8 @@ o_SettingsBase_backButton_NTP_Switch = {"container": o_SettingsBase_SettingsDateTime, "objectName": "_backButton", "type": "BackButton" } o_timeContainer_LabelUnitContainer = {"container": o_SettingsBase_SettingsDateTime, "id": "_timeContainer", "type": "LabelUnitContainer", "unnamed": 1 } o_SettingsBase_SettingsRootSSHAccess = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsRootSSHAccess" } +o_SettingsBase_SSH_LoginSwitch = {"checkable": True, "container": o_SettingsBase_SettingsRootSSHAccess, "id": "_settingsRootSSHAccess_SSHDSwitch", "type": "BaseSwitch", "unnamed": 1 } +o_SettingsBase_Root_LoginSwitch = {"checkable": True, "container": o_SettingsBase_SettingsRootSSHAccess, "id": "_settingsRootSSHAccess_RootSwitch", "type": "BaseSwitch", "unnamed": 1 } o_SettingsBase_backButton_RootSSH = {"container": o_SettingsBase_SettingsRootSSHAccess, "objectName": "_backButton", "type": "BackButton" } o_userConfirmation_SettingsFactoryReset = {"container": o_Gui_MainView, "objectName": "UserConfirmation", "type": "SettingsFactoryReset" } o_userConfirmation_backButton_FactoryReset = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_backButton", "type": "BackButton" } Index: suite_leahi/tst_settings_service/test.py =================================================================== diff -u -r4de5be406334f420c6a7fe8cc6347d73f45ba74a -r29b13ab71d918d768cabc78211bb586d947d0908 --- suite_leahi/tst_settings_service/test.py (.../test.py) (revision 4de5be406334f420c6a7fe8cc6347d73f45ba74a) +++ suite_leahi/tst_settings_service/test.py (.../test.py) (revision 29b13ab71d918d768cabc78211bb586d947d0908) @@ -9,17 +9,17 @@ # 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 +# Enter Password and Click confirm Then Navigate to User Mode Screen and # Toggle the user mode, Verify Switch state and Click Back Button # 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 # 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 # 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 +# And Verify the parameter under Factory Reset screen and Click Confirm button +# for factory reset then Click Cancel on Popup. Again Click confirm on Factory Reset +# then Click confirm on Popup and Click Back Button import names @@ -81,8 +81,16 @@ currentApplicationContext().detach() test.endSection() + + +def verify_confirm_button_state(expected_state, message): + """Helper function to verify the enabled/disabled state using test.compare.""" + confirm_button = findObject(names.o_userConfirmation_ConfirmButton) + current_state = confirm_button.enabled + test.compare(current_state, expected_state, message) + def test_password_requirements_in_loop(new_pwd_input, expected_button_state, message): """ Helper function that iterates through the dynamic input fields @@ -110,14 +118,6 @@ verify_confirm_button_state(expected_button_state, message) -def verify_confirm_button_state(expected_state, message): - """Helper function to verify the enabled/disabled state using test.compare.""" - - confirm_button = findObject(names.o_userConfirmation_ConfirmButton) - current_state = confirm_button.enabled - test.compare(current_state, expected_state, message) - - def service_login(): test.startSection("Navigating to 'Service Login' menu") navigation.navigate_to_device_settings_screen() @@ -142,17 +142,17 @@ config.SERVICE_SCREEN_TITLE_TEXT ), ) - input_field = waitForObject(names.o_userConfirmation_TextInput) + input_field = waitForObject(names.o_userConfirmation_TextInput, 1000) type(input_field, config.DEFAULT_SERVICE_PASSWORD_RAW) - confirm_button = waitForObject(names.o_userConfirmation_ConfirmButton) + confirm_button = waitForObject(names.o_userConfirmation_ConfirmButton, 1000) mouseClick(confirm_button) - grid_container = waitForObject(names.o_DeviceSettingsGrid) - user_modes_option = utility.findChildByText(grid_container, "Advanced Mode") + grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) + advanced_modes_option = utility.findChildByText(grid_container, "Advanced Mode") - if user_modes_option is not None: - mouseClick(user_modes_option) + if advanced_modes_option is not None: + mouseClick(advanced_modes_option) headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) advanced_modes_screen_headerbar_title_text = utility.findChildByText( @@ -167,16 +167,15 @@ ), ) - # Wait for the toggle switch object + # Wait for the toggle Advanced Mode switch object advanced_mode_switch = waitForObject( names.o_settingsAdvancedMode_BaseSwitch, 1000 ) - # Check current state and toggle it - # store the initial state + # Check current state and toggle Advanced Mode Switch and store the initial state was_checked = advanced_mode_switch.checked - test.log(f"Initial switch state: {'Checked' if was_checked else 'Unchecked'}") + test.log(f"Initial Advanced Mode switch state: {'Checked' if was_checked else 'Unchecked'}") # Perform the toggle action mouseClick(advanced_mode_switch) @@ -186,15 +185,15 @@ test.compare( advanced_mode_switch.checked, expected_state, - f"Verify switch changed state to {expected_state}", + f"Verify Advanced Mode switch changed state to {expected_state}", ) - # Toggle it back to original state + # Toggle Advanced Mode Switch back to original state mouseClick(advanced_mode_switch) test.compare( advanced_mode_switch.checked, was_checked, - "Verify switch returned to original state", + "Verify Advanced Mode switch returned to original state", ) mouseClick(names.o_SettingsBase_backButton_AdvancedMode) @@ -255,14 +254,13 @@ f"'{date_and_time_parameter}' found and verified in Date and Time Screen", ) - # Wait for the toggle switch object + # Wait for the toggle NTP Mode switch object ntp_mode_switch = waitForObject(names.o_SettingsBase_ntpSwitch_BaseSwitch, 1000) - # Check current state and toggle it - # store the initial state + # Check current state and toggle NTP Mode Switch and store the initial state was_checked = ntp_mode_switch.checked - test.log(f"Initial switch state: {'Checked' if was_checked else 'Unchecked'}") + test.log(f"Initial NTP Mode switch state: {'Checked' if was_checked else 'Unchecked'}") # Perform the toggle action mouseClick(ntp_mode_switch) @@ -272,18 +270,26 @@ test.compare( ntp_mode_switch.checked, expected_state, - f"Verify switch changed state to {expected_state}", + f"Verify NTP Mode switch changed state to {expected_state}", ) - - # Toggle it back to original state + + # Toggle NTP Mode Switch back to original state mouseClick(ntp_mode_switch) test.compare( - ntp_mode_switch.checked, was_checked, "Verify switch returned to original state" + ntp_mode_switch.checked, was_checked, "Verify NTP Mode switch returned to original state" ) mouseClick(names.o_SettingsBase_backButton_NTP_Switch) +def verify_root_login_button_state(expected_state, message): + """Helper function to verify the enabled/disabled state using test.compare.""" + + root_login_button = findObject(names.o_SettingsBase_Root_LoginSwitch) + current_state = root_login_button.enabled + test.compare(current_state, expected_state, message) + + def enable_root_ssh_screen(): grid_container = waitForObject(names.o_DeviceSettingsGrid) enable_root_ssh_option = utility.findChildByText(grid_container, "Enable Root SSH") @@ -325,7 +331,61 @@ enable_root_ssh_parameter, f"'{enable_root_ssh_parameter}' found and verified in Enable Root SSH Screen", ) + + verify_root_login_button_state(config.DISABLED, "Comparison of Root Login Switch Button Disabled State") + + # Wait for the toggle SSH Login switch object + ssh_login_mode_switch = waitForObject(names.o_SettingsBase_SSH_LoginSwitch, 1000) + # Check current state and toggle SSH Login Switch and store the initial state + was_checked = ssh_login_mode_switch.checked + + test.log(f"Initial SSH Login switch state: {'Checked' if was_checked else 'Unchecked'}") + + # Perform the toggle action + mouseClick(ssh_login_mode_switch) + + # Verify the toggle state has inverted + expected_state = not was_checked + test.compare( + ssh_login_mode_switch.checked, + expected_state, + f"Verify SSH Login switch changed state to {expected_state}", + ) + + verify_root_login_button_state(config.ENABLED, "Comparison of Root Login Switch Button Enabled State") + + # Wait for the toggle Root Login switch object + root_login_switch = waitForObject(names.o_SettingsBase_Root_LoginSwitch, 1000) + + # Check current state and toggle Root Login Switch and store the initial state + root_login_was_checked = root_login_switch.checked + + test.log(f"Initial Root Login switch state: {'Checked' if was_checked else 'Unchecked'}") + + # Perform the toggle action + mouseClick(root_login_switch) + + # Verify the toggle state has inverted + root_login_expected_state = not root_login_was_checked + test.compare( + root_login_switch.checked, + root_login_expected_state, + f"Verify Root Login switch changed state to {root_login_expected_state}", + ) + + # Toggle Root Login Switch back to original state + mouseClick(root_login_switch) + test.compare( + root_login_switch.checked, root_login_was_checked, "Verify Root Login switch returned to original state" + ) + + # Toggle SSH Login Switch back to original state + mouseClick(ssh_login_mode_switch) + test.compare( + ssh_login_mode_switch.checked, was_checked, "Verify SSH Login switch returned to original state" + ) + mouseClick(names.o_SettingsBase_backButton_RootSSH) @@ -375,7 +435,7 @@ utils.tstStart(__file__) application_init.update_password_back_to_default_password() - startApplication(config.AUT_NAME_AND_ARGUMENT) + startApplication(utility.aut("leahi", "-E")) td_simulator.td_operation_mode(TDOpModes.MODE_SERV.value, 0) login_page_title_text = utility.get_object_from_names( names.o_loginPage_Titletext,