diff --git a/test/ui-test/src/drivers/SquishDriverVerification.py b/test/ui-test/src/drivers/SquishDriverVerification.py index 3ea713f678..a344f02e70 100644 --- a/test/ui-test/src/drivers/SquishDriverVerification.py +++ b/test/ui-test/src/drivers/SquishDriverVerification.py @@ -33,6 +33,9 @@ def verify_equal(result: object, expected: object): def verify(result: bool, msg: str): test.verify(result, msg) +def verify_values_equal(found: str, wanted: str, msg : str): + test.verify(found == wanted, msg + " Found: " + found + " - Wanted: " + wanted) + def verify_text_contains(text: str, substring: str): found = False if substring in text: diff --git a/test/ui-test/src/screens/SettingsScreen.py b/test/ui-test/src/screens/SettingsScreen.py index 50f4eb6d31..833f9cadf6 100644 --- a/test/ui-test/src/screens/SettingsScreen.py +++ b/test/ui-test/src/screens/SettingsScreen.py @@ -31,7 +31,13 @@ class WalletSettingsScreen(Enum): DELETE_ACCOUNT_CONFIRM: str = "settings_Wallet_AccountView_DeleteAccount_Confirm" NETWORKS_ITEM: str = "settings_Wallet_MainView_Networks" TESTNET_TOGGLE: str = "settings_Wallet_NetworksView_TestNet_Toggle" - + EDIT_ACCOUNT_BUTTON: str = "settings_Wallet_AccountView_EditAccountButton" + EDIT_ACCOUNT_NAME_INPUT: str = "settings_Wallet_AccountView_EditAccountNameInput" + EDIT_ACCOUNT_COLOR_REPEATER: str = "settings_Wallet_AccountView_EditAccountColorRepeater" + EDIT_ACCOUNT_SAVE_BUTTON: str = "settings_Wallet_AccountView_EditAccountSaveButton" + ACCOUNT_VIEW_ACCOUNT_NAME: str = "settings_Wallet_AccountView_AccountName" + ACCOUNT_VIEW_ICON_SETTINGS: str = "settings_Wallet_AccountView_IconSettings" + class ConfirmationDialog(Enum): SIGN_OUT_CONFIRMATION: str = "signOutConfirmation_StatusButton" @@ -102,4 +108,26 @@ class SettingsScreen: click_obj_by_name(ConfirmationDialog.SIGN_OUT_CONFIRMATION.value) def verify_the_app_is_closed(self): - verify_the_app_is_closed(SettingsScreen.__pid) \ No newline at end of file + verify_the_app_is_closed(SettingsScreen.__pid) + + def select_default_account(self): + accounts = get_obj(WalletSettingsScreen.GENERATED_ACCOUNTS.value) + click_obj(accounts.itemAtIndex(0)) + click_obj_by_name(WalletSettingsScreen.EDIT_ACCOUNT_BUTTON.value) + + def edit_account(self, account_name: str, account_color: str): + type(WalletSettingsScreen.EDIT_ACCOUNT_NAME_INPUT.value, account_name) + colorList = get_obj(WalletSettingsScreen.EDIT_ACCOUNT_COLOR_REPEATER.value) + for index in range(colorList.count): + color = colorList.itemAt(index) + if(color.radioButtonColor == account_color): + click_obj(colorList.itemAt(index)) + + click_obj_by_name(WalletSettingsScreen.EDIT_ACCOUNT_SAVE_BUTTON.value) + + + def verify_editedAccount(self, new_name: str, new_color: str): + accountName = get_obj(WalletSettingsScreen.ACCOUNT_VIEW_ACCOUNT_NAME.value) + iconSettings = get_obj(WalletSettingsScreen.ACCOUNT_VIEW_ICON_SETTINGS.value) + verify_values_equal(str(accountName.text), str(new_name), "Edited account name not updated") + verify_values_equal(str(iconSettings.icon.color.name), str(new_color.lower()), "Edited account color not updated") diff --git a/test/ui-test/testSuites/suite_status/shared/scripts/sections/settings_names.py b/test/ui-test/testSuites/suite_status/shared/scripts/sections/settings_names.py index 4fbab6c2d7..d856335861 100644 --- a/test/ui-test/testSuites/suite_status/shared/scripts/sections/settings_names.py +++ b/test/ui-test/testSuites/suite_status/shared/scripts/sections/settings_names.py @@ -15,6 +15,12 @@ settings_Wallet_AccountView_DeleteAccount_Confirm = {"container": statusDesktop_ mainWindow_ScrollView_2 = {"container": statusDesktop_mainWindow, "occurrence": 2, "type": "StatusScrollView", "unnamed": 1, "visible": True} settings_Wallet_MainView_Networks = {"container": statusDesktop_mainWindow, "objectName": "networksItem", "type": "StatusListItem"} settings_Wallet_NetworksView_TestNet_Toggle = {"container": statusDesktop_mainWindow, "objectName": "testnetModeSwitch", "type": "StatusSwitch"} +settings_Wallet_AccountView_EditAccountButton = {"container": statusDesktop_mainWindow, "type": "StatusFlatRoundButton", "objectName": "walletAccountViewEditAccountButton"} +settings_Wallet_AccountView_EditAccountNameInput = {"container": statusDesktop_mainWindow_overlay, "type": "TextEdit", "objectName": "renameAccountNameInput", "visible": True} +settings_Wallet_AccountView_EditAccountSaveButton = {"container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "objectName": "renameAccountModalSaveBtn"} +settings_Wallet_AccountView_EditAccountColorRepeater = {"container": statusDesktop_mainWindow, "type": "Repeater", "objectName": "statusColorRepeater", "visible": True} +settings_Wallet_AccountView_AccountName = {"container": statusDesktop_mainWindow, "type": "StatusBaseText", "objectName": "walletAccountViewAccountName"} +settings_Wallet_AccountView_IconSettings = {"container": statusDesktop_mainWindow, "type": "StatusSmartIdenticon", "objectName": "walletAccountViewAccountImage" , "visible": True} generatedAccounts_ListView = {"container": statusDesktop_mainWindow, "objectName": "generatedAccounts", "type": "ListView"} diff --git a/test/ui-test/testSuites/suite_status/shared/steps/settingsSteps.py b/test/ui-test/testSuites/suite_status/shared/steps/settingsSteps.py index 3f9490fc44..0e04fb7c40 100644 --- a/test/ui-test/testSuites/suite_status/shared/steps/settingsSteps.py +++ b/test/ui-test/testSuites/suite_status/shared/steps/settingsSteps.py @@ -30,6 +30,15 @@ def step(context: any, account_name: str): @When("the user toggles test networks") def step(context: any): _settingsScreen.toggle_test_networks() + +@When("the user selects the default account") +def step(context: any): + _settingsScreen.select_default_account() + +@When("the user edits default account to |any| name and |any| color") +def step(context: any, account_name: str, account_color: str): + _settingsScreen.edit_account(account_name, account_color) + @Then("the address |any| is displayed in the wallet") def step(context: any, address: str): @@ -39,6 +48,10 @@ def step(context: any, address: str): @Then("the account |any| is not in the list of accounts") def step(context: any, account_name): _settingsScreen.verify_no_account(account_name) + +@Then("the new account with name |any| and color |any| is updated") +def step(context, new_name: str, new_color: str): + _settingsScreen.verify_editedAccount(new_name, new_color) @When("the user clicks on Sign out and Quit") def step(context: any): diff --git a/test/ui-test/testSuites/suite_status/tst_wallet/test.feature b/test/ui-test/testSuites/suite_status/tst_wallet/test.feature index 52d37a1dff..c9705c3f55 100644 --- a/test/ui-test/testSuites/suite_status/tst_wallet/test.feature +++ b/test/ui-test/testSuites/suite_status/tst_wallet/test.feature @@ -89,3 +89,14 @@ Feature: Status Desktop Wallet # And the user toggles the network Ropsten # Then the user has a positive balance of ETH # And the user has a positive balance of STT + + Scenario Outline: User can edit the default wallet account + When the user opens app settings screen + And the user opens the wallet settings + And the user selects the default account + And the user edits default account to name and color + Then the new account with name Status account and color is updated + + Examples: + | new_name | new_color | + | Default | #FFCA0F | diff --git a/ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml b/ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml index 000ddd71ef..c962147106 100644 --- a/ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml +++ b/ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml @@ -48,6 +48,8 @@ StatusModal { StatusInput { id: accountNameInput + anchors.horizontalCenter: parent.horizontalCenter + input.edit.objectName: "renameAccountNameInput" input.isIconSelectable: true placeholderText: qsTr("Enter an account name...") input.text: currentAccount.name @@ -102,6 +104,7 @@ StatusModal { rightButtons: [ StatusButton { id: saveBtn + objectName: "renameAccountModalSaveBtn" text: qsTr("Change Name") enabled: accountNameInput.text !== "" && accountNameInput.valid diff --git a/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml b/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml index 74a0731252..7041fec408 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml +++ b/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml @@ -37,6 +37,7 @@ Item { spacing: Style.current.smallPadding StatusSmartIdenticon { id: accountImage + objectName: "walletAccountViewAccountImage" anchors.verticalCenter: parent.verticalCenter icon: StatusIconSettings { width: isLetterIdenticon ? 40 : 20 @@ -58,6 +59,7 @@ Item { Row { spacing: Style.current.halfPadding StatusBaseText { + objectName: "walletAccountViewAccountName" id: accountName text: walletStore.currentAccount.name font.weight: Font.Bold @@ -65,6 +67,7 @@ Item { color: Theme.palette.directColor1 } StatusFlatRoundButton { + objectName: "walletAccountViewEditAccountButton" width: 28 height: 28 anchors.verticalCenter: accountName.verticalCenter