Index: suite_leahi/shared/scripts/configuration/application_init.py =================================================================== diff -u -r4f71dc71ca95ab916947fafdc17c9e1e4f74c47e -r4de5be406334f420c6a7fe8cc6347d73f45ba74a --- suite_leahi/shared/scripts/configuration/application_init.py (.../application_init.py) (revision 4f71dc71ca95ab916947fafdc17c9e1e4f74c47e) +++ suite_leahi/shared/scripts/configuration/application_init.py (.../application_init.py) (revision 4de5be406334f420c6a7fe8cc6347d73f45ba74a) @@ -187,3 +187,34 @@ aut_version = aut_name_and_version.split(" ") aut_version_only = aut_version[1] return aut_version_only + +def update_password_back_to_default_password(): + + base_path = Path.home() / "Public/luis/config/configurations/Settings/" + + source_file = base_path / "System.dflt" + target_file = base_path / "System.conf" + + # Read password from system.dflt + with open(source_file, 'r') as f: + for line in f: + if "Password =" in line: + # Extracts "jgs8273" from "Password = jgs8273" + new_password = line.split("=")[1].strip() + break + + # Read current system.conf lines + with open(target_file, 'r') as f: + conf_lines = f.readlines() + + # Update the password in system.conf memory + updated_lines = [] + for line in conf_lines: + if line.strip().startswith("Password"): + updated_lines.append(f"Password = {new_password}\n") + else: + updated_lines.append(line) + + # Write back to system.conf + with open(target_file, 'w') as f: + f.writelines(updated_lines) Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -rce164b0ef964275d2d15799391c031c4073e8d07 -r4de5be406334f420c6a7fe8cc6347d73f45ba74a --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision ce164b0ef964275d2d15799391c031c4073e8d07) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 4de5be406334f420c6a7fe8cc6347d73f45ba74a) @@ -50,8 +50,9 @@ # Settings Service DEFAULT_SERVICE_PASSWORD_RAW = "Atal.Matal.22leh" # TODO need to update if we ever change the default NEW_PASSWORD_RAW = "Test4.Ksah.sk43sa" +MANUFACTURING_SCREEN_TITLE_TEXT = "Manufacturing Setup" SERVICE_SCREEN_TITLE_TEXT = "Service" -USER_MODES_SCREEN_TITLE_TEXT = "User Modes" +ADVANCED_MODES_SCREEN_TITLE_TEXT = "Advanced Mode" DATE_AND_TIME_SCREEN_TITLE_TEXT = "Date and Time" DATE_AND_TIME_PARAMETERS_TEXTS = ["NTP", "(Network Time Protocol)", "Time", "(HH:mm:ss)", "Date", "(MM/dd/yyyy)"] ENABLE_ROOT_SSH_SCREEN_TITLE_TEXT = "Enable Root SSH" Index: suite_leahi/shared/scripts/configuration/navigation.py =================================================================== diff -u -r4e2b2a08fb10fb528e782a505eaab19f63874cc4 -r4de5be406334f420c6a7fe8cc6347d73f45ba74a --- suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision 4e2b2a08fb10fb528e782a505eaab19f63874cc4) +++ suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision 4de5be406334f420c6a7fe8cc6347d73f45ba74a) @@ -12,22 +12,20 @@ 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, + headerbar_container = squish.waitForObject(names.o_mainMenu_MainMenu, 2000) + settings_menu_object = utility.findChildByText( + headerbar_container, "Settings" ) if settings_menu_object is not None: squish.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, + headerbar_container = squish.waitForObject(names.o_headerBar_HeaderBar, 2000) + device_setting_screen_headerbar_title_text = utility.findChildByText( + headerbar_container, "Device Settings" ) - if device_setting_screen_title_text is not None: + if device_setting_screen_headerbar_title_text is not None: test.compare( - device_setting_screen_title_text.text, + 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 Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -rce164b0ef964275d2d15799391c031c4073e8d07 -r4de5be406334f420c6a7fe8cc6347d73f45ba74a --- suite_leahi/shared/scripts/names.py (.../names.py) (revision ce164b0ef964275d2d15799391c031c4073e8d07) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 4de5be406334f420c6a7fe8cc6347d73f45ba74a) @@ -39,9 +39,7 @@ o_treatmentTimeNotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "notification", "type": "NotificationBarSmall" } # settings_service_export_logs -o_listView_ListView = {"container": o_Gui_MainView, "id": "_listView", "type": "ListView", "unnamed": 1 } -o_listView_delegateControl = {"container": o_listView_ListView, "index": 2, "objectName": "delegateControl", "type": "Item" } -o_Settings_Menu = {"container": o_listView_delegateControl, "objectName": "_touchRect2", "type": "TouchRect" } +o_mainMenu_MainMenu = {"container": o_Gui_MainView, "id": "_mainMenu", "type": "MainMenu", "unnamed": 1 } o_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome" } o_SettingsExportLogs = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsExportLogs" } o_DeviceSettingsTitleText = {"container": o_SettingsHome, "id":"_titleText", "type": "Text", "unnamed": 1 } @@ -94,17 +92,18 @@ o_userConfirmation_TextInput = {"container": o_UserConfirmation_SettingsServicePassword, "echoMode": 2, "id": "_input", "passwordCharacter": "•", "type": "TextInput", "unnamed": 1 } o_headerBar_HeaderBar = {"container": o_Gui_MainView, "id": "_headerBar", "type": "HeaderBar", "unnamed": 1 } o_userConfirmation_ConfirmButton = {"container": o_UserConfirmation_SettingsServicePassword, "objectName": "_confirmButton", "type": "ConfirmButton" } -o_SettingsBase_SettingsUserMode = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsUserMode" } -o_SettingsBase_settingsUserMode_BaseSwitch = {"checkable": True, "container": o_SettingsBase_SettingsUserMode, "id": "_settingsUserMode", "type": "BaseSwitch", "unnamed": 1 } -o_SettingsBase_backButton_BackButton = {"container": o_SettingsBase_SettingsUserMode, "objectName": "_backButton", "type": "BackButton" } +o_SettingsHome_confirmButton = {"container": o_SettingsHome, "objectName": "_confirmButton", "type": "ConfirmButton" } +o_SettingsBase_SettingsAdvancedMode = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsAdvancedMode" } +o_settingsAdvancedMode_BaseSwitch = {"checkable": True, "container": o_SettingsBase_SettingsAdvancedMode, "id": "_settingsAdvancedMode", "type": "BaseSwitch", "unnamed": 1 } +o_SettingsBase_backButton_AdvancedMode = {"container": o_SettingsBase_SettingsAdvancedMode, "objectName": "_backButton", "type": "BackButton" } o_SettingsBase_SettingsDateTime = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsDateTime" } o_SettingsBase_ntpSwitch_BaseSwitch = {"checkable": True, "container": o_SettingsBase_SettingsDateTime, "id": "_ntpSwitch", "type": "BaseSwitch", "unnamed": 1 } -o_SettingsBase_backButton_BackButton_2 = {"container": o_SettingsBase_SettingsDateTime, "objectName": "_backButton", "type": "BackButton" } +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_backButton_BackButton_3 = {"container": o_SettingsBase_SettingsRootSSHAccess, "objectName": "_backButton", "type": "BackButton" } +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_BackButton = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_backButton", "type": "BackButton" } +o_userConfirmation_backButton_FactoryReset = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_backButton", "type": "BackButton" } o_factoryReset_ConfirmButton = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_confirmButton", "type": "ConfirmButton" } o_cancelTouch_TouchRect = {"container": o_Overlay, "id": "_cancelTouch", "type": "TouchRect", "unnamed": 1 } -o_confirmTouch_ConfirmButton = {"container": o_Overlay, "id": "_confirmTouch", "type": "ConfirmButton", "unnamed": 1 } \ No newline at end of file +o_confirmTouch_ConfirmButton = {"container": o_Overlay, "id": "_confirmTouch", "type": "ConfirmButton", "unnamed": 1 } 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()