test(@wallet): test add saved address

fixes #6761
This commit is contained in:
Anthony Laibe 2022-08-03 12:08:46 +02:00 committed by Anthony Laibe
parent c834bde150
commit a51c25e90e
8 changed files with 62 additions and 4 deletions

View File

@ -13,6 +13,16 @@ class MainWalletScreen(Enum):
ADD_ACCOUNT_BUTTON: str = "mainWallet_Add_Account"
ACCOUNT_NAME: str = "mainWallet_Account_Name"
SEND_BUTTON_FOOTER: str = "mainWallet_Footer_Send_Button"
SAVED_ADDRESSES_BUTTON: str = "mainWallet_Saved_Addresses_Button"
class SavedAddressesScreen(Enum):
ADD_BUTTON: str = "mainWallet_Saved_Addreses_Add_Buttton"
SAVED_ADDRESSES_LIST: str = "mainWallet_Saved_Addreses_List"
class AddSavedAddressPopup(Enum):
NAME_INPUT: str = "mainWallet_Saved_Addreses_Popup_Name_Input"
ADDRESS_INPUT: str = "mainWallet_Saved_Addreses_Popup_Address_Input"
ADD_BUTTON: str = "mainWallet_Saved_Addreses_Popup_Address_Add_Button"
class SendPopup(Enum):
SCROLL_BAR: str = "mainWallet_Send_Popup_Main"
@ -169,6 +179,21 @@ class StatusWalletScreen:
if(repeater.itemAt(index).objectName == object_name):
click_obj(repeater.itemAt(index))
break
def add_saved_address(self, name: str, address: str):
click_obj_by_name(MainWalletScreen.SAVED_ADDRESSES_BUTTON.value)
click_obj_by_name(SavedAddressesScreen.ADD_BUTTON.value)
type(AddSavedAddressPopup.NAME_INPUT.value, name)
type(AddSavedAddressPopup.ADDRESS_INPUT.value, address)
click_obj_by_name(AddSavedAddressPopup.ADD_BUTTON.value)
def verify_saved_address_exists(self, name: str):
list = get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
for index in range(list.count):
if list.itemAtIndex(index).objectName == name:
return
assert False, "no saved address found"
def verify_transaction(self):
print("TODO: fix notification and ensure there is one")

View File

@ -8,4 +8,4 @@ from sections.community_portal_names import *
from sections.login_names import *
from sections.onboarding_names import *
from sections.settings_names import *
from sections.wallet_names import *
from sections.wallet_names import *

View File

@ -7,6 +7,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}
signPhrase_Ok_Button = {"container": statusDesktop_mainWindow, "type": "StatusFlatButton", "objectName": "signPhraseModalOkButton", "visible": True}
mainWallet_Saved_Addresses_Button = {"container": statusDesktop_mainWindow, "objectName": "savedAddressesBtn", "type": "StatusButton"}
# Send popup:
mainWallet_Footer_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton"}
@ -45,3 +46,12 @@ mainWindow_Add_Account_Popup_Seed_Phrase_11 = {"container": mainWallet_Add_Accou
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}
# saved address view
mainWallet_Saved_Addreses_Add_Buttton = {"container": statusDesktop_mainWindow, "objectName": "addNewAddressBtn", "type": "StatusButton"}
mainWallet_Saved_Addreses_List = {"container": statusDesktop_mainWindow, "objectName": "savedAddresses", "type": "StatusListView"}
# saved address add popup
mainWallet_Saved_Addreses_Popup_Name_Input = {"container": statusDesktop_mainWindow, "objectName": "savedAddressNameInput", "type": "TextEdit"}
mainWallet_Saved_Addreses_Popup_Address_Input = {"container": statusDesktop_mainWindow, "objectName": "savedAddressAddressInput", "type": "StyledTextField"}
mainWallet_Saved_Addreses_Popup_Address_Add_Button = {"container": statusDesktop_mainWindow, "objectName": "addSavedAddress", "type": "StatusButton"}

View File

@ -31,11 +31,19 @@ def step(context, account_name, password, mnemonic):
def step(context, account_name, amount, token, chain_name, password):
_walletScreen.send_transaction(account_name, amount, token, chain_name, password)
@When("the user adds a saved address name |any| and address |any|")
def step(context, name, address):
_walletScreen.add_saved_address(name, address)
@Then("the new account |any| is added")
def step(context, account_name):
_walletScreen.verify_account_name_is_present(account_name)
@Then("the transaction is in progress")
def step(context):
_walletScreen.verify_transaction()
_walletScreen.verify_transaction()
@Then("the name |any| is in the list of saved addresses")
def step(context, name: str):
_walletScreen.verify_saved_address_exists(name)

View File

@ -52,4 +52,12 @@ Feature: Status Desktop Wallet
Examples:
| account_name |
| one |
| one |
Scenario Outline: User adds a saved address
When the user adds a saved address name <name> and address <address>
Then the name <name> is in the list of saved addresses
Examples:
| name | address |
| one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |

View File

@ -58,6 +58,7 @@ StatusDialog {
StatusInput {
id: nameInput
implicitWidth: parent.width
input.edit.objectName: "savedAddressNameInput"
minimumHeight: 56
maximumHeight: 56
placeholderText: qsTr("Enter a name")
@ -84,6 +85,7 @@ StatusDialog {
accounts: RootStore.accounts
contactsStore: root.contactsStore
label: qsTr("Address")
input.textField.objectName: "savedAddressAddressInput"
input.placeholderText: qsTr("Enter ENS Name or Ethereum Address")
labelFont.pixelSize: 15
labelFont.weight: Font.Normal
@ -105,6 +107,7 @@ StatusDialog {
text: root.edit ? qsTr("Save") : qsTr("Add address")
enabled: _internal.valid && _internal.dirty
onClicked: root.save(name, address)
objectName: "addSavedAddress"
}
}
}

View File

@ -127,6 +127,7 @@ Rectangle {
}
StatusButton {
objectName: "savedAddressesBtn"
size: StatusBaseButton.Size.Small
topPadding: Style.current.halfPadding
bottomPadding: Style.current.halfPadding

View File

@ -45,6 +45,7 @@ Item {
color: Theme.palette.directColor1
}
StatusButton {
objectName: "addNewAddressBtn"
id: btnAdd
anchors.right: parent.right
anchors.top: parent.top
@ -69,6 +70,7 @@ Item {
StatusListItem {
id: savedAddress
title: name
objectName: name
subTitle: name + " \u2022 " + Utils.getElidedCompressedPk(address)
implicitWidth: parent.width
color: "transparent"
@ -227,6 +229,7 @@ Item {
StatusListView {
id: listView
objectName: "savedAddresses"
anchors.top: errorMessage.bottom
anchors.topMargin: Style.current.padding
anchors.bottom: parent.bottom