From cc4c3cca76745253dc0cc42db133e566840e62f5 Mon Sep 17 00:00:00 2001 From: Valentina Novgorodtceva Date: Thu, 25 Jul 2024 11:10:22 +0700 Subject: [PATCH] test: default account values in send, bridge, receive popups --- .../wallet/asset_context_menu_popup.py | 27 +++++++ .../e2e/gui/components/wallet/bridge_popup.py | 34 +++++++++ .../gui/components/wallet/receive_popup.py | 33 +++++++++ test/e2e/gui/components/wallet/send_popup.py | 10 +++ test/e2e/gui/objects_map/names.py | 17 +++++ test/e2e/gui/objects_map/wallet_names.py | 2 + test/e2e/gui/screens/wallet.py | 20 +++++ ...t_footer_actions_default_account_values.py | 73 +++++++++++++++++++ .../AppLayouts/Wallet/panels/WalletFooter.qml | 4 + .../AppLayouts/Wallet/popups/ReceiveModal.qml | 3 + ui/imports/shared/popups/send/SendModal.qml | 2 + ui/imports/shared/views/AssetContextMenu.qml | 2 + 12 files changed, 227 insertions(+) create mode 100644 test/e2e/gui/components/wallet/asset_context_menu_popup.py create mode 100644 test/e2e/gui/components/wallet/bridge_popup.py create mode 100644 test/e2e/gui/components/wallet/receive_popup.py create mode 100644 test/e2e/tests/wallet_main_screen/wallet - footer actions/test_footer_actions_default_account_values.py diff --git a/test/e2e/gui/components/wallet/asset_context_menu_popup.py b/test/e2e/gui/components/wallet/asset_context_menu_popup.py new file mode 100644 index 0000000000..8a7082f5a7 --- /dev/null +++ b/test/e2e/gui/components/wallet/asset_context_menu_popup.py @@ -0,0 +1,27 @@ +import time + +import allure + +import configs +import driver +from gui.components.base_popup import BasePopup +from gui.components.wallet.send_popup import SendPopup +from gui.elements.object import QObject +from gui.objects_map import names + + +class AssetContextMenuPopup(BasePopup): + def __init__(self): + super(AssetContextMenuPopup, self).__init__() + self._send_item = QObject(names.send_StatusMenuItem) + self._receive_item = QObject(names.receive_StatusMenuItem) + + @allure.step('Click send item') + def click_send_item(self): + self._send_item.click() + return SendPopup().wait_until_appears() + + @allure.step('Click receive item') + def click_receive_item(self): + self._receive_item.click() + return self diff --git a/test/e2e/gui/components/wallet/bridge_popup.py b/test/e2e/gui/components/wallet/bridge_popup.py new file mode 100644 index 0000000000..f259557198 --- /dev/null +++ b/test/e2e/gui/components/wallet/bridge_popup.py @@ -0,0 +1,34 @@ +import allure + +import configs.timeouts +from gui.components.base_popup import BasePopup +from gui.elements.button import Button +from gui.elements.object import QObject +from gui.objects_map import names + + +class BridgePopup(BasePopup): + + def __init__(self): + super().__init__() + self._select_token_combobox = QObject(names.holdingSelector_TokenSelectorNew) + self._bridge_header = QObject(names.modalHeader_HeaderTitleText) + self._account_selector = QObject(names.accountSelector_AccountSelectorHeader) + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._select_token_combobox.wait_until_appears(timeout_msec) + return self + + @allure.step('Click account selector combobox') + def click_account_selector(self): + self._account_selector.click() + return self + + @allure.step('Get current text from header') + def get_text_from_bridge_header(self) -> str: + return str(self._bridge_header.object.text) + + @allure.step('Get current text in account selector') + def get_text_from_account_selector(self) -> str: + return str(self._account_selector.object.currentText) diff --git a/test/e2e/gui/components/wallet/receive_popup.py b/test/e2e/gui/components/wallet/receive_popup.py new file mode 100644 index 0000000000..c567ebf7b8 --- /dev/null +++ b/test/e2e/gui/components/wallet/receive_popup.py @@ -0,0 +1,33 @@ +import allure + +import configs.timeouts +from gui.components.base_popup import BasePopup +from gui.elements.button import Button +from gui.elements.object import QObject +from gui.objects_map import names + + +class ReceivePopup(BasePopup): + + def __init__(self): + super().__init__() + self._eth_icon = QObject(names.networkTagRectangle_eth_Rectangle) + self._oeth_icon = QObject(names.networkTagRectangle_oeth_Rectangle) + self._arb_icon = QObject(names.networkTagRectangle_arb1_Rectangle) + self._multichain_tab_button = Button(names.tabBar_Multichain_StatusSwitchTabButton) + self._account_selector = QObject(names.accountSelector_AccountSelectorHeader) + self._account_selector_text = QObject(names.textContent_StatusBaseText) + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._multichain_tab_button.wait_until_appears(timeout_msec) + return self + + @allure.step('Click account selector combobox') + def click_account_selector(self): + self._account_selector.click() + return self + + @allure.step('Get current text in account selector') + def get_text_from_account_selector(self) -> str: + return str(self._account_selector_text.object.text) diff --git a/test/e2e/gui/components/wallet/send_popup.py b/test/e2e/gui/components/wallet/send_popup.py index 1420e416ec..c3ca2654ee 100644 --- a/test/e2e/gui/components/wallet/send_popup.py +++ b/test/e2e/gui/components/wallet/send_popup.py @@ -32,6 +32,16 @@ class SendPopup(BasePopup): self._mainnet_network = QObject(names.mainnet_StatusListItem) self._fiat_fees_label = TextLabel(names.fiatFees_StatusBaseText) self._send_button = Button(names.send_StatusFlatButton) + self._account_selector = QObject(names.accountSelector_AccountSelectorHeader) + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._ens_address_text_edit.wait_until_appears(timeout_msec) + return self + + @allure.step('Get current text in account selector') + def get_text_from_account_selector(self) -> str: + return str(self._account_selector.object.currentText) @allure.step('Select asset or collectible by name') def _select_asset_or_collectible(self, name: str, tab: str, attempts: int = 2): diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index 348f4cc913..f9dd9b2eaa 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -513,6 +513,23 @@ send_StatusFlatButton = {"checkable": False, "container": statusDesktop_mainWind o_SearchBoxWithRightIcon = {"container": statusDesktop_mainWindow_overlay, "type": "SearchBoxWithRightIcon", "unnamed": 1, "visible": True} search_TextEdit = {"container": o_SearchBoxWithRightIcon, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} +# Assets Context Menu popup +send_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "sendMenuItem", "type": "StatusMenuItem", "visible": True} +receive_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "receiveMenuItem", "type": "StatusMenuItem", "visible": True} + +# Receive popup +networkTagRectangle_eth_Rectangle = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_eth", "type": "Rectangle", "visible": True} +networkTagRectangle_oeth_Rectangle = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_oeth", "type": "Rectangle", "visible": True} +networkTagRectangle_arb1_Rectangle = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_arb1", "type": "Rectangle", "visible": True} +tabBar_StatusSwitchTabBar = {"container": statusDesktop_mainWindow_overlay, "id": "tabBar", "type": "StatusSwitchTabBar", "unnamed": 1, "visible": True} +tabBar_Multichain_StatusSwitchTabButton = {"checkable": True, "container": tabBar_StatusSwitchTabBar, "objectName": "multichainButton", "type": "StatusSwitchTabButton", "visible": True} +accountSelector_AccountSelectorHeader = {"container": statusDesktop_mainWindow_overlay, "objectName": "accountSelector", "type": "AccountSelectorHeader", "visible": True} +textContent_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "objectName": "textContent", "type": "StatusBaseText", "visible": True} + +# Bridge popup +holdingSelector_TokenSelectorNew = {"container": statusDesktop_mainWindow_overlay, "objectName": "holdingSelector", "type": "TokenSelectorNew", "visible": True} +modalHeader_HeaderTitleText = {"container": statusDesktop_mainWindow_overlay, "objectName": "modalHeader", "type": "HeaderTitleText", "visible": True} + # Verify identity popup profileSendContactRequestModal_sayWhoYouAreInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sayWhoYouAreInput", "type": "TextEdit", "visible": True} send_verification_request_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sendContactRequestButton", "type": "StatusButton", "visible": True} diff --git a/test/e2e/gui/objects_map/wallet_names.py b/test/e2e/gui/objects_map/wallet_names.py index 2848a01638..20168d4d4a 100644 --- a/test/e2e/gui/objects_map/wallet_names.py +++ b/test/e2e/gui/objects_map/wallet_names.py @@ -27,6 +27,8 @@ savedAddresses_area = {"container": mainWindow_SavedAddressesView_2, "objectName mainWindow_RightTabView = {"container": statusDesktop_mainWindow, "type": "RightTabView", "unnamed": 1, "visible": True} mainWallet_Account_Name = {"container": mainWindow_RightTabView, "objectName": "walletHeaderTitle", "type": "StatusBaseText", "visible": True} mainWindow_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton", "visible": True} +mainWindow_Receive_Button = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "walletFooterReceiveButton", "type": "StatusFlatButton", "visible": True} +mainWindow_Bridge_Button = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "walletFooterBridgeButton", "type": "StatusFlatButton", "visible": True} mainWindow_RightTabView = {"container": statusDesktop_mainWindow, "type": "RightTabView", "unnamed": 1, "visible": True} filterButton_StatusFlatButton = {"checkable": True, "container": mainWindow_RightTabView, "objectName": "filterButton", "type": "StatusFlatButton", "visible": True} cmbTokenOrder_SortOrderComboBox = {"container": mainWindow_RightTabView, "objectName": "cmbTokenOrder", "type": "SortOrderComboBox", "visible": True} diff --git a/test/e2e/gui/screens/wallet.py b/test/e2e/gui/screens/wallet.py index dac99ec29e..864baa0bb6 100644 --- a/test/e2e/gui/screens/wallet.py +++ b/test/e2e/gui/screens/wallet.py @@ -10,7 +10,10 @@ from driver.objects_access import walk_children from gui.components.base_popup import BasePopup from gui.components.context_menu import ContextMenu from gui.components.wallet.add_saved_address_popup import AddressPopup, EditSavedAddressPopup +from gui.components.wallet.asset_context_menu_popup import AssetContextMenuPopup +from gui.components.wallet.bridge_popup import BridgePopup from gui.components.wallet.confirmation_popup import ConfirmationPopup +from gui.components.wallet.receive_popup import ReceivePopup from gui.components.wallet.remove_wallet_account_popup import RemoveWalletAccountPopup from gui.components.wallet.send_popup import SendPopup from gui.components.wallet.wallet_account_popups import AccountPopup @@ -196,6 +199,8 @@ class WalletAccountView(QObject): self._account_name_text_label = TextLabel(wallet_names.mainWallet_Account_Name) self._addresses_panel = QObject(names.mainWallet_Address_Panel) self._send_button = Button(wallet_names.mainWindow_Send_Button) + self._receive_button = Button(wallet_names.mainWindow_Receive_Button) + self._bridge_button = Button(wallet_names.mainWindow_Bridge_Button) self._filter_button = Button(wallet_names.filterButton_StatusFlatButton) self._assets_combobox = List(wallet_names.cmbTokenOrder_SortOrderComboBox) self._assets_tab_button = Button(wallet_names.rightSideWalletTabBar_Assets_StatusTabButton) @@ -224,6 +229,16 @@ class WalletAccountView(QObject): self._send_button.click() return SendPopup().wait_until_appears() + @allure.step('Open bridge popup') + def open_bridge_popup(self) -> BridgePopup: + self._bridge_button.click() + return BridgePopup().wait_until_appears() + + @allure.step('Open receive popup') + def open_receive_popup(self) -> ReceivePopup: + self._receive_button.click() + return ReceivePopup().wait_until_appears() + @allure.step('Open assets tab') def open_assets_tab(self): self._assets_tab_button.click() @@ -271,6 +286,11 @@ class WalletAccountView(QObject): sorted(token_list_items, key=lambda item: item.y) return token_list_items + @allure.step('Open asset context menu') + def open_asset_context_menu(self, index: int): + QObject(real_name=driver.objectMap.realName(self.get_list_of_assets()[index])).right_click() + return AssetContextMenuPopup().wait_until_appears() + @allure.step('Get list of collectibles') def get_list_of_collectibles(self) -> typing.List: time.sleep(1) diff --git a/test/e2e/tests/wallet_main_screen/wallet - footer actions/test_footer_actions_default_account_values.py b/test/e2e/tests/wallet_main_screen/wallet - footer actions/test_footer_actions_default_account_values.py new file mode 100644 index 0000000000..68a4847cc6 --- /dev/null +++ b/test/e2e/tests/wallet_main_screen/wallet - footer actions/test_footer_actions_default_account_values.py @@ -0,0 +1,73 @@ +import allure +import pytest +from allure_commons._allure import step + +import configs +import constants +import driver +from constants.wallet import WalletTransactions +from gui.components.onboarding.before_started_popup import BeforeStartedPopUp +from gui.components.onboarding.beta_consent_popup import BetaConsentPopup +from gui.components.signing_phrase_popup import SigningPhrasePopup +from gui.components.splash_screen import SplashScreen +from gui.components.authenticate_popup import AuthenticatePopup +from gui.screens.onboarding import KeysView, WelcomeToStatusView, BiometricsView, YourEmojihashAndIdenticonRingView + + +@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704527', + 'Send: can send 0 ETH to address pasted into receiver field with Simple flow') +@pytest.mark.case(704527) +@pytest.mark.transaction +@pytest.mark.parametrize('default_name, address, name, color, emoji', [ + pytest.param('Account 1', '0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'AccWatch1', '#2a4af5', 'sunglasses') +]) +def test_wallet_modals_default_account_values(main_screen, default_name, address, name, color, emoji): + with step('Add watched address with plus action button'): + wallet = main_screen.left_panel.open_wallet() + SigningPhrasePopup().wait_until_appears().confirm_phrase() + account_popup = wallet.left_panel.open_add_account_popup() + account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_watched_address(address).save_changes() + account_popup.wait_until_hidden() + + with step('Change account order to have watched account first'): + account_order = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_order() + account_order.drag_account(name, 0) + + with step('Open wallet and choose default account'): + wallet = main_screen.left_panel.open_wallet() + wallet_account = wallet.left_panel.select_account(default_name) + + with step('Verify that default account is chosen in send, receive and bridge popups opened from footer'): + send_popup = wallet_account.open_send_popup().wait_until_appears() + assert send_popup.get_text_from_account_selector() == default_name + main_screen.left_panel.click() + + bridge_popup = wallet_account.open_bridge_popup().wait_until_appears() + assert bridge_popup.get_text_from_account_selector() == default_name + main_screen.left_panel.click() + + receive_popup = wallet_account.open_receive_popup().wait_until_appears() + assert receive_popup.get_text_from_account_selector() == default_name + main_screen.left_panel.click() + + with step('Verify that default account is chosen in send, receive and bridge popups opened from asset context menu'): + wallet_account.open_asset_context_menu(0).click_send_item() + assert send_popup.get_text_from_account_selector() == default_name + main_screen.left_panel.click() + + wallet_account.open_asset_context_menu(0).click_receive_item() + assert receive_popup.get_text_from_account_selector() == default_name + main_screen.left_panel.click() + + with step('Choose watched account'): + wallet_account = wallet.left_panel.select_account(name) + + with step('Verify that watched account is chosen in receive popup'): + receive_popup = wallet_account.open_receive_popup().wait_until_appears() + assert receive_popup.get_text_from_account_selector() == name + main_screen.left_panel.click() + + with step('Verify that watched account is chosen in receive popup opened from asset context menu'): + wallet_account.open_asset_context_menu(0).click_receive_item() + assert receive_popup.get_text_from_account_selector() == name + main_screen.left_panel.click() diff --git a/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml b/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml index 00a317a261..5fb6b884c1 100644 --- a/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml +++ b/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml @@ -114,6 +114,7 @@ Rectangle { } StatusFlatButton { + objectName: "walletFooterReceiveButton" icon.name: "receive" text: qsTr("Receive") visible: d.receiveActionAvailable @@ -124,6 +125,7 @@ Rectangle { } StatusFlatButton { + objectName: "walletFooterBridgeButton" icon.name: "bridge" text: qsTr("Bridge") interactive: !d.isCollectibleSoulbound && networkConnectionStore.sendBuyBridgeEnabled @@ -134,6 +136,7 @@ Rectangle { StatusFlatButton { id: buySellBtn + objectName: "walletFooterBuyButton" visible: d.buyActionAvailable icon.name: "token" @@ -143,6 +146,7 @@ Rectangle { StatusFlatButton { id: swap + objectName: "walletFooterSwapButton" interactive: !d.isCollectibleSoulbound && networkConnectionStore.sendBuyBridgeEnabled visible: d.swapActionAvailable diff --git a/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml b/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml index 8911b4b17f..a4931f785a 100644 --- a/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml @@ -188,9 +188,11 @@ StatusModal { currentIndex: 1 StatusSwitchTabButton { + objectName: "legacyButton" text: qsTr("Legacy") } StatusSwitchTabButton { + objectName: "multichainButton" text: qsTr("Multichain") } } @@ -232,6 +234,7 @@ StatusModal { Image { id: qrCodeImage + objectName: "qrCodeImage" anchors.centerIn: parent height: parent.height width: parent.width diff --git a/ui/imports/shared/popups/send/SendModal.qml b/ui/imports/shared/popups/send/SendModal.qml index ae743741b9..a2faddecac 100644 --- a/ui/imports/shared/popups/send/SendModal.qml +++ b/ui/imports/shared/popups/send/SendModal.qml @@ -333,6 +333,7 @@ StatusDialog { HeaderTitleText { id: modalHeader + objectName: "modalHeader" Layout.maximumWidth: contentWidth Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft text: d.isBridgeTx ? qsTr("Bridge") : qsTr("Send") @@ -340,6 +341,7 @@ StatusDialog { TokenSelectorNew { id: holdingSelector + objectName: "holdingSelector" property var selectedItem property bool onlyAssets: false diff --git a/ui/imports/shared/views/AssetContextMenu.qml b/ui/imports/shared/views/AssetContextMenu.qml index 26e0648dab..900690eb6d 100644 --- a/ui/imports/shared/views/AssetContextMenu.qml +++ b/ui/imports/shared/views/AssetContextMenu.qml @@ -20,6 +20,7 @@ StatusMenu { signal manageTokensRequested StatusAction { + objectName: "sendMenuItem" enabled: root.sendEnabled visibleOnDisabled: true icon.name: "send" @@ -27,6 +28,7 @@ StatusMenu { onTriggered: root.sendRequested() } StatusAction { + objectName: "receiveMenuItem" icon.name: "receive" text: qsTr("Receive") onTriggered: root.receiveRequested()