test(@wallet): edit/delete saved addresses
This commit is contained in:
parent
683bdb2da4
commit
c3e345445c
|
@ -18,6 +18,9 @@ class MainWalletScreen(Enum):
|
|||
class SavedAddressesScreen(Enum):
|
||||
ADD_BUTTON: str = "mainWallet_Saved_Addreses_Add_Buttton"
|
||||
SAVED_ADDRESSES_LIST: str = "mainWallet_Saved_Addreses_List"
|
||||
EDIT: str = "mainWallet_Saved_Addreses_More_Edit"
|
||||
DELETE: str = "mainWallet_Saved_Addreses_More_Delete"
|
||||
CONFIRM_DELETE: str = "mainWallet_Saved_Addreses_More_Confirm_Delete"
|
||||
|
||||
class AddSavedAddressPopup(Enum):
|
||||
NAME_INPUT: str = "mainWallet_Saved_Addreses_Popup_Name_Input"
|
||||
|
@ -186,7 +189,38 @@ class StatusWalletScreen:
|
|||
type(AddSavedAddressPopup.NAME_INPUT.value, name)
|
||||
type(AddSavedAddressPopup.ADDRESS_INPUT.value, address)
|
||||
click_obj_by_name(AddSavedAddressPopup.ADD_BUTTON.value)
|
||||
|
||||
def edit_saved_address(self, name: str, new_name: str):
|
||||
list = get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
||||
found = -1
|
||||
for index in range(list.count):
|
||||
if list.itemAtIndex(index).objectName == name:
|
||||
found = index
|
||||
|
||||
assert found != -1, "saved address not found"
|
||||
|
||||
# More icon is at index 2
|
||||
click_obj(list.itemAtIndex(found).components.at(2))
|
||||
|
||||
click_obj_by_name(SavedAddressesScreen.EDIT.value)
|
||||
type(AddSavedAddressPopup.NAME_INPUT.value, new_name)
|
||||
click_obj_by_name(AddSavedAddressPopup.ADD_BUTTON.value)
|
||||
|
||||
def delete_saved_address(self, name: str):
|
||||
list = get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
||||
found = -1
|
||||
for index in range(list.count):
|
||||
if list.itemAtIndex(index).objectName == name:
|
||||
found = index
|
||||
|
||||
assert found != -1, "saved address not found"
|
||||
|
||||
# More icon is at index 2
|
||||
click_obj(list.itemAtIndex(found).components.at(2))
|
||||
|
||||
click_obj_by_name(SavedAddressesScreen.DELETE.value)
|
||||
click_obj_by_name(SavedAddressesScreen.CONFIRM_DELETE.value)
|
||||
|
||||
def verify_saved_address_exists(self, name: str):
|
||||
list = get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
||||
for index in range(list.count):
|
||||
|
@ -194,6 +228,12 @@ class StatusWalletScreen:
|
|||
return
|
||||
|
||||
assert False, "no saved address found"
|
||||
|
||||
def verify_saved_address_doesnt_exist(self, name: str):
|
||||
list = get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
||||
for index in range(list.count):
|
||||
if list.itemAtIndex(index).objectName == name:
|
||||
assert False, "saved address found"
|
||||
|
||||
def verify_transaction(self):
|
||||
print("TODO: fix notification and ensure there is one")
|
||||
|
|
|
@ -50,8 +50,11 @@ mainWallet_Add_Account_Popup_Footer_Add_Account = {"container": mainWallet_Add_A
|
|||
# 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"}
|
||||
mainWallet_Saved_Addreses_More_Edit = {"container": statusDesktop_mainWindow, "objectName": "editSavedAddress", "type": "StatusMenuItemDelegate"}
|
||||
mainWallet_Saved_Addreses_More_Delete = {"container": statusDesktop_mainWindow, "objectName": "deleteSavedAddress", "type": "StatusMenuItemDelegate"}
|
||||
mainWallet_Saved_Addreses_More_Confirm_Delete = {"container": statusDesktop_mainWindow, "objectName": "confirmDeleteSavedAddress", "type": "StatusButton"}
|
||||
|
||||
# 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"}
|
||||
mainWallet_Saved_Addreses_Popup_Address_Add_Button = {"container": statusDesktop_mainWindow, "objectName": "addSavedAddress", "type": "StatusButton"}
|
||||
|
|
|
@ -31,10 +31,18 @@ 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|")
|
||||
@When("the user adds a saved address named |any| and address |any|")
|
||||
def step(context, name, address):
|
||||
_walletScreen.add_saved_address(name, address)
|
||||
|
||||
@When("the user edits a saved address with name |any| to |any|")
|
||||
def step(context, name, new_name):
|
||||
_walletScreen.edit_saved_address(name, new_name)
|
||||
|
||||
@When("the user deletes the saved address with name |any|")
|
||||
def step(context, name):
|
||||
_walletScreen.delete_saved_address(name)
|
||||
|
||||
@Then("the new account |any| is added")
|
||||
def step(context, account_name):
|
||||
_walletScreen.verify_account_name_is_present(account_name)
|
||||
|
@ -46,4 +54,7 @@ def step(context):
|
|||
@Then("the name |any| is in the list of saved addresses")
|
||||
def step(context, name: str):
|
||||
_walletScreen.verify_saved_address_exists(name)
|
||||
|
||||
|
||||
@Then("the name |any| is not in the list of saved addresses")
|
||||
def step(context, name: str):
|
||||
_walletScreen.verify_saved_address_doesnt_exist(name)
|
|
@ -58,6 +58,24 @@ Feature: Status Desktop Wallet
|
|||
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 |
|
||||
|
||||
Scenario Outline: User can edit a saved address
|
||||
When the user adds a saved address name <name> and address <address>
|
||||
And the user edits a saved address with name <name> to <new_name>
|
||||
Then the name <new_name><name> is in the list of saved addresses
|
||||
|
||||
Examples:
|
||||
| name | address | new_name |
|
||||
| bar | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | foo |
|
||||
|
||||
Scenario Outline: User can delete a saved address
|
||||
When the user adds a saved address name <name> and address <address>
|
||||
And the user deletes the saved address with name <name>
|
||||
Then the name <name> is not in the list of saved addresses
|
||||
|
||||
Examples:
|
||||
| name | address |
|
||||
| one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
|
|
@ -131,6 +131,7 @@ Item {
|
|||
}
|
||||
StatusMenuItem {
|
||||
text: qsTr("Edit")
|
||||
objectName: "editSavedAddress"
|
||||
iconSettings.name: "pencil-outline"
|
||||
onTriggered: {
|
||||
Global.openPopup(addEditSavedAddress,
|
||||
|
@ -146,6 +147,7 @@ Item {
|
|||
text: qsTr("Delete")
|
||||
type: StatusMenuItem.Type.Danger
|
||||
iconSettings.name: "delete"
|
||||
objectName: "deleteSavedAddress"
|
||||
onTriggered: {
|
||||
deleteAddressConfirm.name = editDeleteMenu.contactName;
|
||||
deleteAddressConfirm.address = editDeleteMenu.contactAddress;
|
||||
|
@ -200,6 +202,7 @@ Item {
|
|||
},
|
||||
StatusButton {
|
||||
type: StatusBaseButton.Type.Danger
|
||||
objectName: "confirmDeleteSavedAddress"
|
||||
text: qsTr("Delete")
|
||||
onClicked: {
|
||||
_internal.loading = true
|
||||
|
|
Loading…
Reference in New Issue