test(@wallet): Add test for toggling network & balance
This commit is contained in:
parent
505b242246
commit
2f7e6998bf
|
@ -42,6 +42,7 @@ pipeline {
|
||||||
STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'tar.gz')}"
|
STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'tar.gz')}"
|
||||||
/* Include library in order to compile the project */
|
/* 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/"
|
LD_LIBRARY_PATH = "$QTDIR/lib:$WORKSPACE/vendor/status-go/build/bin:$WORKSPACE/vendor/status-keycard-go/build/libkeycard/"
|
||||||
|
INFURA_TOKEN = "cd313fedd0dd4699b194d72b5184be06"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
|
@ -85,6 +85,8 @@ def get_obj(objName: str):
|
||||||
obj = squish.findObject(getattr(names, objName))
|
obj = squish.findObject(getattr(names, objName))
|
||||||
return obj
|
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:
|
# It executes the left-click action into object with given object name:
|
||||||
def click_obj_by_name(objName: str):
|
def click_obj_by_name(objName: str):
|
||||||
|
|
|
@ -36,7 +36,10 @@ class SettingsScreen:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
verify_screen(SidebarComponents.ADVANCED_OPTION.value)
|
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):
|
def activate_open_wallet_settings(self):
|
||||||
if not (is_Visible(SidebarComponents.WALLET_ITEM.value)) :
|
if not (is_Visible(SidebarComponents.WALLET_ITEM.value)) :
|
||||||
click_obj_by_name(SidebarComponents.ADVANCED_OPTION.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)
|
click_obj_by_name(AdvancedOptionScreen.I_UNDERSTAND_POP_UP.value)
|
||||||
verify_object_enabled(SidebarComponents.WALLET_ITEM.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):
|
def activate_open_wallet_section(self):
|
||||||
if not (is_Visible(SidebarComponents.WALLET_ITEM.value)):
|
if not (is_Visible(SidebarComponents.WALLET_ITEM.value)):
|
||||||
|
@ -78,7 +81,7 @@ class SettingsScreen:
|
||||||
|
|
||||||
def toggle_test_networks(self):
|
def toggle_test_networks(self):
|
||||||
click_obj_by_name(WalletSettingsScreen.NETWORKS_ITEM.value)
|
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:
|
def _find_account_index(self, account_name: str) -> int:
|
||||||
accounts = get_obj(WalletSettingsScreen.GENERATED_ACCOUNTS.value)
|
accounts = get_obj(WalletSettingsScreen.GENERATED_ACCOUNTS.value)
|
||||||
|
|
|
@ -15,6 +15,13 @@ class MainWalletScreen(Enum):
|
||||||
ACCOUNT_NAME: str = "mainWallet_Account_Name"
|
ACCOUNT_NAME: str = "mainWallet_Account_Name"
|
||||||
SEND_BUTTON_FOOTER: str = "mainWallet_Footer_Send_Button"
|
SEND_BUTTON_FOOTER: str = "mainWallet_Footer_Send_Button"
|
||||||
SAVED_ADDRESSES_BUTTON: str = "mainWallet_Saved_Addresses_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):
|
class SavedAddressesScreen(Enum):
|
||||||
ADD_BUTTON: str = "mainWallet_Saved_Addreses_Add_Buttton"
|
ADD_BUTTON: str = "mainWallet_Saved_Addreses_Add_Buttton"
|
||||||
|
@ -177,7 +184,8 @@ class StatusWalletScreen:
|
||||||
|
|
||||||
assert found != -1, "saved address not found"
|
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(list.itemAtIndex(found).components.at(2))
|
||||||
|
|
||||||
click_obj_by_name(SavedAddressesScreen.EDIT.value)
|
click_obj_by_name(SavedAddressesScreen.EDIT.value)
|
||||||
|
@ -193,11 +201,36 @@ class StatusWalletScreen:
|
||||||
|
|
||||||
assert found != -1, "saved address not found"
|
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(list.itemAtIndex(found).components.at(2))
|
||||||
|
|
||||||
click_obj_by_name(SavedAddressesScreen.DELETE.value)
|
click_obj_by_name(SavedAddressesScreen.DELETE.value)
|
||||||
click_obj_by_name(SavedAddressesScreen.CONFIRM_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):
|
def verify_saved_address_exists(self, name: str):
|
||||||
list = get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
list = get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
||||||
|
|
|
@ -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}
|
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}
|
signPhrase_Ok_Button = {"container": statusDesktop_mainWindow, "type": "StatusFlatButton", "objectName": "signPhraseModalOkButton", "visible": True}
|
||||||
mainWallet_Saved_Addresses_Button = {"container": statusDesktop_mainWindow, "objectName": "savedAddressesBtn", "type": "StatusButton"}
|
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:
|
# Send popup:
|
||||||
mainWallet_Footer_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton"}
|
mainWallet_Footer_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton"}
|
||||||
|
|
|
@ -10,6 +10,10 @@ _settingsScreen = SettingsScreen()
|
||||||
def step(context: any):
|
def step(context: any):
|
||||||
_statusMain.open_settings()
|
_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")
|
@When("the user activates wallet and opens the wallet settings")
|
||||||
def step(context: any):
|
def step(context: any):
|
||||||
_settingsScreen.activate_open_wallet_settings()
|
_settingsScreen.activate_open_wallet_settings()
|
||||||
|
|
|
@ -43,6 +43,14 @@ def step(context, name, new_name):
|
||||||
def step(context, name):
|
def step(context, name):
|
||||||
_walletScreen.delete_saved_address(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")
|
@Then("the new account |any| is added")
|
||||||
def step(context, account_name):
|
def step(context, account_name):
|
||||||
_walletScreen.verify_account_name_is_present(account_name)
|
_walletScreen.verify_account_name_is_present(account_name)
|
||||||
|
|
|
@ -54,28 +54,38 @@ Feature: Status Desktop Wallet
|
||||||
| account_name |
|
| account_name |
|
||||||
| one |
|
| one |
|
||||||
|
|
||||||
# Scenario Outline: User adds a saved address
|
Scenario Outline: User adds a saved address
|
||||||
# When the user adds a saved address named <name> and address <address>
|
When the user adds a saved address named <name> and address <address>
|
||||||
# Then the name <name> is in the list of saved addresses
|
Then the name <name> is in the list of saved addresses
|
||||||
|
|
||||||
# Examples:
|
Examples:
|
||||||
# | name | address |
|
| name | address |
|
||||||
# | one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
|
| one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
|
||||||
|
|
||||||
# Scenario Outline: User can edit a saved address
|
Scenario Outline: User can edit a saved address
|
||||||
# When the user adds a saved address named <name> and address <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>
|
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
|
Then the name <new_name><name> is in the list of saved addresses
|
||||||
|
|
||||||
# Examples:
|
Examples:
|
||||||
# | name | address | new_name |
|
| name | address | new_name |
|
||||||
# | bar | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | foo |
|
| bar | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | foo |
|
||||||
|
|
||||||
# Scenario Outline: User can delete a saved address
|
Scenario Outline: User can delete a saved address
|
||||||
# When the user adds a saved address named <name> and address <address>
|
When the user adds a saved address named <name> and address <address>
|
||||||
# And the user deletes the saved address with name <name>
|
And the user deletes the saved address with name <name>
|
||||||
# Then the name <name> is not in the list of saved addresses
|
Then the name <name> is not in the list of saved addresses
|
||||||
|
|
||||||
# Examples:
|
Examples:
|
||||||
# | name | address |
|
| name | address |
|
||||||
# | one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
|
| 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
|
||||||
|
|
|
@ -26,6 +26,7 @@ Item {
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: Theme.palette.directColor7
|
border.color: Theme.palette.directColor7
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
objectName: "networkSelectorButton"
|
||||||
leftPadding: 12
|
leftPadding: 12
|
||||||
rightPadding: 12
|
rightPadding: 12
|
||||||
statusListItemTitle.font.pixelSize: 13
|
statusListItemTitle.font.pixelSize: 13
|
||||||
|
|
|
@ -58,6 +58,7 @@ Popup {
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: chainRepeater1
|
id: chainRepeater1
|
||||||
|
objectName: "chainRepeaterLayer1"
|
||||||
model: popup.layer1Networks
|
model: popup.layer1Networks
|
||||||
|
|
||||||
delegate: chainItem
|
delegate: chainItem
|
||||||
|
@ -99,6 +100,7 @@ Popup {
|
||||||
title: model.chainName
|
title: model.chainName
|
||||||
image.height: 24
|
image.height: 24
|
||||||
image.width: 24
|
image.width: 24
|
||||||
|
objectName: model.chainName
|
||||||
image.source: Style.svg(model.iconUrl)
|
image.source: Style.svg(model.iconUrl)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
checkBox.checked = !checkBox.checked
|
checkBox.checked = !checkBox.checked
|
||||||
|
|
|
@ -8,6 +8,7 @@ import shared.panels 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: assetDelegate
|
id: assetDelegate
|
||||||
|
objectName: symbol
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: _internal
|
id: _internal
|
||||||
|
@ -23,7 +24,7 @@ Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
visible: _internal.alwaysVisible.includes(symbol) || (networkVisible && enabledNetworkBalance > 0)
|
visible: _internal.alwaysVisible.includes(symbol) || (networkVisible && enabledNetworkBalance > 0)
|
||||||
height: visible ? 40 + 2 * Style.current.padding : 0
|
height: visible ? 40 + 2 * Style.current.padding : 0
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: assetInfoImage
|
id: assetInfoImage
|
||||||
width: 36
|
width: 36
|
||||||
|
|
|
@ -19,6 +19,7 @@ Item {
|
||||||
id: assetListView
|
id: assetListView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: account.assets
|
model: account.assets
|
||||||
|
objectName: "assetViewStatusListView"
|
||||||
delegate: AssetDelegate {
|
delegate: AssetDelegate {
|
||||||
locale: RootStore.locale
|
locale: RootStore.locale
|
||||||
currency: RootStore.currentCurrency
|
currency: RootStore.currentCurrency
|
||||||
|
|
Loading…
Reference in New Issue