feat(@test): Add test for delete account

This commit is contained in:
Anthony Laibe 2022-07-20 10:18:27 +02:00 committed by Anthony Laibe
parent 499b9bd09e
commit 46f82f2c5e
12 changed files with 95 additions and 38 deletions

View File

@ -17,4 +17,7 @@ def verify_object_enabled(objName: str, timeout: int=_MIN_WAIT_OBJ_TIMEOUT, cond
def verify_text_matching(objName: str, text: str):
test.verify(is_text_matching(objName, text), True)
def verify_equal(result: object, expected: object):
test.verify(result == expected, True)

View File

@ -28,6 +28,9 @@ class WalletSettingsScreen(Enum):
TWELVE_SEED_PHRASE: str = "twelve_seed_phrase_address"
EIGHTEEN_SEED_PHRASE: str = "eighteen_seed_phrase_address"
TWENTY_FOUR_SEED_PHRASE: str = "twenty_four_seed_phrase_address"
GENERATED_ACCOUNTS: str = "settings_Wallet_MainView_GeneratedAccounts"
DELETE_ACCOUNT: str = "settings_Wallet_AccountView_DeleteAccount"
DELETE_ACCOUNT_CONFIRM: str = "settings_Wallet_AccountView_DeleteAccount_Confirm"
class SettingsScreen:
@ -52,7 +55,24 @@ class SettingsScreen:
verify_object_enabled(SidebarComponents.WALLET_ITEM.value)
click_obj_by_name(MainScreenComponents.WALLET_BUTTON.value)
def delete_account(self, account_name: str):
click_obj_by_name(SidebarComponents.WALLET_ITEM.value)
index = self._find_account_index(account_name)
if index == -1:
raise Exception("Account not found")
accounts = get_obj(WalletSettingsScreen.GENERATED_ACCOUNTS.value)
click_obj(accounts.itemAtIndex(index))
click_obj_by_name(WalletSettingsScreen.DELETE_ACCOUNT.value)
click_obj_by_name(WalletSettingsScreen.DELETE_ACCOUNT_CONFIRM.value)
def verify_no_account(self, account_name: str):
index = self._find_account_index(account_name)
verify_equal(index, -1)
def verify_address(self, phrase: str, address: str):
if phrase =='18':
verify_text_matching(WalletSettingsScreen.EIGHTEEN_SEED_PHRASE.value, address)
@ -64,3 +84,9 @@ class SettingsScreen:
verify_text_matching(WalletSettingsScreen.TWELVE_SEED_PHRASE.value, address)
def _find_account_index(self, account_name: str) -> int:
accounts = get_obj(WalletSettingsScreen.GENERATED_ACCOUNTS.value)
for index in range(accounts.count):
if(accounts.itemAtIndex(index).objectName == account_name):
return index
return -1

View File

@ -42,10 +42,10 @@ class AddAccountPopup(Enum):
class StatusWalletScreen:
def acceptSigningPhrase(self):
def accept_signing_phrase(self):
click_obj_by_name(SigningPhrasePopUp.OK_GOT_IT_BUTTON.value)
def addWatchOnlyAccount(self, account_name: str, address: str):
def add_watch_only_account(self, account_name: str, address: str):
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
type(AddAccountPopup.ACCOUNT_NAME_INPUT.value, account_name)
@ -58,7 +58,7 @@ class StatusWalletScreen:
type(AddAccountPopup.ADDRESS_INPUT.value, address)
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
def importPrivateKey(self, account_name: str, password: str, private_key: str):
def import_private_key(self, account_name: str, password: str, private_key: str):
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
type(AddAccountPopup.PASSWORD_INPUT.value, password)
@ -72,7 +72,7 @@ class StatusWalletScreen:
type(AddAccountPopup.PRIVATE_KEY_INPUT.value, private_key)
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
def importSeedPhrase(self, account_name: str, password: str, mnemonic: str):
def import_seed_phrase(self, account_name: str, password: str, mnemonic: str):
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
type(AddAccountPopup.PASSWORD_INPUT.value, password)
@ -109,7 +109,7 @@ class StatusWalletScreen:
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
def generateNewAccount(self, account_name: str, password: str):
def generate_new_account(self, account_name: str, password: str):
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
type(AddAccountPopup.PASSWORD_INPUT.value, password)
@ -118,6 +118,6 @@ class StatusWalletScreen:
time.sleep(2)
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
def verifyAccountNameIsPresent(self, account_name: str):
def verify_account_name_is_present(self, account_name: str):
verify_text_matching(MainWalletScreen.ACCOUNT_NAME.value, account_name)

View File

@ -51,7 +51,7 @@ join_public_chat_StatusMenuItemDelegate = {"checkable": False, "container": stat
chat_name_PlaceholderText = {"container": statusDesktop_mainWindow_overlay, "text": "chat-name", "type": "PlaceholderText", "unnamed": 1, "visible": True}
inputValue_StyledTextField = {"container": statusDesktop_mainWindow_overlay, "echoMode": 0, "id": "inputValue", "type": "StyledTextField", "unnamed": 1, "visible": True}
start_chat_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "text": "Start chat", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_scrollView_ScrollView = {"container": statusDesktop_mainWindow, "id": "scrollView", "type": "ScrollView", "unnamed": 1, "visible": True}
mainWindow_scrollView_ScrollView = {"container": statusDesktop_mainWindow, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
scrollView_messageInputField_TextArea = {"container": mainWindow_scrollView_ScrollView, "id": "messageInputField", "type": "TextArea", "unnamed": 1, "visible": True}
reactionImage_SVGImage = {"container": statusDesktop_mainWindow_overlay, "id": "reactionImage", "source": "qrc:/imports/assets/icons/emojiReactions/heart.svg", "type": "SVGImage", "unnamed": 1, "visible": True}
mainWindow_statusIcon_StatusIcon_2 = {"container": statusDesktop_mainWindow, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/public-chat.svg", "type": "StatusIcon", "unnamed": 1, "visible": True}
@ -91,12 +91,12 @@ i_understand_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "t
mainWindow_navBarListView_ListView = {"container": statusDesktop_mainWindow, "type": "ListView", "unnamed": 1, "visible": True}
navBarListView_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "occurrence": 4, "type": "StatusNavBarTabButton", "unnamed": 1, "visible": True}
statusIcon_StatusIcon_3 = {"container": navBarListView_StatusNavBarTabButton, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/settings.svg", "type": "StatusIcon", "unnamed": 1, "visible": True}
mainWindow_ScrollView = {"container": statusDesktop_mainWindow, "type": "ScrollView", "unnamed": 1, "visible": True}
mainWindow_ScrollView = {"container": statusDesktop_mainWindow, "type": "StatusScrollView", "unnamed": 1, "visible": True}
privacy_and_security_StatusBaseText = {"container": mainWindow_ScrollView, "text": "Privacy and security", "type": "StatusBaseText", "unnamed": 1, "visible": True}
settingsMenuDelegate_StatusNavigationListItem = {"container": mainWindow_ScrollView, "id": "settingsMenuDelegate", "occurrence": 4, "type": "StatusNavigationListItem", "unnamed": 1, "visible": True}
language_Currency_StatusBaseText = {"container": mainWindow_ScrollView, "text": "Language & Currency", "type": "StatusBaseText", "unnamed": 1, "visible": True}
advanced_StatusBaseText = {"container": mainWindow_ScrollView, "text": "Advanced", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_ScrollView_2 = {"container": statusDesktop_mainWindow, "occurrence": 2, "type": "ScrollView", "unnamed": 1, "visible": True}
advanced_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "Advanced", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_ScrollView_2 = {"container": statusDesktop_mainWindow, "occurrence": 2, "type": "StatusScrollView", "unnamed": 1, "visible": True}
o_StatusSettingsLineButton = {"container": mainWindow_ScrollView_2, "occurrence": 4, "type": "StatusSettingsLineButton", "unnamed": 1, "visible": True}
navBarListView_StatusNavBarTabButton_2 = {"checkable": True, "container": mainWindow_navBarListView_ListView, "occurrence": 2, "type": "StatusNavBarTabButton", "unnamed": 1, "visible": True}
statusIcon_StatusIcon_4 = {"container": navBarListView_StatusNavBarTabButton_2, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/settings.svg", "type": "StatusIcon", "unnamed": 1, "visible": True}
@ -147,8 +147,7 @@ get_started_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "te
mainWindow_submitBtn_StatusButton = {"container": statusDesktop_mainWindow, "id": "submitBtn", "type": "StatusButton", "unnamed": 1, "visible": True}
appearance_SettingsMenu_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": "Appearance-SettingsMenu", "type": "StatusNavigationListItem", "visible": True}
advanced_SettingsMenu_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": "Advanced-SettingsMenu", "type": "StatusNavigationListItem", "visible": True}
walletSettingsLineButton = {"container": mainWindow_ScrollView_2, "objectName": "WalletSettingsLineButton", "type": "StatusSettingsLineButton", "visible": True}
walletSettingsLineButton = {"container": statusDesktop_mainWindow, "objectName": "WalletSettingsLineButton", "type": "StatusSettingsLineButton", "visible": True}
navBarListView_Settings_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Settings-navbar", "type": "StatusNavBarTabButton", "visible": True}
settings_navbar_settings_icon_StatusIcon = {"container": navBarListView_Settings_navbar_StatusNavBarTabButton, "objectName": "settings-icon", "type": "StatusIcon", "visible": True}
@ -158,7 +157,7 @@ wallet_navbar_wallet_icon_StatusIcon = {"container": navBarListView_Wallet_navba
mainWallet_Account_Name = {"container": statusDesktop_mainWindow, "objectName": "accountName", "type": "StatusBaseText", "visible": True}
mainWallet_Add_Account = {"container": statusDesktop_mainWindow, "text": "Add account", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWallet_Add_Account_Popup_Main = {"container": statusDesktop_mainWindow, "objectName": "AddAccountModalContent", "type": "ScrollView", "visible": True}
mainWallet_Add_Account_Popup_Main = {"container": statusDesktop_mainWindow, "objectName": "AddAccountModalContent", "type": "StatusScrollView", "visible": True}
mainWallet_Add_Account_Popup_Password = {"container": mainWallet_Add_Account_Popup_Main, "text": "Enter your password...", "type": "PlaceholderText", "unnamed": 1, "visible": True}
mainWallet_Add_Account_Popup_Advanced = {"container": mainWallet_Add_Account_Popup_Main, "text": "Advanced", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWallet_Add_Account_Popup_Type_Selector = {"container": mainWallet_Add_Account_Popup_Main, "text": "Default", "type": "StatusBaseText", "unnamed": 1, "visible": True}
@ -182,4 +181,8 @@ mainWindow_Add_Account_Popup_Seed_Phrase_10 = {"container": mainWallet_Add_Accou
mainWindow_Add_Account_Popup_Seed_Phrase_11 = {"container": mainWallet_Add_Account_Popup_Main, "type": "StatusBaseText", "objectName": "seedPhraseInputPlaceholder11", "visible": True}
mainWallet_Add_Account_Popup_Footer = {"container": statusDesktop_mainWindow, "type": "StatusModalFooter", "unnamed": 1, "visible": True}
mainWallet_Add_Account_Popup_Footer_Add_Account = {"container": mainWallet_Add_Account_Popup_Footer, "text": "Add account", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWallet_Add_Account_Popup_Footer_Add_Account = {"container": mainWallet_Add_Account_Popup_Footer, "text": "Add account", "type": "StatusBaseText", "unnamed": 1, "visible": True}
settings_Wallet_MainView_GeneratedAccounts = {"container": statusDesktop_mainWindow, "objectName":'generatedAccounts', "type": 'ListView'}
settings_Wallet_AccountView_DeleteAccount = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "deleteAccountButton"}
settings_Wallet_AccountView_DeleteAccount_Confirm = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "confirmDeleteAccountButton"}

View File

@ -10,7 +10,6 @@ _settingsScreen =SettingsScreen()
def step(context: any):
_statusMain.open_settings()
@When("the user activates wallet and opens the wallet settings")
def step(context: any):
_settingsScreen.activate_open_wallet_settings()
@ -18,8 +17,18 @@ def step(context: any):
@When("the user activates wallet and opens the wallet section")
def step(context: any):
_settingsScreen.activate_open_wallet_section()
@When("the user deletes the account |any|")
def step(context: any, account_name: str):
_statusMain.open_settings()
_settingsScreen.delete_account(account_name)
@Then("the |any| seed phrase address is |any| displayed in the wallet")
def step(context: any, phrase :str, address: str):
_settingsScreen.verify_address(phrase, address)
@Then("the account |any| is not in the list of accounts")
def step(context: any, account_name):
_settingsScreen.verify_no_account(account_name)

View File

@ -4,24 +4,24 @@ _walletScreen = StatusWalletScreen()
@When("the user accept the signing phrase")
def step(context):
_walletScreen.acceptSigningPhrase()
_walletScreen.accept_signing_phrase()
@When("the user add watch only account with |any| and |any|")
@When("the user adds watch only account with |any| and |any|")
def step(context, account_name, address):
_walletScreen.addWatchOnlyAccount(account_name, address)
_walletScreen.add_watch_only_account(account_name, address)
@When("the user generate a new account with |any| and |any|")
@When("the user generates a new account with |any| and |any|")
def step(context, account_name, password):
_walletScreen.generateNewAccount(account_name, password)
_walletScreen.generate_new_account(account_name, password)
@When("the user import a private key with |any| and |any| and |any|")
@When("the user imports a private key with |any| and |any| and |any|")
def step(context, account_name, password, private_key):
_walletScreen.importPrivateKey(account_name, password, private_key)
_walletScreen.import_private_key(account_name, password, private_key)
@When("the user import a seed phrase with |any| and |any| and |any|")
@When("the user imports a seed phrase with |any| and |any| and |any|")
def step(context, account_name, password, mnemonic):
_walletScreen.importSeedPhrase(account_name, password, mnemonic)
_walletScreen.import_seed_phrase(account_name, password, mnemonic)
@Then("the new account |any| is added")
def step(context, account_name):
_walletScreen.verifyAccountNameIsPresent(account_name)
_walletScreen.verify_account_name_is_present(account_name)

View File

@ -10,8 +10,8 @@ Feature: Status Desktop Wallet
When the user activates wallet and opens the wallet section
When the user accept the signing phrase
Scenario Outline: User add a watch only account
When the user add watch only account with <account_name> and <address>
Scenario Outline: User adds a watch only account
When the user adds watch only account with <account_name> and <address>
Then the new account <account_name> is added
Examples:
@ -20,8 +20,8 @@ Feature: Status Desktop Wallet
| two | 0xf51ba8631618b9b3521ff4eb9adfd8a837455226 |
Scenario Outline: User generate a new account from wallet
When the user generate a new account with <account_name> and TesTEr16843/!@00
Scenario Outline: User generates a new account from wallet
When the user generates a new account with <account_name> and TesTEr16843/!@00
Then the new account <account_name> is added
Examples:
@ -29,18 +29,27 @@ Feature: Status Desktop Wallet
| one |
| two |
Scenario Outline: User import a private key
When the user import a private key with <account_name> and TesTEr16843/!@00 and <private_key>
Scenario Outline: User imports a private key
When the user imports a private key with <account_name> and TesTEr16843/!@00 and <private_key>
Then the new account <account_name> is added
Examples:
| account_name | private_key |
| one | 8da4ef21b864d2cc526dbdb2a120bd2874c36c9d0a1fb7f8c63d7f7a8b41de8f |
Scenario Outline: User import a seed phrase
When the user import a seed phrase with <account_name> and TesTEr16843/!@00 and <seed_phrase>
Scenario Outline: User imports a seed phrase
When the user imports a seed phrase with <account_name> and TesTEr16843/!@00 and <seed_phrase>
Then the new account <account_name> is added
Examples:
| account_name | seed_phrase |
| one | indoor dish desk flag debris potato excuse depart ticket judge file exit |
| one | indoor dish desk flag debris potato excuse depart ticket judge file exit |
Scenario Outline: User deletes a generated account
When the user generates a new account with <account_name> and TesTEr16843/!@00
And the user deletes the account <account_name>
Then the account <account_name> is not in the list of accounts
Examples:
| account_name |
| one |

View File

@ -13,6 +13,7 @@ StatusListItem {
title: account.name
subTitle: account.address
objectName: account.name
icon.color: account.color
icon.emoji: account.emoji
icon.name: !account.emoji ? "filled-account": ""

View File

@ -135,12 +135,14 @@ Item {
}
StatusButton {
objectName: "deleteAccountButton"
visible: walletStore.currentAccount.walletType !== ""
text: qsTr("Remove from your profile")
type: StatusBaseButton.Type.Danger
ConfirmationDialog {
id: confirmationPopup
confirmButtonObjectName: "confirmDeleteAccountButton"
header.title: qsTr("Confirm %1 Removal").arg(walletStore.currentAccount.name)
confirmationText: qsTr("You will not be able to restore viewing access to this account in the future unless you enter this accounts address again.")
confirmButtonLabel: qsTr("Remove Account")

View File

@ -99,7 +99,10 @@ Column {
bottomPadding: Style.current.halfPadding/2
}
Repeater {
ListView {
width: parent.width
height: childrenRect.height
objectName: "generatedAccounts"
model: walletStore.generatedAccounts
delegate: WalletAccountDelegate {
account: model

View File

@ -182,7 +182,6 @@ StatusModal {
textField.echoMode: TextInput.Password
validationError: root.passwordValidationError
textField.objectName: "accountModalPassword"
validationError: popup.passwordValidationError
inputLabel.font.pixelSize: 15
inputLabel.font.weight: Font.Normal
onTextChanged: {

View File

@ -16,6 +16,7 @@ StatusModal {
property var executeConfirm
property var executeReject
property var executeCancel
property string confirmButtonObjectName: ""
property string btnType: "warn"
property string confirmButtonLabel: qsTr("Confirm")
property string rejectButtonLabel: qsTr("Reject")
@ -99,6 +100,7 @@ StatusModal {
},
StatusButton {
id: confirmButton
objectName: confirmationDialog.confirmButtonObjectName
type: {
switch (confirmationDialog.btnType) {
case "warn":