From 0d8db9230026ec7c79c59e7304733aa70b656aba Mon Sep 17 00:00:00 2001 From: Valentina Novgorodtceva Date: Wed, 10 Apr 2024 18:37:41 +0700 Subject: [PATCH] test: test_wallet_send_nft added --- test/e2e/gui/components/wallet/send_popup.py | 41 ++++++++----- test/e2e/gui/objects_map/names.py | 1 + .../test_footer_actions_send.py | 60 +++++++++++++++++-- 3 files changed, 83 insertions(+), 19 deletions(-) diff --git a/test/e2e/gui/components/wallet/send_popup.py b/test/e2e/gui/components/wallet/send_popup.py index d760469109..a36c010c35 100644 --- a/test/e2e/gui/components/wallet/send_popup.py +++ b/test/e2e/gui/components/wallet/send_popup.py @@ -18,6 +18,7 @@ class SendPopup(BasePopup): self._tab_item_template = QObject(names.tab_Status_template) 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._paste_button = Button(names.paste_StatusButton) self._ens_address_text_edit = TextEdit(names.ens_or_address_TextEdit) @@ -28,42 +29,52 @@ class SendPopup(BasePopup): self._fiat_fees_label = TextLabel(names.fiatFees_StatusBaseText) self._send_button = Button(names.send_StatusFlatButton) - def _select_asset(self, asset: str): - assets = self.get_assets_list() + @allure.step('Select asset or collectible by name') + def _select_asset_or_collectible(self, name: str, tab: str): + assets = self.get_assets_or_collectibles_list(tab) for index, item in enumerate(assets): - if str(item.title) == asset: + if str(item.title) == name: QObject(item).click() - @allure.step('Get chats by chats list') - def get_assets_list(self) -> typing.List[str]: - assets_list = [] - for asset in driver.findAllObjects(self._asset_list_item.real_name): - assets_list.append(asset) - return assets_list + @allure.step('Get assets or collectibles list') + def get_assets_or_collectibles_list(self, tab: str) -> typing.List[str]: + assets_or_collectibles_list = [] + if tab == 'Assets': + for asset in driver.findAllObjects(self._asset_list_item.real_name): + assets_or_collectibles_list.append(asset) + elif tab == 'Collectibles': + for asset in driver.findAllObjects(self._collectible_list_item.real_name): + 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) @allure.step('Send {2} {3} to {1}') - def send(self, address: str, amount: int, asset: str): - self._open_tab('Assets') - self._select_asset(asset) - assert driver.waitFor(lambda: self._amount_text_edit.is_visible, timeout_msec=6000) - self._amount_text_edit.text = str(amount) + 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': + assert driver.waitFor(lambda: self._amount_text_edit.is_visible, timeout_msec=6000) + self._amount_text_edit.text = str(amount) self._ens_address_text_edit.type_text(address) - assert driver.waitFor(lambda: self._send_button.is_visible, timeout_msec=6000) + 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/objects_map/names.py b/test/e2e/gui/objects_map/names.py index bb5da5a3d5..2cbd40d691 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -412,6 +412,7 @@ secondary_StatusButton = {"checkable": False, "container": statusDesktop_mainWin o_StatusTabBar = {"container": statusDesktop_mainWindow_overlay, "type": "StatusTabBar", "unnamed": 1, "visible": True} 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} 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} diff --git a/test/e2e/tests/wallet_main_screen/wallet: footer actions/test_footer_actions_send.py b/test/e2e/tests/wallet_main_screen/wallet: footer actions/test_footer_actions_send.py index 8c201482a3..aa6e0ac279 100644 --- a/test/e2e/tests/wallet_main_screen/wallet: footer actions/test_footer_actions_send.py +++ b/test/e2e/tests/wallet_main_screen/wallet: footer actions/test_footer_actions_send.py @@ -29,10 +29,10 @@ def keys_screen(main_window) -> KeysView: @pytest.mark.case(704527) @pytest.mark.transaction @pytest.mark.parametrize('user_account', [constants.user.user_with_funds]) -@pytest.mark.parametrize('receiver_account_address, amount, asset', [ - pytest.param(constants.user.user_account_one.status_address, 0, 'Ether') +@pytest.mark.parametrize('receiver_account_address, amount, asset, tab', [ + pytest.param(constants.user.user_account_one.status_address, 0, 'Ether', 'Assets') ]) -def test_wallet_send_0_eth(keys_screen, main_window, user_account, receiver_account_address, amount, asset): +def test_wallet_send_0_eth(keys_screen, main_window, user_account, receiver_account_address, amount, asset, tab): 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) @@ -70,7 +70,59 @@ def test_wallet_send_0_eth(keys_screen, main_window, user_account, receiver_acco 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) + 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) + + with step('Enter password in authenticate popup'): + AuthenticatePopup().wait_until_appears().authenticate(user_account.password) + + with step('Verify toast message with Transaction pending appears'): + assert WalletTransactions.TRANSACTION_PENDING_TOAST_MESSAGE.value in ' '.join( + main_window.wait_for_notification()) + + +allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704602', + 'Send: can send ERC 721 token (collectible) to address pasted into receiver field with Simple flow') + + +@pytest.mark.case(704602) +@pytest.mark.transaction +@pytest.mark.parametrize('user_account', [constants.user.user_with_funds]) +@pytest.mark.parametrize('tab, receiver_account_address, amount, collectible', [ + pytest.param('Collectibles', constants.user.user_with_funds.status_address, 1, 'Panda') +]) +def test_wallet_send_nft(keys_screen, main_window, user_account, tab, receiver_account_address, amount, collectible): + 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) + profile_view = input_view.import_seed_phrase() + profile_view.set_display_name(user_account.name) + + with step('Finalize onboarding and open main screen'): + details_view = profile_view.next() + create_password_view = details_view.next() + confirm_password_view = create_password_view.create_password(user_account.password) + confirm_password_view.confirm_password(user_account.password) + if configs.system.IS_MAC: + BiometricsView().wait_until_appears().prefer_password() + SplashScreen().wait_until_appears().wait_until_hidden() + if not configs.system.TEST_MODE: + BetaConsentPopup().confirm() + + with step('Set testnet mode'): + wallet_settings = main_window.left_panel.open_settings().left_panel.open_wallet_settings() + wallet_settings.open_networks().switch_testnet_mode_toggle().turn_on_testnet_mode_in_testnet_modal() + + 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" + wallet_account = wallet.left_panel.select_account('Account 1') + send_popup = wallet_account.open_send_popup() + + 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) with step('Enter password in authenticate popup'):