test(@wallet): Add test for toggling network & balance

This commit is contained in:
Anthony Laibe 2022-08-08 12:07:29 +02:00 committed by Anthony Laibe
parent 505b242246
commit 2f7e6998bf
12 changed files with 99 additions and 26 deletions

View File

@ -42,6 +42,7 @@ pipeline {
STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'tar.gz')}"
/* Include library in order to compile the project */
LD_LIBRARY_PATH = "$QTDIR/lib:$WORKSPACE/vendor/status-go/build/bin:$WORKSPACE/vendor/status-keycard-go/build/libkeycard/"
INFURA_TOKEN = "cd313fedd0dd4699b194d72b5184be06"
}
stages {

View File

@ -85,6 +85,8 @@ def get_obj(objName: str):
obj = squish.findObject(getattr(names, objName))
return obj
def get_and_click_obj(obj_name: str):
click_obj(get_obj(obj_name))
# It executes the left-click action into object with given object name:
def click_obj_by_name(objName: str):

View File

@ -36,7 +36,10 @@ class SettingsScreen:
def __init__(self):
verify_screen(SidebarComponents.ADVANCED_OPTION.value)
def open_wallet_settings(self):
click_obj_by_name(SidebarComponents.WALLET_ITEM.value)
def activate_open_wallet_settings(self):
if not (is_Visible(SidebarComponents.WALLET_ITEM.value)) :
click_obj_by_name(SidebarComponents.ADVANCED_OPTION.value)
@ -44,7 +47,7 @@ class SettingsScreen:
click_obj_by_name(AdvancedOptionScreen.I_UNDERSTAND_POP_UP.value)
verify_object_enabled(SidebarComponents.WALLET_ITEM.value)
click_obj_by_name(SidebarComponents.WALLET_ITEM.value)
self.open_wallet_settings()
def activate_open_wallet_section(self):
if not (is_Visible(SidebarComponents.WALLET_ITEM.value)):
@ -78,7 +81,7 @@ class SettingsScreen:
def toggle_test_networks(self):
click_obj_by_name(WalletSettingsScreen.NETWORKS_ITEM.value)
click_obj_by_name(WalletSettingsScreen.TESTNET_TOGGLE.value)
get_and_click_obj(WalletSettingsScreen.TESTNET_TOGGLE.value)
def _find_account_index(self, account_name: str) -> int:
accounts = get_obj(WalletSettingsScreen.GENERATED_ACCOUNTS.value)

View File

@ -15,6 +15,13 @@ class MainWalletScreen(Enum):
ACCOUNT_NAME: str = "mainWallet_Account_Name"
SEND_BUTTON_FOOTER: str = "mainWallet_Footer_Send_Button"
SAVED_ADDRESSES_BUTTON: str = "mainWallet_Saved_Addresses_Button"
NETWORK_SELECTOR_BUTTON: str = "mainWallet_Network_Selector_Button"
class AssetView(Enum):
LIST: str = "mainWallet_Assets_View_List"
class NetworkSelectorPopup(Enum):
LAYER_1_REPEATER: str = "mainWallet_Network_Popup_Chain_Repeater_1"
class SavedAddressesScreen(Enum):
ADD_BUTTON: str = "mainWallet_Saved_Addreses_Add_Buttton"
@ -177,7 +184,8 @@ class StatusWalletScreen:
assert found != -1, "saved address not found"
# More icon is at index 2
# More icon is at index 2
time.sleep(1)
click_obj(list.itemAtIndex(found).components.at(2))
click_obj_by_name(SavedAddressesScreen.EDIT.value)
@ -193,11 +201,36 @@ class StatusWalletScreen:
assert found != -1, "saved address not found"
# More icon is at index 2
# More icon is at index 2
time.sleep(1)
click_obj(list.itemAtIndex(found).components.at(2))
click_obj_by_name(SavedAddressesScreen.DELETE.value)
click_obj_by_name(SavedAddressesScreen.CONFIRM_DELETE.value)
def toggle_network(self, network_name: str):
click_obj_by_name(MainWalletScreen.NETWORK_SELECTOR_BUTTON.value)
list = get_obj(NetworkSelectorPopup.LAYER_1_REPEATER.value)
for index in range(list.count):
if list.itemAt(index).objectName == network_name:
click_obj(list.itemAt(index))
click_obj_by_name(MainWalletScreen.ACCOUNT_NAME.value)
time.sleep(2)
return
assert False, "network name not found"
def verify_positive_balance(self, symbol: str):
list = get_obj(AssetView.LIST.value)
for index in range(list.count):
if list.itemAtIndex(index).objectName == symbol:
balance = list.itemAtIndex(index).children.at(2).text
assert balance != f"0 {symbol}", "balance is not positive"
return
assert False, "symbol not found"
def verify_saved_address_exists(self, name: str):
list = get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)

