diff --git a/ci/Jenkinsfile.uitests b/ci/Jenkinsfile.uitests index c1dff4694a..6ef6ec0dd8 100644 --- a/ci/Jenkinsfile.uitests +++ b/ci/Jenkinsfile.uitests @@ -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 { diff --git a/test/ui-test/src/drivers/SquishDriver.py b/test/ui-test/src/drivers/SquishDriver.py index 69124f6731..c5276a82df 100755 --- a/test/ui-test/src/drivers/SquishDriver.py +++ b/test/ui-test/src/drivers/SquishDriver.py @@ -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): diff --git a/test/ui-test/src/screens/SettingsScreen.py b/test/ui-test/src/screens/SettingsScreen.py index 930e0c9292..47c89fa9fc 100644 --- a/test/ui-test/src/screens/SettingsScreen.py +++ b/test/ui-test/src/screens/SettingsScreen.py @@ -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) diff --git a/test/ui-test/src/screens/StatusWalletScreen.py b/test/ui-test/src/screens/StatusWalletScreen.py index ff79fe2f82..5172a21cc4 100644 --- a/test/ui-test/src/screens/StatusWalletScreen.py +++ b/test/ui-test/src/screens/StatusWalletScreen.py @@ -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) diff --git a/test/ui-test/testSuites/suite_status/shared/scripts/sections/wallet_names.py b/test/ui-test/testSuites/suite_status/shared/scripts/sections/wallet_names.py index 6d29c4a171..3b1c659c7b 100644 --- a/test/ui-test/testSuites/suite_status/shared/scripts/sections/wallet_names.py +++ b/test/ui-test/testSuites/suite_status/shared/scripts/sections/wallet_names.py @@ -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"} diff --git a/test/ui-test/testSuites/suite_status/shared/steps/settingsSteps.py b/test/ui-test/testSuites/suite_status/shared/steps/settingsSteps.py index 5790299bc5..b11893d249 100644 --- a/test/ui-test/testSuites/suite_status/shared/steps/settingsSteps.py +++ b/test/ui-test/testSuites/suite_status/shared/steps/settingsSteps.py @@ -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() diff --git a/test/ui-test/testSuites/suite_status/shared/steps/walletSteps.py b/test/ui-test/testSuites/suite_status/shared/steps/walletSteps.py index 8a138a7343..c8a5a67adc 100644 --- a/test/ui-test/testSuites/suite_status/shared/steps/walletSteps.py +++ b/test/ui-test/testSuites/suite_status/shared/steps/walletSteps.py @@ -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) diff --git a/test/ui-test/testSuites/suite_status/tst_wallet/test.feature b/test/ui-test/testSuites/suite_status/tst_wallet/test.feature index 02d96093df..83761662ea 100644 --- a/test/ui-test/testSuites/suite_status/tst_wallet/test.feature +++ b/test/ui-test/testSuites/suite_status/tst_wallet/test.feature @@ -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 and address
- # Then the name is in the list of saved addresses + Scenario Outline: User adds a saved address + When the user adds a saved address named and address
+ Then the 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 and address
- # And the user edits a saved address with name to - # Then the name is in the list of saved addresses + Scenario Outline: User can edit a saved address + When the user adds a saved address named and address
+ And the user edits a saved address with name to + Then the 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 and address
- # And the user deletes the saved address with name - # Then the 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 and address
+ And the user deletes the saved address with name + Then the name is not in the list of saved addresses - # Examples: - # | name | address | - # | one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | \ No newline at end of file + 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 diff --git a/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml b/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml index 4d82b3de3e..1f4d69ff48 100644 --- a/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml +++ b/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml @@ -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 diff --git a/ui/app/AppLayouts/Wallet/popups/NetworkSelectPopup.qml b/ui/app/AppLayouts/Wallet/popups/NetworkSelectPopup.qml index f0ca36ae22..a793bbd6cc 100644 --- a/ui/app/AppLayouts/Wallet/popups/NetworkSelectPopup.qml +++ b/ui/app/AppLayouts/Wallet/popups/NetworkSelectPopup.qml @@ -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 diff --git a/ui/imports/shared/controls/AssetDelegate.qml b/ui/imports/shared/controls/AssetDelegate.qml index 712eb60bce..ac6869a931 100644 --- a/ui/imports/shared/controls/AssetDelegate.qml +++ b/ui/imports/shared/controls/AssetDelegate.qml @@ -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 diff --git a/ui/imports/shared/views/AssetsView.qml b/ui/imports/shared/views/AssetsView.qml index f64eb786c1..39ef27a338 100644 --- a/ui/imports/shared/views/AssetsView.qml +++ b/ui/imports/shared/views/AssetsView.qml @@ -19,6 +19,7 @@ Item { id: assetListView anchors.fill: parent model: account.assets + objectName: "assetViewStatusListView" delegate: AssetDelegate { locale: RootStore.locale currency: RootStore.currentCurrency