diff --git a/test/e2e/gui/components/wallet/send_popup.py b/test/e2e/gui/components/wallet/send_popup.py index c3ca2654ee..faef716736 100644 --- a/test/e2e/gui/components/wallet/send_popup.py +++ b/test/e2e/gui/components/wallet/send_popup.py @@ -7,6 +7,7 @@ import configs.timeouts import driver from driver.objects_access import wait_for_template, walk_children from gui.components.base_popup import BasePopup +from gui.components.wallet.token_selector_popup import TokenSelectorPopup from gui.elements.button import Button from gui.elements.object import QObject from gui.elements.text_edit import TextEdit @@ -23,7 +24,7 @@ class SendPopup(BasePopup): self._search_field = TextEdit(names.search_TextEdit) self._asset_list_item = QObject(names.o_TokenBalancePerChainDelegate_template) self._collectible_list_item = QObject(names.o_CollectibleNestedDelegate_template) - self._amount_text_edit = TextEdit(names.amountInput_TextEdit) + self._amount_to_send_text_edit = TextEdit(names.amountInput_TextEdit) self._paste_button = Button(names.paste_StatusButton) self._ens_address_text_edit = TextEdit(names.ens_or_address_TextEdit) self._my_accounts_tab = Button(names.accountSelectionTabBar_My_Accounts_StatusTabButton) @@ -33,6 +34,7 @@ class SendPopup(BasePopup): self._fiat_fees_label = TextLabel(names.fiatFees_StatusBaseText) self._send_button = Button(names.send_StatusFlatButton) self._account_selector = QObject(names.accountSelector_AccountSelectorHeader) + self._holding_selector = QObject(names.holdingSelector_TokenSelectorNew) @allure.step('Wait until appears {0}') def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): @@ -52,7 +54,7 @@ class SendPopup(BasePopup): if getattr(item, 'title', '') == name: QObject(item).click() break - assert driver.waitFor(lambda: self._amount_text_edit.is_visible, timeout_msec=6000) + assert driver.waitFor(lambda: self._amount_to_send_text_edit.is_visible, timeout_msec=6000) elif tab == 'Collectibles': self._collectible_list_item.wait_until_appears(timeout_msec=15000) @@ -82,34 +84,19 @@ class SendPopup(BasePopup): assets_or_collectibles_list.append(asset) return assets_or_collectibles_list - @allure.step('Open tab') - def _open_tab(self, name: str): - assets_tab = wait_for_template(self._tab_item_template.real_name, name, 'text') - driver.mouseClick(assets_tab) + def open_token_selector(self): + self._holding_selector.click() + return TokenSelectorPopup().wait_until_appears() @allure.step('Send {2} {3} to {1}') - def send(self, address: str, amount: int, name: str, tab: str): - self._open_tab(tab) - self._select_asset_or_collectible(name, tab) - if tab == 'Assets': - self._amount_text_edit.text = str(amount) - self._ens_address_text_edit.wait_until_appears(timeout_msec=configs.timeouts.UI_LOAD_TIMEOUT_MSEC) + def send(self, address: str, amount: int, asset: str): + token_selector = self.open_token_selector() + token_selector.select_asset_from_list(asset_name=asset) + assert driver.waitFor(lambda: self._amount_to_send_text_edit.is_visible, timeout_msec=6000), \ + f"Asset selector popup was either not closed or send modal is not visible" + self._amount_to_send_text_edit.text = str(amount) + self._ens_address_text_edit.wait_until_appears(timeout_msec=configs.timeouts.UI_LOAD_TIMEOUT_MSEC) self._ens_address_text_edit.type_text(address) assert driver.waitFor(lambda: self._send_button.is_visible, timeout_msec=8000) - self.click_send() - - @allure.step('Click send button') - def click_send(self): self._send_button.click() - @allure.step('Get arbitrum network visibility state') - def is_arbitrum_network_identified(self) -> bool: - return self._arbitrum_network.is_visible - - @allure.step('Get mainnet network visibility state') - def is_mainnet_network_identified(self) -> bool: - return self._mainnet_network.is_visible - - @allure.step('Get fiat fees') - def get_fiat_fees(self) -> str: - return self._fiat_fees_label.text diff --git a/test/e2e/gui/components/wallet/token_selector_popup.py b/test/e2e/gui/components/wallet/token_selector_popup.py new file mode 100644 index 0000000000..b8ffead76c --- /dev/null +++ b/test/e2e/gui/components/wallet/token_selector_popup.py @@ -0,0 +1,25 @@ +import driver +from gui.elements.object import QObject +from gui.elements.text_edit import TextEdit +from gui.objects_map import names + + +class TokenSelectorPopup(QObject): + def __init__(self): + super().__init__(names.tokenSelectorPanel_TokenSelectorNew) + self.token_selector_panel = QObject(names.tokenSelectorPanel_TokenSelectorNew) + self.tab_bar = QObject(names.tokensTabBar_StatusTabBar) + self.assets_tab = QObject(names.tokenSelectorPanel_AssetsTab) + self.collectibles_tab = QObject(names.tokenSelectorPanel_CollectiblesTab) + self.asset_list_item = QObject(names.tokenSelectorAssetDelegate_template) + self.amount_to_send_field = TextEdit(names.amountInput_TextEdit) + + def select_asset_from_list(self, asset_name: str): + self.assets_tab.click() + assets_list = driver.findAllObjects(self.asset_list_item.real_name) + assert assets_list, f'Assets are not displayed' + for item in assets_list: + if getattr(item, 'tokensKey', '') == asset_name: + QObject(item).click() + break + return self diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index 804f3415df..35362b7774 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -507,7 +507,7 @@ o_StatusTabBar = {"container": statusDesktop_mainWindow_overlay, "type": "Status tab_Status_template = {"container": o_StatusTabBar, "type": "StatusBaseText", "unnamed": 1, "visible": True} o_TokenBalancePerChainDelegate_template = {"container": statusDesktop_mainWindow_overlay, "objectName": "tokenBalancePerChainDelegate", "type": "TokenBalancePerChainDelegate", "visible": True} o_CollectibleNestedDelegate_template = {"container": statusDesktop_mainWindow_overlay, "type": "CollectibleNestedDelegate", "unnamed": 1, "visible": True} -amountInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "amountInput", "type": "TextEdit", "visible": True} +amountInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "amountToSend_textField", "type": "StyledTextField", "visible": True} paste_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "unnamed": 1, "visible": True} ens_or_address_TextEdit = {"container": statusDesktop_mainWindow_overlay, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} accountSelectionTabBar_StatusTabBar = {"container": statusDesktop_mainWindow_overlay, "id": "accountSelectionTabBar", "type": "StatusTabBar", "unnamed": 1, "visible": True} @@ -545,6 +545,13 @@ networkSelectorDelegate_Arbitrum_NetworkSelectItemDelegate = {"container": statu holdingSelector_TokenSelectorNew = {"container": statusDesktop_mainWindow_overlay, "objectName": "holdingSelector", "type": "TokenSelectorNew", "visible": True} modalHeader_HeaderTitleText = {"container": statusDesktop_mainWindow_overlay, "objectName": "modalHeader", "type": "HeaderTitleText", "visible": True} +# Token Selector popup +tokenSelectorPanel_TokenSelectorNew = {"container": statusDesktop_mainWindow_overlay, "objectName": "tokenSelectorPanel", "type": "TokenSelectorPanel", "visible": True} +tokensTabBar_StatusTabBar = {"container": statusDesktop_mainWindow_overlay, "objectName": "tokensTabBar", "type": "StatusTabBar", "visible": True} +tokenSelectorPanel_AssetsTab = {"container": tokensTabBar_StatusTabBar, "objectName": "assetsTab", "type": "StatusTabButton", "visible": True} +tokenSelectorPanel_CollectiblesTab = {"container": tokensTabBar_StatusTabBar, "objectName": "collectiblesTab", "type": "StatusTabButton", "visible": True} +tokenSelectorAssetDelegate_template = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("tokenSelectorAssetDelegate*"), "type": "TokenSelectorAssetDelegate", "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/screens/wallet.py b/test/e2e/gui/screens/wallet.py index f7718893da..d52661ca1e 100644 --- a/test/e2e/gui/screens/wallet.py +++ b/test/e2e/gui/screens/wallet.py @@ -80,8 +80,12 @@ class LeftPanel(QObject): @allure.step('Select account from list') def select_account(self, account_name: str) -> 'WalletAccountView': - self._wallet_account_item.real_name['title'] = account_name - self._wallet_account_item.click() + account_items = self.accounts + existing_accounts_names = [account.name for account in account_items] + if account_name in existing_accounts_names: + self._wallet_account_item.real_name['title'] = account_name + time.sleep(0.5) + self._wallet_account_item.click() return WalletAccountView().wait_until_appears() @allure.step('Open context menu from left wallet panel') diff --git a/test/e2e/tests/transactions_tests/test_buy_ens_name_in_settings.py b/test/e2e/tests/transactions_tests/test_buy_ens_name_in_settings.py index c2677b12cb..d066ae4ce0 100644 --- a/test/e2e/tests/transactions_tests/test_buy_ens_name_in_settings.py +++ b/test/e2e/tests/transactions_tests/test_buy_ens_name_in_settings.py @@ -78,7 +78,7 @@ def test_ens_name_purchase(keys_screen, main_window, user_account, ens_name): with step('Confirm sending amount for purchasing ens username in send popup'): register_ens.click_send() - assert driver.waitFor(lambda: SendPopup().is_mainnet_network_identified, configs.timeouts.UI_LOAD_TIMEOUT_SEC) + assert driver.waitFor(lambda: SendPopup()._mainnet_network.is_visible, configs.timeouts.UI_LOAD_TIMEOUT_SEC) with step('Enter password in authenticate popup'): AuthenticatePopup().wait_until_appears().authenticate(user_account.password) diff --git a/test/e2e/tests/transactions_tests/test_wallet_send_eth.py b/test/e2e/tests/transactions_tests/test_wallet_send_eth.py index a8c7a7a58c..d470bd3ec8 100644 --- a/test/e2e/tests/transactions_tests/test_wallet_send_eth.py +++ b/test/e2e/tests/transactions_tests/test_wallet_send_eth.py @@ -30,13 +30,11 @@ def keys_screen(main_window) -> KeysView: seed_phrase=ReturningUsersData.WALLET_USER.value[0], status_address=ReturningUsersData.WALLET_USER.value[1] )]) -@pytest.mark.parametrize('receiver_account_address, amount, asset, tab', [ - pytest.param(ReturningUsersData.RETURNING_USER_ONE.value[1], 0, 'Ether', 'Assets') +@pytest.mark.parametrize('receiver_account_address, amount, asset', [ + pytest.param(ReturningUsersData.RETURNING_USER_ONE.value[1], 0, 'ETH') ]) @pytest.mark.timeout(timeout=120) -@pytest.mark.skip(reason="https://github.com/status-im/status-desktop/issues/14862") -@pytest.mark.skip(reason="https://github.com/status-im/status-desktop/issues/14509") -def test_wallet_send_0_eth(keys_screen, main_window, user_account, receiver_account_address, amount, asset, tab): +def test_wallet_send_0_eth(keys_screen, main_window, user_account, receiver_account_address, amount, asset): with step('Open import seed phrase view and enter seed phrase'): input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view() input_view.input_seed_phrase(user_account.seed_phrase, True) @@ -71,14 +69,15 @@ def test_wallet_send_0_eth(keys_screen, main_window, user_account, receiver_acco with step('Open send popup'): wallet = main_window.left_panel.open_wallet() SigningPhrasePopup().wait_until_appears().confirm_phrase() - assert driver.waitFor(lambda: wallet.left_panel.is_total_balance_visible, configs.timeouts.UI_LOAD_TIMEOUT_SEC) - f"Total balance is not visible" + assert \ + driver.waitFor(lambda: wallet.left_panel.is_total_balance_visible, configs.timeouts.UI_LOAD_TIMEOUT_SEC), \ + f"Total balance is not visible" wallet_account = wallet.left_panel.select_account('Account 1') send_popup = wallet_account.open_send_popup() with step('Enter asset, amount and address and click send and verify Mainnet network is shown'): - send_popup.send(receiver_account_address, amount, asset, tab) - assert driver.waitFor(lambda: send_popup.is_mainnet_network_identified, configs.timeouts.UI_LOAD_TIMEOUT_SEC) + send_popup.send(receiver_account_address, amount, asset) + assert driver.waitFor(lambda: send_popup._mainnet_network.is_visible, configs.timeouts.UI_LOAD_TIMEOUT_SEC) with step('Enter password in authenticate popup'): AuthenticatePopup().wait_until_appears().authenticate(user_account.password) diff --git a/test/e2e/tests/transactions_tests/test_wallet_send_nft.py b/test/e2e/tests/transactions_tests/test_wallet_send_nft.py index bc21113110..f75d21122e 100644 --- a/test/e2e/tests/transactions_tests/test_wallet_send_nft.py +++ b/test/e2e/tests/transactions_tests/test_wallet_send_nft.py @@ -72,7 +72,7 @@ def test_wallet_send_nft(keys_screen, main_window, user_account, tab, receiver_a with step('Enter asset, amount and address on Collectibles tab, click send and verify Mainnet network is shown'): send_popup.send(receiver_account_address, amount, collectible, tab) - assert driver.waitFor(lambda: send_popup.is_mainnet_network_identified, configs.timeouts.UI_LOAD_TIMEOUT_SEC) + assert driver.waitFor(lambda: send_popup._mainnet_network.is_visible, configs.timeouts.UI_LOAD_TIMEOUT_SEC) with step('Enter password in authenticate popup'): AuthenticatePopup().wait_until_appears().authenticate(user_account.password)