fix(@desktop/wallet): Add Squish test for edit account

fixes #6754
This commit is contained in:
Khushboo Mehta 2022-08-10 11:23:06 +02:00 committed by Khushboo-dev-cpp
parent 46d10e7452
commit e9e0161e3c
7 changed files with 69 additions and 2 deletions

View File

@ -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:

View File

@ -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)
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")

View File

@ -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"}

View File

@ -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):

View File

@ -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 <new_name> name and <new_color> color
Then the new account with name <new_name>Status account and color <new_color> is updated
Examples:
| new_name | new_color |
| Default | #FFCA0F |

View File

@ -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

View File

@ -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