View File

@ -8,6 +8,13 @@ mainWallet_Account_Name = {"container": statusDesktop_mainWindow, "objectName":
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"}
mainWallet_Network_Selector_Button = {"container": statusDesktop_mainWindow, "objectName": "networkSelectorButton", "type": "StatusListItem"}
# Assets view:
mainWallet_Assets_View_List = {"container": statusDesktop_mainWindow, "objectName": "assetViewStatusListView", "type": "StatusListView"}
# Network selector popup
mainWallet_Network_Popup_Chain_Repeater_1 = {"container": statusDesktop_mainWindow, "objectName": "chainRepeaterLayer1", "type": "Repeater"}
# Send popup:
mainWallet_Footer_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton"}

View File

@ -10,6 +10,10 @@ _settingsScreen = SettingsScreen()
def step(context: any):
_statusMain.open_settings()
@When("the user opens the wallet settings")
def step(context: any):
_settingsScreen.open_wallet_settings()
@When("the user activates wallet and opens the wallet settings")
def step(context: any):
_settingsScreen.activate_open_wallet_settings()

View File

@ -43,6 +43,14 @@ def step(context, name, new_name):
def step(context, name):
_walletScreen.delete_saved_address(name)
@When("the user toggles the network |any|")
def step(context, network_name):
_walletScreen.toggle_network(network_name)
@Then("the user has a positive balance of |any|")
def step(context, symbol):
_walletScreen.verify_positive_balance(symbol)
@Then("the new account |any| is added")
def step(context, account_name):
_walletScreen.verify_account_name_is_present(account_name)

View File

@ -54,28 +54,38 @@ Feature: Status Desktop Wallet
| account_name |
| one |
# Scenario Outline: User adds a saved address
# When the user adds a saved address named <name> and address <address>
# Then the name <name> is in the list of saved addresses
Scenario Outline: User adds a saved address
When the user adds a saved address named <name> and address <address>
Then the name <name> is in the list of saved addresses
# Examples:
# | name | address |
# | one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
Examples:
| name | address |
| one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
# Scenario Outline: User can edit a saved address
# When the user adds a saved address named <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
Scenario Outline: User can edit a saved address
When the user adds a saved address named <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 |
Examples:
| name | address | new_name |
| bar | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | foo |
# Scenario Outline: User can delete a saved address
# When the user adds a saved address named <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
Scenario Outline: User can delete a saved address
When the user adds a saved address named <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 |
Examples:
| name | address |
| one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
Scenario: User can toggle network and see balances
When the user opens app settings screen
And the user opens the wallet settings
And the user toggles test networks
And the user opens wallet screen
And the user adds watch only account with one and 0x5fFa75CE51c3a7ebE23BdE37b5E3A0143DfBceE0
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

View File

@ -26,6 +26,7 @@ Item {
border.width: 1
border.color: Theme.palette.directColor7
color: "transparent"
objectName: "networkSelectorButton"
leftPadding: 12
rightPadding: 12
statusListItemTitle.font.pixelSize: 13

View File

@ -58,6 +58,7 @@ Popup {
Repeater {
id: chainRepeater1
objectName: "chainRepeaterLayer1"
model: popup.layer1Networks
delegate: chainItem
@ -99,6 +100,7 @@ Popup {
title: model.chainName
image.height: 24
image.width: 24
objectName: model.chainName
image.source: Style.svg(model.iconUrl)
onClicked: {
checkBox.checked = !checkBox.checked

View File

@ -8,6 +8,7 @@ import shared.panels 1.0
Item {
id: assetDelegate
objectName: symbol
QtObject {
id: _internal
@ -23,7 +24,7 @@ Item {
anchors.left: parent.left
visible: _internal.alwaysVisible.includes(symbol) || (networkVisible && enabledNetworkBalance > 0)
height: visible ? 40 + 2 * Style.current.padding : 0
Image {
id: assetInfoImage
width: 36

View File

@ -19,6 +19,7 @@ Item {
id: assetListView
anchors.fill: parent
model: account.assets
objectName: "assetViewStatusListView"
delegate: AssetDelegate {
locale: RootStore.locale
currency: RootStore.currentCurrency