From c59089c7d3c054e7be9b5612280fe94aba806c21 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Tue, 22 Feb 2022 15:26:46 +0100 Subject: [PATCH] e2e: wallet+send tx --- test/appium/support/testrail_report.py | 2 + .../test_wallet_management.py | 627 ++++++++++-------- .../transactions/test_keycard_wallet.py | 14 + .../tests/atomic/transactions/test_wallet.py | 486 ++++++-------- .../test_multiple_driver_tests.py | 1 + test/appium/tests/base_test_case.py | 2 +- test/appium/tests/users.py | 2 +- test/appium/views/base_element.py | 4 + test/appium/views/wallet_view.py | 4 +- 9 files changed, 564 insertions(+), 578 deletions(-) diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index 94f307e19f..93e123d57f 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -105,6 +105,8 @@ class TestrailReport(BaseTestReport): test_cases['group_chat'] = 50656 test_cases['onboarding'] = 50659 test_cases['recovery'] = 50660 + test_cases['wallet'] = 50661 + test_cases['send_tx'] = 50662 test_pr = list() for key in test_cases: if key != 'medium' and key != 'upgrade': diff --git a/test/appium/tests/atomic/account_management/test_wallet_management.py b/test/appium/tests/atomic/account_management/test_wallet_management.py index 1bbde1c479..d07b5519ca 100644 --- a/test/appium/tests/atomic/account_management/test_wallet_management.py +++ b/test/appium/tests/atomic/account_management/test_wallet_management.py @@ -1,355 +1,404 @@ import random import string +import pytest from tests import marks, common_password -from tests.base_test_case import SingleDeviceTestCase -from tests.users import wallet_users, transaction_senders, basic_user +from tests.base_test_case import SingleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers +from tests.users import wallet_users, transaction_senders, basic_user, ens_user, ens_user_ropsten from views.sign_in_view import SignInView +from support.utilities import get_merged_txs_list -class TestWalletManagement(SingleDeviceTestCase): +@pytest.mark.xdist_group(name="wallet_management_1") +class TestWalletManagementDeviceMerged(MultipleSharedDeviceTestCase): - @marks.testrail_id(5384) + @classmethod + def setup_class(cls): + cls.user = wallet_users['D'] + cls.account_seed_collectibles = 'acc_collectibles' + cls.drivers, cls.loop = create_shared_drivers(1) + cls.sign_in = SignInView(cls.drivers[0]) + cls.sign_in.switch_to_mobile(before_login=True) + cls.home = cls.sign_in.recover_access(cls.user['passphrase']) + cls.wallet = cls.home.wallet_button.click() + [cls.wallet.wait_balance_is_changed(asset) for asset in ('ETH', 'MDS', 'STT')] + cls.initial_balances = {'ETH': cls.wallet.get_asset_amount_by_name('ETH'), + 'ADI': 0, + 'STT': cls.wallet.get_asset_amount_by_name('STT')} + + @marks.testrail_id(700756) @marks.critical - def test_open_transaction_on_etherscan_copy_tx_hash(self): - user = wallet_users['D'] - home = SignInView(self.driver).recover_access(user['passphrase']) - wallet = home.wallet_button.click() - wallet.accounts_status_account.click() + def test_wallet_tx_history_copy_tx_hash_on_lte(self): + self.wallet.accounts_status_account.click() + address = wallet_users['D']['address'] + ropsten_txs = self.network_api.get_transactions(address) + ropsten_tokens = self.network_api.get_token_transactions(address) + expected_txs_list = get_merged_txs_list(ropsten_txs, ropsten_tokens) - wallet.just_fyi("Open transaction on etherscan") - transactions = wallet.transaction_history_button.click() + self.wallet.just_fyi("Checking empty tx history and pull-to-refresh for update") + transactions = self.wallet.transaction_history_button.click() + if not self.wallet.element_by_translation_id("transactions-history-empty").is_element_displayed(): + self.errors.append("Transaction history was loaded automatically on mobila data!") + self.wallet.pull_to_refresh() + if self.wallet.element_by_translation_id("transactions-history-empty").is_element_displayed(): + self.wallet.pull_to_refresh() + status_tx_number = transactions.transactions_table.get_transactions_number() + if status_tx_number < 1: + self.errors.append('No transactions found') + + self.wallet.just_fyi("Checking whole tx history") + for n in range(status_tx_number): + transactions_details = transactions.transactions_table.transaction_by_index(n).click() + tx_hash = transactions_details.get_transaction_hash() + tx_from = transactions_details.get_sender_address() + tx_to = transactions_details.get_recipient_address() + if tx_from != expected_txs_list[tx_hash]['from']: + self.errors.append('Transactions senders do not match!') + if tx_to != expected_txs_list[tx_hash]['to']: + self.errors.append('Transactions recipients do not match!') + transactions_details.close_button.click() + + self.wallet.just_fyi("Open transaction on etherscan") transaction_details = transactions.transactions_table.transaction_by_index(0).click() transaction_hash = transaction_details.get_transaction_hash() transaction_details.options_button.click() transaction_details.open_transaction_on_etherscan_button.click() - web_page = wallet.get_base_web_view() + web_page = self.wallet.get_base_web_view() web_page.open_in_webview() web_page.element_by_text_part(transaction_hash).wait_for_visibility_of_element(30) - wallet.just_fyi("Copy transaction hash") + self.wallet.just_fyi("Copy transaction hash") web_page.click_system_back_button() transaction_details.options_button.click() transaction_details.copy_transaction_hash_button.click() - wallet.home_button.click() - public_chat = home.join_public_chat('testchat') + self.wallet.home_button.click() + public_chat = self.home.join_public_chat('testchat') public_chat.chat_message_input.paste_text_from_clipboard() if public_chat.chat_message_input.text != transaction_hash: - self.driver.fail('Transaction hash was not copied') - - @marks.testrail_id(5346) - @marks.flaky - @marks.high - def test_collectible_from_wallet(self): - passphrase = wallet_users['F']['passphrase'] - home = SignInView(self.driver).recover_access(passphrase=passphrase) - - home.just_fyi('Check that collectibles are not shown on Ropsten') - wallet = home.wallet_button.click() - wallet.scan_tokens() - wallet.accounts_status_account.click() - wallet.collectibles_button.click() - wallet.element_by_translation_id("display-collectibles").scroll_and_click() - if not wallet.element_by_translation_id("no-collectibles").is_element_displayed(): - self.errors.append("Collectibles are shown on Ropsten network!") - - wallet.just_fyi('Check collectibles amount in wallet') - profile = home.profile_button.click() - profile.switch_network() - profile.wallet_button.click() - wallet.accounts_status_account.click() - wallet.collectibles_button.click() - wallet.get_collectibles_amount().wait_for_visibility_of_element(30) - if wallet.get_collectibles_amount().text != '1': - self.errors.append( - 'Wrong number is shown on CK assets: %s' % wallet.get_collectibles_amount().text) - wallet.get_collectibles_amount().click() - if not wallet.nft_asset_button.is_element_displayed(60): - self.driver.fail("Kitty is not shown after opening it from collectibles!") - wallet.nft_asset_button.click() - wallet.set_collectible_as_profile_photo_button.scroll_and_click() - web_view = wallet.get_base_web_view() - wallet.view_collectible_on_opensea_button.click_until_presence_of_element(web_view.browser_previous_page_button) - web_view.wait_for_d_aap_to_load() - if not web_view.element_by_text('Princess Gunklater').is_element_displayed(30): - self.errors.append("Collectible can't be opened when tapping 'View on OpenSea' via NFT page") - wallet.wallet_button.double_click() - - wallet.just_fyi('Check that collectibles are not shown when sending assets from wallet') - wallet.accounts_status_account.click() - send_transaction = wallet.send_transaction_button.click() - send_transaction.select_asset_button.click() - if send_transaction.asset_by_name("CryptoKitties").is_element_displayed(): - self.errors.append('Collectibles can be sent from wallet') - wallet.close_send_transaction_view_button.double_click() - - wallet.just_fyi('Check "Open in OpenSea" (that user is signed in)') - wallet.element_by_translation_id("check-on-opensea").click_until_presence_of_element(web_view.browser_previous_page_button) - web_view.wait_for_d_aap_to_load(10) - wallet.element_by_text('e2ecryptokitty').wait_for_element(60) - - wallet.just_fyi("Check that custom image from collectible is set as profile photo") - wallet.profile_button.double_click() - if not profile.profile_picture.is_element_image_similar_to_template('collectible_pic.png'): - self.errors.append("Collectible image is not set as profile image") - + self.errors.append('Transaction hash was not copied') self.errors.verify_no_errors() - @marks.testrail_id(5341) + @marks.testrail_id(700759) @marks.critical - def test_manage_assets(self): - sign_in = SignInView(self.driver) - sign_in.create_user() - wallet = sign_in.wallet_button.click() - asset = "MDS" + def test_wallet_add_account_generate_new(self): + self.wallet.just_fyi("Switching off LTE mode and navigating to home view") + self.wallet.driver.set_network_connection(6) + self.wallet.wallet_button.double_click() - sign_in.just_fyi("Enabling 0 asset on wallet and check it is shown") - wallet.select_asset(asset) - wallet.asset_by_name(asset).scroll_to_element() - if not wallet.asset_by_name(asset).is_element_displayed(): + self.wallet.add_account_button.click_until_presence_of_element(self.wallet.generate_an_account_button) + self.wallet.generate_an_account_button.click() + self.wallet.add_account_generate_account_button.click() + account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) + self.wallet.account_name_input.send_keys(account_name) + self.wallet.account_color_button.select_color_by_position(1) + + self.wallet.just_fyi("Checking basic validation when adding multiaccount") + if self.wallet.get_account_by_name(account_name).is_element_displayed(): + self.drivers[0].fail('Account is added without password') + self.wallet.enter_your_password_input.send_keys('000000') + self.wallet.add_account_generate_account_button.click() + if not self.wallet.element_by_text_part('Password seems to be incorrect').is_element_displayed(): + self.drivers[0].fail("Incorrect password validation is not performed") + self.wallet.enter_your_password_input.clear() + self.wallet.enter_your_password_input.send_keys(common_password) + self.wallet.add_account_generate_account_button.click() + account_button = self.wallet.get_account_by_name(account_name) + + self.wallet.just_fyi("Checking that selected color is applied") + if not account_button.is_element_displayed(): + self.wallet.accounts_status_account.swipe_left_on_element() + if not account_button.color_matches('multi_account_color.png'): + self.drivers[0].fail('Account color does not match expected') + self.wallet.get_account_by_name(account_name).click() + self.wallet.get_account_options_by_name(account_name).click() + self.wallet.account_settings_button.click() + self.wallet.swipe_up() + if self.wallet.delete_account_button.is_element_displayed(10): + self.drivers[0].fail('Delete account option is shown on added account "On Status Tree"!') + + @marks.testrail_id(700758) + @marks.critical + def test_wallet_manage_assets(self): + asset = "HND" + self.sign_in.just_fyi("Getting back to main wallet view") + self.wallet.get_back_to_home_view() + + self.sign_in.just_fyi("Enabling 0 asset on wallet and check it is shown") + self.wallet.select_asset(asset) + self.wallet.asset_by_name(asset).scroll_to_element() + if not self.wallet.asset_by_name(asset).is_element_displayed(): self.errors.append('%s asset is not shown in wallet' % asset) - sign_in.just_fyi("Check that 0 asset is not disappearing after relogin") - profile = wallet.profile_button.click() + self.sign_in.just_fyi("Check that 0 asset is not disappearing after relogin") + profile = self.wallet.profile_button.click() profile.relogin() - sign_in.wallet_button.click() - if not wallet.asset_by_name(asset).is_element_displayed(): + self.sign_in.wallet_button.click() + if not self.wallet.asset_by_name(asset).is_element_displayed(): self.errors.append('%s asset is not shown in wallet after relogin' % asset) - sign_in.just_fyi("Deselecting asset") - wallet.multiaccount_more_options.click() - wallet.manage_assets_button.click() - wallet.asset_checkbox_by_name(asset).click() - wallet.cross_icon.click() - if wallet.asset_by_name(asset).is_element_displayed(): + self.sign_in.just_fyi("Deselecting asset") + self.wallet.multiaccount_more_options.click() + self.wallet.manage_assets_button.click() + self.wallet.asset_checkbox_by_name(asset).click() + self.wallet.cross_icon.click() + if self.wallet.asset_by_name(asset).is_element_displayed(): self.errors.append('%s asset is shown in wallet but was deselected' % asset) self.errors.verify_no_errors() - @marks.testrail_id(5358) - @marks.medium - @marks.transaction - def test_backup_recovery_phrase_warning_from_wallet(self): - sign_in = SignInView(self.driver) - sign_in.create_user() - wallet = sign_in.wallet_button.click() - if wallet.backup_recovery_phrase_warning_text.is_element_present(): - self.driver.fail("'Back up your seed phrase' warning is shown on Wallet while no funds are present") - address = wallet.get_wallet_address() - self.network_api.get_donate(address[2:], external_faucet=True, wait_time=200) - wallet.close_button.click() - wallet.wait_balance_is_changed(scan_tokens=True) - if not wallet.backup_recovery_phrase_warning_text.is_element_present(30): - self.driver.fail("'Back up your seed phrase' warning is not shown on Wallet with funds") - profile = wallet.get_profile_view() - wallet.backup_recovery_phrase_warning_text.click() - profile.backup_recovery_phrase() - - @marks.testrail_id(5381) - @marks.high - def test_user_can_see_collectibles_on_rinkeby_after_account_recovering(self): - user = wallet_users['E'] - home = SignInView(self.driver).recover_access(user['passphrase']) - profile = home.profile_button.click() - profile.switch_network('Rinkeby with upstream RPC') - profile = home.profile_button.click() - wallet = profile.wallet_button.click() - wallet.scan_tokens() - wallet.accounts_status_account.click() - wallet.collectibles_button.click() - wallet.element_by_translation_id("display-collectibles").scroll_and_click() - for asset in user['collectibles']: - wallet.get_collectibles_amount(asset).scroll_to_element() - if wallet.get_collectibles_amount(asset).text != user['collectibles'][asset]: - self.errors.append( - '%s %s is not shown in Collectibles for Rinkeby!' % (user['collectibles'][asset], asset)) - - @marks.testrail_id(6224) + @marks.testrail_id(700760) @marks.critical - def test_add_account_to_multiaccount_instance_generate_new(self): - home = SignInView(self.driver).create_user() - wallet = home.wallet_button.click() - wallet.add_account_button.click() - wallet.generate_an_account_button.click() - wallet.add_account_generate_account_button.click() + def test_wallet_add_delete_watch_only_account(self): + self.wallet.get_back_to_home_view() + self.wallet.accounts_status_account.swipe_left_on_element() + + self.wallet.just_fyi('Add watch-only account') + if not self.wallet.add_account_button.is_element_displayed(3): + self.wallet.accounts_status_account.swipe_left_on_element() + self.wallet.add_account_button.click() + self.wallet.add_watch_only_address_button.click() + self.wallet.enter_address_input.send_keys(basic_user['address']) account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) - wallet.account_name_input.send_keys(account_name) - wallet.account_color_button.select_color_by_position(1) - if wallet.get_account_by_name(account_name).is_element_displayed(): - self.driver.fail('Account is added without password') - wallet.enter_your_password_input.send_keys('000000') - wallet.add_account_generate_account_button.click() - if not wallet.element_by_text_part('Password seems to be incorrect').is_element_displayed(): - self.driver.fail("Incorrect password validation is not performed") - wallet.enter_your_password_input.clear() - wallet.enter_your_password_input.send_keys(common_password) - wallet.add_account_generate_account_button.click() - account_button = wallet.get_account_by_name(account_name) + self.wallet.account_name_input.send_keys(account_name) + self.wallet.add_account_generate_account_button.click() + account_button = self.wallet.get_account_by_name(account_name) if not account_button.is_element_displayed(): - self.driver.fail('Account was not added') - if not account_button.color_matches('multi_account_color.png'): - self.driver.fail('Account color does not match expected') - wallet.get_account_by_name(account_name).click() - wallet.get_account_options_by_name(account_name).click() - wallet.account_settings_button.click() - wallet.swipe_up() - if wallet.delete_account_button.is_element_displayed(10): - self.driver.fail('Delete account option is shown on added account "On Status Tree"!') + self.drivers[0].fail('Account was not added') - @marks.testrail_id(6244) - @marks.high - def test_add_and_delete_watch_only_account_to_multiaccount_instance(self): - home = SignInView(self.driver).create_user() - wallet = home.wallet_button.click() + self.wallet.just_fyi('Check that overall balance is changed after adding watch-only account') + for asset in self.initial_balances: + self.wallet.wait_balance_is_changed(asset=asset, initial_balance=self.initial_balances[asset]) - wallet.just_fyi('Add watch-only account') - wallet.add_account_button.click() - wallet.add_watch_only_address_button.click() - wallet.enter_address_input.send_keys(basic_user['address']) - account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) - wallet.account_name_input.send_keys(account_name) - wallet.add_account_generate_account_button.click() - account_button = wallet.get_account_by_name(account_name) - if not account_button.is_element_displayed(): - self.driver.fail('Account was not added') - - wallet.just_fyi('Check that overall balance is changed after adding watch-only account') - for asset in ('ETH', 'ADI', 'STT'): - wallet.wait_balance_is_changed(asset) - - wallet.just_fyi('Check individual watch-only account view, settings and receive option') - wallet.get_account_by_name(account_name).click() - if wallet.send_transaction_button.is_element_displayed(): + self.wallet.just_fyi('Check individual watch-only account view, settings and receive option') + self.wallet.get_account_by_name(account_name).click() + if self.wallet.send_transaction_button.is_element_displayed(): self.errors.append('Send button is shown on watch-only wallet') - if not wallet.element_by_text('Watch-only').is_element_displayed(): + if not self.wallet.element_by_text('Watch-only').is_element_displayed(): self.errors.append('No "Watch-only" label is shown on watch-only wallet') - wallet.receive_transaction_button.click_until_presence_of_element(wallet.address_text) - if wallet.address_text.text[2:] != basic_user['address']: + self.wallet.receive_transaction_button.click_until_presence_of_element(self.wallet.address_text) + if self.wallet.address_text.text[2:] != basic_user['address']: self.errors.append( - 'Wrong address %s is shown in "Receive" popup for watch-only account ' % wallet.address_text.text) - wallet.close_share_popup() - wallet.get_account_options_by_name(account_name).click() - wallet.account_settings_button.click() - if not wallet.element_by_text('Watch-only').is_element_displayed(): + 'Wrong address %s is shown in "Receive" popup for watch-only account ' % self.wallet.address_text.text) + self.wallet.close_share_popup() + self.wallet.get_account_options_by_name(account_name).click() + self.wallet.account_settings_button.click() + if not self.wallet.element_by_text('Watch-only').is_element_displayed(): self.errors.append('"Watch-only" type is not shown in account settings') - wallet.just_fyi('Delete watch-only account') - wallet.delete_account_button.click() - wallet.yes_button.click() + self.wallet.just_fyi('Delete watch-only account') + self.wallet.delete_account_button.click() + self.wallet.yes_button.click() if account_button.is_element_displayed(): self.driver.fail('Account was not deleted') - for asset in ('ETH', 'ADI', 'STT'): - wallet.wait_balance_is_equal_expected_amount(asset, 0) + for asset in self.initial_balances: + self.wallet.wait_balance_is_equal_expected_amount(asset, self.initial_balances[asset]) self.errors.verify_no_errors() - @marks.testrail_id(6272) - @marks.high - def test_add_account_to_wallet_private_key_and_seed_phrase(self): - sign_in = SignInView(self.driver) - sign_in.create_user() - wallet = sign_in.wallet_button.click() - - wallet.just_fyi('Add account from private key') - wallet.add_account_button.click() - wallet.enter_a_private_key_button.click() - wallet.enter_your_password_input.send_keys(common_password) - wallet.enter_a_private_key_input.set_value(wallet_users['C']['private_key'][0:9]) + @marks.testrail_id(700761) + @marks.critical + def test_wallet_add_hide_unhide_account_private_key(self): + self.wallet.get_back_to_home_view() + if not self.wallet.add_account_button.is_element_displayed(3): + self.wallet.accounts_status_account.swipe_left_on_element() + self.wallet.add_account_button.click() + self.wallet.enter_a_private_key_button.click() + self.wallet.enter_your_password_input.send_keys(common_password) + self.wallet.enter_a_private_key_input.set_value(wallet_users['C']['private_key'][0:9]) account_name_private = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) - wallet.account_name_input.send_keys(account_name_private) - wallet.add_account_generate_account_button.click() - if wallet.get_account_by_name(account_name_private).is_element_displayed(): + self.wallet.account_name_input.send_keys(account_name_private) + self.wallet.add_account_generate_account_button.click() + if self.wallet.get_account_by_name(account_name_private).is_element_displayed(): self.driver.fail('Account is added with wrong private key') - wallet.enter_a_private_key_input.set_value(wallet_users['C']['private_key']) - wallet.add_account_generate_account_button.click() - account_button = wallet.get_account_by_name(account_name_private) + self.wallet.enter_a_private_key_input.set_value(wallet_users['C']['private_key']) + self.wallet.add_account_generate_account_button.click() + account_button = self.wallet.get_account_by_name(account_name_private) if not account_button.is_element_displayed(): self.driver.fail('Account from private key was not added') - wallet.just_fyi('Check that overall balance is changed after adding account from private key') - for asset in ('ETH', 'ADI', 'LXS', 'STT'): - wallet.wait_balance_is_changed(asset) - initial_stt = wallet.get_asset_amount_by_name('STT') + self.wallet.just_fyi('Check that overall balance is changed after adding account from private key') + for asset in self.initial_balances: + self.wallet.wait_balance_is_changed(asset=asset, initial_balance=self.initial_balances[asset]) - wallet.just_fyi('Check individual account view (imported from private key), receive option') - wallet.get_account_by_name(account_name_private).scroll_and_click(direction="up") - if not wallet.send_transaction_button.is_element_displayed(): + self.wallet.just_fyi('Check individual account view (imported from private key), receive option') + self.wallet.get_account_by_name(account_name_private).scroll_and_click(direction="up") + if not self.wallet.send_transaction_button.is_element_displayed(): self.errors.append('Send button is not shown on account added with private key') - wallet.receive_transaction_button.click() - if wallet.address_text.text[2:] != wallet_users['C']['address']: - self.errors.append('Wrong address %s is shown in "Receive" popup account ' % wallet.address_text.text) - wallet.wallet_button.double_click() + self.wallet.receive_transaction_button.click() + if self.wallet.address_text.text[2:] != wallet_users['C']['address']: + self.errors.append('Wrong address %s is shown in "Receive" popup account ' % self.wallet.address_text.text) + self.wallet.wallet_button.double_click() - wallet.just_fyi('Adding account from seed phrase') - wallet.add_account_button.scroll_to_element(direction='left') - wallet.add_account_button.click() - wallet.enter_a_seed_phrase_button.click() - wallet.enter_your_password_input.send_keys(common_password) - wallet.enter_seed_phrase_input.set_value('') - account_name_seed = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) - wallet.account_name_input.send_keys(account_name_seed) - wallet.add_account_generate_account_button.click() - if wallet.get_account_by_name(account_name_seed).is_element_displayed(): - self.driver.fail('Account is added without seed phrase') - wallet.enter_seed_phrase_input.set_value(str(wallet_users['C']['passphrase']).upper()) - wallet.add_account_generate_account_button.click() - if wallet.get_account_by_name(account_name_seed).is_element_displayed(): - self.driver.fail('Same account was added twice') - wallet.enter_seed_phrase_input.set_value(str(wallet_users['D']['passphrase']).upper()) - wallet.add_account_generate_account_button.click() - account_button = wallet.get_account_by_name(account_name_seed) - if not account_button.is_element_displayed(): - self.driver.fail('Account was not added') - - wallet.just_fyi('Check that overall balance is changed after adding account from seed phrase') - wallet.wait_balance_is_changed('STT', initial_balance=initial_stt) - wallet.wait_balance_is_changed('MDS') - - wallet.just_fyi('Check account view and send option (imported from seed phrase)') - wallet.get_account_by_name(account_name_seed).scroll_and_click(direction="up") - if not wallet.send_transaction_button.is_element_displayed(): - self.errors.append('Send button is not shown on account added with seed phrase') - wallet.receive_transaction_button.click() - if wallet.address_text.text[2:] != wallet_users['D']['address']: - self.errors.append('Wrong address %s is shown in "Receive" popup ' % wallet.address_text.text) - - wallet.just_fyi("Hide both accounts / unhide one") - wallet.wallet_button.double_click() - wallet.get_account_options_from_main_screen(account_name_private).click() - wallet.hide_account_button.click() - if wallet.get_account_by_name(account_name_private).is_element_displayed(): + self.wallet.just_fyi("Hide account and check balance according to hidden account") + self.wallet.get_account_options_from_main_screen(account_name_private).click() + self.wallet.hide_account_button.click() + if self.wallet.get_account_by_name(account_name_private).is_element_displayed(): self.errors.append("Hidden %s is shown on main wallet view" % account_name_private) - wallet.multiaccount_more_options.click() - wallet.manage_accounts_button.click() - if not wallet.hidden_account_by_name_button(account_name_private).is_element_displayed(): + for asset in self.initial_balances: + self.wallet.wait_balance_is_equal_expected_amount(asset, self.initial_balances[asset]) + self.wallet.multiaccount_more_options.click() + self.wallet.manage_accounts_button.click() + if not self.wallet.hidden_account_by_name_button(account_name_private).is_element_displayed(): self.errors.append("Hidden icon is not shown for hidden account") - if not wallet.show_account_by_name_button(account_name_seed).is_element_displayed(): - self.errors.append("'Show icon' is not shown for not hidden account") - wallet.show_account_by_name_button(account_name_seed).click() - wallet.wallet_button.double_click() - if wallet.get_account_by_name(account_name_seed).is_element_displayed(): - self.errors.append( - "Hidden %s is shown on main wallet view after hiding via 'Show icon'" % account_name_seed) - wallet.multiaccount_more_options.click() - wallet.manage_accounts_button.click() - wallet.hidden_account_by_name_button(account_name_seed).click() - wallet.wallet_button.double_click() - if not wallet.get_account_by_name(account_name_seed).is_element_displayed(): - self.errors.append( - "Unhidden %s is shown on main wallet view after hiding via 'Show icon'" % account_name_seed) - wallet.just_fyi("Delete unhidden account in wallet") - wallet.get_account_by_name(account_name_seed).click() - wallet.get_account_options_by_name(account_name_seed).click() - wallet.account_settings_button.click() - wallet.delete_account_button.scroll_and_click() - wallet.password_delete_account_input.wait_for_element(30) - wallet.password_delete_account_input.set_value(common_password) - wallet.delete_account_confirm_button.click() - if wallet.get_account_by_name(account_name_seed).is_element_displayed(): - self.errors.append("Deleted %s is shown on main wallet view" % account_name_seed) + self.wallet.just_fyi("Unhide account and check balance according to hidden account") + self.wallet.element_by_text(account_name_private).click() + if not self.wallet.show_account_by_name_button(account_name_private).is_element_displayed(): + self.errors.append("'Show icon' is not shown for not hidden account") + self.wallet.get_back_to_home_view() + if not self.wallet.get_account_by_name(account_name_private).is_element_displayed(): + self.wallet.accounts_status_account.swipe_left_on_element() + + if not self.wallet.get_account_by_name(account_name_private).is_element_displayed(): + self.errors.append("Unhidden %s is shown on main wallet view after hiding via 'Show icon'" % account_name_private) + for asset in self.initial_balances: + self.wallet.wait_balance_is_changed(asset=asset, initial_balance=self.initial_balances[asset]) self.errors.verify_no_errors() + @marks.testrail_id(700762) + @marks.critical + @marks.skip + # TODO: skipped due to #13016 + def test_wallet_add_account_seed_phrase_collectibles_mainnet_rinkeby(self): + user = wallet_users['E'] + account_seed_collectibles = self.account_seed_collectibles + self.wallet.get_back_to_home_view() + if not self.wallet.add_account_button.is_element_displayed(3): + self.wallet.accounts_status_account.swipe_left_on_element() + self.wallet.add_account_button.click() + self.wallet.enter_a_seed_phrase_button.click() + + self.home.just_fyi('Check basic validation when adding account from seed phrase') + self.wallet.enter_your_password_input.send_keys(common_password) + self.wallet.enter_seed_phrase_input.set_value('') + self.wallet.account_name_input.send_keys(account_seed_collectibles) + self.wallet.add_account_generate_account_button.click() + if self.wallet.get_account_by_name(account_seed_collectibles).is_element_displayed(): + self.driver.fail('Account is added without seed phrase') + self.wallet.enter_seed_phrase_input.set_value(str(wallet_users['D']['passphrase']).upper()) + self.wallet.add_account_generate_account_button.click() + if self.wallet.get_account_by_name(account_seed_collectibles).is_element_displayed(): + self.driver.fail('Same account was added twice') + + self.wallet.enter_your_password_input.send_keys(common_password) + self.wallet.enter_seed_phrase_input.set_value(str(user['passphrase']).upper()) + self.wallet.account_name_input.send_keys(account_seed_collectibles) + self.wallet.add_account_generate_account_button.click() + account_button = self.wallet.get_account_by_name(account_seed_collectibles) + if not account_button.is_element_displayed(): + self.wallet.accounts_status_account.swipe_left_on_element() + + self.home.just_fyi('Check that collectibles are not shown on Ropsten') + account_button.click() + self.wallet.collectibles_button.click() + self.wallet.element_by_translation_id("display-collectibles").scroll_and_click() + if not self.wallet.element_by_translation_id("no-collectibles").is_element_displayed(): + self.errors.append("Collectibles are shown on Ropsten network!") + + self.wallet.just_fyi('Check collectibles amount in wallet') + profile = self.home.profile_button.click() + profile.switch_network() + profile.wallet_button.click() + if not account_button.is_element_displayed(): + self.wallet.accounts_status_account.swipe_left_on_element() + account_button.click() + self.wallet.collectibles_button.click() + collectible_amount = self.wallet.get_collectibles_amount() + collectible_amount.wait_for_visibility_of_element(30) + if collectible_amount.text != '1': + self.errors.append('Wrong number is shown on CK assets: %s' % collectible_amount.text) + + self.wallet.just_fyi('Check that you can open collectible to view') + collectible_amount.click() + if not self.wallet.nft_asset_button.is_element_displayed(60): + self.driver.fail("Kitty is not shown after opening it from collectibles!") + self.wallet.nft_asset_button.click() + self.wallet.set_collectible_as_profile_photo_button.scroll_and_click() + + self.wallet.just_fyi('Check that you can set collectible as profile photo') + web_view = self.wallet.get_base_web_view() + self.wallet.view_collectible_on_opensea_button.click_until_presence_of_element( + web_view.browser_previous_page_button) + web_view.wait_for_d_aap_to_load() + if not web_view.element_by_text('Princess Gunklater').is_element_displayed(30): + self.errors.append("Collectible can't be opened when tapping 'View on OpenSea' via NFT page") + self.wallet.wallet_button.click() + + self.wallet.just_fyi('Check that collectibles are not shown when sending assets from wallet') + send_transaction = self.wallet.send_transaction_button.click() + send_transaction.select_asset_button.click() + if send_transaction.asset_by_name("CryptoKitties").is_element_displayed(): + self.errors.append('Collectibles can be sent from wallet') + self.wallet.close_send_transaction_view_button.double_click() + + self.wallet.just_fyi('Check "Open in OpenSea" (that user is signed in)') + self.wallet.element_by_translation_id("check-on-opensea").click_until_presence_of_element( + web_view.browser_previous_page_button) + web_view.wait_for_d_aap_to_load(10) + self.wallet.element_by_text('e2ecryptokitty').wait_for_element(60) + + self.wallet.just_fyi("Check that custom image from collectible is set as profile photo") + self.wallet.profile_button.double_click() + if not profile.profile_picture.is_element_image_similar_to_template('collectible_pic.png'): + self.errors.append("Collectible image is not set as profile image") + + self.home.just_fyi('Check that collectibles amount is shown on Rinkeby') + profile = self.home.profile_button.click() + profile.switch_network('Rinkeby with upstream RPC') + profile = self.home.profile_button.click() + profile.wallet_button.click() + if not account_button.is_element_displayed(): + self.wallet.accounts_status_account.swipe_left_on_element() + self.wallet.scan_tokens() + account_button.click() + self.wallet.transaction_history_button.click() + self.wallet.collectibles_button.click() + self.wallet.swipe_up() + if self.wallet.element_by_translation_id("display-collectibles").is_element_displayed: + self.wallet.element_by_translation_id("display-collectibles").click() + for asset in user['collectibles']: + self.wallet.get_collectibles_amount(asset).scroll_to_element() + if self.wallet.get_collectibles_amount(asset).text != user['collectibles'][asset]: + self.errors.append( + '%s %s is not shown in Collectibles for Rinkeby!' % (user['collectibles'][asset], asset)) + self.errors.verify_no_errors() + + @marks.testrail_id(700766) + @marks.high + def test_wallet_fetching_balance_after_offline_insufficient_funds_errors(self): + self.sign_in.driver.reset() + sender = wallet_users['E'] + + self.sign_in.just_fyi('Checking if balance will be restored after going back online') + self.sign_in.toggle_airplane_mode() + home = self.sign_in.recover_access(sender['passphrase']) + self.sign_in.toggle_airplane_mode() + wallet = home.wallet_button.click() + [wallet.wait_balance_is_changed(asset) for asset in ("ETH", "STT")] + [eth_value, stt_value] = [wallet.get_asset_amount_by_name(asset) for asset in ("ETH", "STT")] + + self.sign_in.just_fyi('Checking insufficient_balance errors') + wallet.accounts_status_account.click() + send_transaction = wallet.send_transaction_button.click() + send_transaction.amount_edit_box.set_value(round(eth_value + 1)) + error_text = send_transaction.element_by_text('Insufficient funds') + if not error_text.is_element_displayed(): + self.errors.append( + "'Insufficient funds' error is not shown when sending %s ETH from wallet with balance %s" % ( + round(eth_value + 1), eth_value)) + send_transaction.select_asset_button.click() + send_transaction.asset_by_name('STT').scroll_to_element() + send_transaction.asset_by_name('STT').click() + send_transaction.amount_edit_box.set_value(round(stt_value + 1)) + if not error_text.is_element_displayed(): + self.errors.append( + "'Insufficient funds' error is not shown when sending %s STT from wallet with balance %s" % ( + round(stt_value + 1), stt_value)) + self.errors.verify_no_errors() + + +class TestWalletManagement(SingleDeviceTestCase): + @marks.testrail_id(6269) @marks.medium def test_search_asset_and_currency(self): diff --git a/test/appium/tests/atomic/transactions/test_keycard_wallet.py b/test/appium/tests/atomic/transactions/test_keycard_wallet.py index 9e513145a5..d2ae63118a 100644 --- a/test/appium/tests/atomic/transactions/test_keycard_wallet.py +++ b/test/appium/tests/atomic/transactions/test_keycard_wallet.py @@ -6,6 +6,20 @@ from views.sign_in_view import SignInView class TestTransactionWalletSingleDevice(SingleDeviceTestCase): + @marks.testrail_id(6237) + @marks.high + def test_keycard_fetching_balance_after_offline(self): + sender = wallet_users['E'] + sign_in = SignInView(self.driver) + + sign_in.just_fyi('Keycard: checking if balance will be restored after going back online') + self.driver.close_app() + sign_in.toggle_airplane_mode() + self.driver.launch_app() + home = sign_in.recover_access(sender['passphrase'], keycard=True) + sign_in.toggle_airplane_mode() + wallet = home.wallet_button.click() + [wallet.wait_balance_is_changed(asset) for asset in ("ETH", "STT")] @marks.testrail_id(6289) @marks.critical diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index 8c1e1d587f..91e30e96de 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -1,188 +1,212 @@ import random import string +import pytest -from support.utilities import get_merged_txs_list -from tests import marks, unique_password -from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase -from tests.users import transaction_senders, basic_user, wallet_users, ens_user_ropsten, transaction_recipients, \ - ens_user +from tests import marks, common_password +from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers +from tests.users import transaction_senders, basic_user, wallet_users, ens_user_ropsten, ens_user, transaction_recipients from views.send_transaction_view import SendTransactionView from views.sign_in_view import SignInView -class TestTransactionWalletSingleDevice(SingleDeviceTestCase): +@pytest.mark.xdist_group(name="send_tx_1") +class TestSendTxDeviceMerged(MultipleSharedDeviceTestCase): + @classmethod + def setup_class(cls): + cls.user = transaction_senders['S'] + cls.recipient_address = '0x%s' % basic_user['address'] + cls.drivers, cls.loop = create_shared_drivers(1) + [cls.amount_adi, cls.amount_eth, cls.amount_stt] = ['0.000%s' % str(random.randint(100, 999)) + '1' for _ in range(3)] + cls.sign_in = SignInView(cls.drivers[0]) + cls.home = cls.sign_in.recover_access(cls.user['passphrase']) + cls.wallet = cls.home.wallet_button.click() + cls.assets = ('ETH', 'ADI', 'STT') + [cls.wallet.wait_balance_is_changed(asset) for asset in cls.assets] + cls.initial_balances = dict() + for asset in cls.assets: + cls.initial_balances[asset] = cls.wallet.get_asset_amount_by_name(asset) + cls.wallet.send_transaction(amount=cls.amount_eth, recipient=cls.recipient_address) + cls.wallet.send_transaction(amount=cls.amount_adi, recipient=cls.recipient_address, asset_name='ADI') - @marks.testrail_id(5308) + @marks.testrail_id(700763) @marks.critical @marks.transaction - def test_send_eth_from_wallet_to_address_incorrect_password(self): - recipient = basic_user - sender = transaction_senders['P'] - sign_in = SignInView(self.driver) - home = sign_in.recover_access(sender['passphrase'], password=unique_password) - wallet = home.wallet_button.click() - wallet.accounts_status_account.click() - transaction_amount = wallet.get_unique_amount() + def test_send_tx_eth_check_logcat(self): + self.wallet.just_fyi('Check that transaction is appeared in tx history') + self.wallet.find_transaction_in_history(amount=self.amount_eth) + self.wallet.wallet_button.double_click() + self.network_api.wait_for_confirmation_of_transaction(self.user['address'], self.amount_eth) + self.wallet.wait_balance_is_changed('ETH', initial_balance=self.initial_balances['ETH']) - wallet.just_fyi("Checking that can't send transaction with wrong password") - send_transaction = wallet.send_transaction_button.click() - send_transaction.amount_edit_box.click() - send_transaction.amount_edit_box.set_value(transaction_amount) - send_transaction.set_recipient_address('0x%s' % recipient['address']) - send_transaction.sign_transaction_button.click() - send_transaction.sign_with_password.click_until_presence_of_element(send_transaction.enter_password_input) - send_transaction.enter_password_input.click() - send_transaction.enter_password_input.send_keys('wrong_password') - send_transaction.sign_button.click() - if send_transaction.element_by_text_part('Transaction sent').is_element_displayed(): - self.driver.fail('Transaction was sent with a wrong password') - - wallet.just_fyi("Fix password and sign transaction") - send_transaction.enter_password_input.clear() - send_transaction.enter_password_input.send_keys(unique_password) - send_transaction.sign_button.click() - wallet.ok_button.wait_and_click() - - wallet.just_fyi('Check that transaction is appeared in transaction history') - wallet.find_transaction_in_history(amount=transaction_amount) - - wallet.just_fyi('Check logcat for sensitive data') - values_in_logcat = wallet.find_values_in_logcat(password=unique_password) + self.wallet.just_fyi('Check logcat for sensitive data') + values_in_logcat = self.wallet.find_values_in_logcat(password=common_password) if values_in_logcat: - self.driver.fail(values_in_logcat) + self.wallet.driver.fail(values_in_logcat) - @marks.testrail_id(6237) - @marks.high - @marks.transaction - def test_fetching_balance_after_offline(self): - sender = wallet_users['E'] - sign_in = SignInView(self.driver) - - sign_in.just_fyi('Checking if balance will be restored after going back online') - sign_in.toggle_airplane_mode() - home = sign_in.recover_access(sender['passphrase']) - sign_in.toggle_airplane_mode() - wallet = home.wallet_button.click() - [wallet.wait_balance_is_changed(asset) for asset in ("ETH", "STT")] - self.driver.reset() - - sign_in.just_fyi('Keycard: checking if balance will be restored after going back online') - self.driver.close_app() - sign_in.toggle_airplane_mode() - self.driver.launch_app() - sign_in.recover_access(sender['passphrase'], keycard=True) - sign_in.toggle_airplane_mode() - wallet = home.wallet_button.click() - [wallet.wait_balance_is_changed(asset) for asset in ("ETH", "STT")] - - @marks.testrail_id(5461) - @marks.medium - @marks.transaction - def test_send_eth_from_wallet_incorrect_address(self): - recipient = basic_user - sender = wallet_users['B'] - home = SignInView(self.driver).recover_access(sender['passphrase']) - wallet = home.wallet_button.click() - wallet.accounts_status_account.click() - send_transaction = wallet.send_transaction_button.click() - send_transaction.amount_edit_box.click() - transaction_amount = send_transaction.get_unique_amount() - send_transaction.amount_edit_box.set_value(transaction_amount) - send_transaction.chose_recipient_button.click() - for address in (recipient['public_key'], '0xDE709F2102306220921060314715629080E2fB77'): - send_transaction.enter_recipient_address_input.set_value(address) - send_transaction.enter_recipient_address_input.click() - send_transaction.done_button.click() - if send_transaction.set_max_button.is_element_displayed(): - self.driver.fail('Can proceed with wrong address %s in recipient' % address) - - @marks.testrail_id(5350) + @marks.testrail_id(700764) @marks.critical @marks.transaction - def test_send_token_with_7_decimals(self): - sender, recipient = transaction_senders['S'], basic_user - home = SignInView(self.driver).recover_access(sender['passphrase']) - wallet = home.wallet_button.click() - wallet.wait_balance_is_changed(asset='ADI', scan_tokens=True) - amount = '0.000%s' % str(random.randint(100, 999)) + '1' - wallet.send_transaction(amount=amount, recipient='0x%s' % recipient['address'], asset_name='ADI') - transaction = wallet.find_transaction_in_history(amount=amount, asset='ADI', return_hash=True) - self.network_api.find_transaction_by_hash(transaction) + def test_send_tx_token_7_decimals(self): + asset = 'ADI' + self.wallet.just_fyi("Checking tx with 7 decimals") + transaction_adi = self.wallet.find_transaction_in_history(amount=self.amount_adi, asset=asset, return_hash=True) + self.wallet.wallet_button.double_click() + self.network_api.find_transaction_by_hash(transaction_adi) + self.wallet.wait_balance_is_changed(asset, initial_balance=self.initial_balances[asset]) - @marks.testrail_id(5412) - @marks.high - @marks.transaction - def test_insufficient_funds_wallet_positive_balance(self): - sender = wallet_users['E'] - home = SignInView(self.driver).recover_access(sender['passphrase']) - wallet = home.wallet_button.click() - [wallet.wait_balance_is_changed(asset) for asset in ['ETH', 'STT']] - eth_value, stt_value = wallet.get_asset_amount_by_name('ETH'), wallet.get_asset_amount_by_name('STT') - if eth_value == 0 or stt_value == 0: - self.driver.fail('No funds!') - wallet.accounts_status_account.click() - send_transaction = wallet.send_transaction_button.click() - send_transaction.amount_edit_box.set_value(round(eth_value + 1)) - error_text = send_transaction.element_by_text('Insufficient funds') - if not error_text.is_element_displayed(): - self.errors.append( - "'Insufficient funds' error is not shown when sending %s ETH from wallet with balance %s" % ( - round(eth_value + 1), eth_value)) - send_transaction.select_asset_button.click() - send_transaction.asset_by_name('STT').scroll_to_element() - send_transaction.asset_by_name('STT').click() - send_transaction.amount_edit_box.set_value(round(stt_value + 1)) - if not error_text.is_element_displayed(): - self.errors.append( - "'Insufficient funds' error is not shown when sending %s STT from wallet with balance %s" % ( - round(stt_value + 1), stt_value)) - self.errors.verify_no_errors() - - @marks.testrail_id(5314) + @marks.testrail_id(700765) @marks.critical @marks.transaction - def test_can_see_balance_and_all_transactions_history_on_cellular(self): - address = wallet_users['D']['address'] - passphrase = wallet_users['D']['passphrase'] + def test_send_tx_custom_token_18_decimals(self): + contract_address, name, symbol, decimals = '0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA', 'Weenus 💪', 'WEENUS', '18' + self.home.wallet_button.double_click() - ropsten_txs = self.network_api.get_transactions(address) - ropsten_tokens = self.network_api.get_token_transactions(address) - expected_txs_list = get_merged_txs_list(ropsten_txs, ropsten_tokens) - sign_in = SignInView(self.driver) - sign_in.switch_to_mobile(before_login=True) - home = sign_in.recover_access(passphrase=passphrase) + self.wallet.just_fyi("Check that can add custom token") + self.wallet.multiaccount_more_options.click() + self.wallet.manage_assets_button.click() + token_view = self.wallet.add_custom_token_button.click() + token_view.contract_address_input.send_keys(contract_address) + if token_view.name_input.text != name: + self.errors.append('Name for custom token was not set') + if token_view.symbol_input.text != symbol: + self.errors.append('Symbol for custom token was not set') + if token_view.decimals_input.text != decimals: + self.errors.append('Decimals for custom token was not set') + token_view.add_button.click() + token_view.close_button.click() + self.wallet.asset_by_name(symbol).scroll_to_element() + if not self.wallet.asset_by_name(symbol).is_element_displayed(): + self.errors.append('Custom token is not shown on Wallet view') - wallet = home.wallet_button.click() - for asset in ('ETH', 'MDS', 'STT'): - wallet.wait_balance_is_changed(asset) - wallet.swipe_up() + self.wallet.just_fyi("Check that can send tx with custom token") + self.wallet.send_transaction(asset_name=symbol, amount=self.amount_eth, recipient=self.recipient_address) + # TODO: disabled due to 10838 (rechecked 23.11.21, valid) + # transactions_view = wallet.transaction_history_button.click() + # transactions_view.transactions_table.find_transaction(amount=amount, asset=symbol) + self.errors.verify_no_errors() + + @marks.testrail_id(700757) + @marks.critical + def test_send_tx_set_recipient_options_invalid_password(self): + nickname = 'my_some_nickname' + account_name = 'my_acc_name' + account_address = '0x8c2E3Cd844848E79cFd4671cE45C12F210b630d7' + recent_add_to_fav_name = 'my_Recent_STT' + recent_add_to_fav_address = '0x58d8c3d70ce4fa4b9fb10a665c8712238746f2ff' + ens_status, ens_other = ens_user_ropsten, ens_user + + basic_add_to_fav_name = 'my_basic_address' + self.drivers[0].reset() + self.home = self.sign_in.recover_access(wallet_users['D']['passphrase']) + + self.home.just_fyi('Add new account and new ENS contact for recipient') + chat = self.home.add_contact(ens_status['ens']) + chat.chat_options.click() + chat.view_profile_button.click_until_presence_of_element(chat.remove_from_contacts) + chat.set_nickname(nickname) + wallet = self.home.wallet_button.click() + wallet.add_account(account_name=account_name) wallet.accounts_status_account.click() - transaction = wallet.transaction_history_button.click() - if not wallet.element_by_translation_id("transactions-history-empty").is_element_displayed(): - self.errors.append("Transaction history was loaded automatically on mobila data!") - wallet.pull_to_refresh() - if wallet.element_by_translation_id("transactions-history-empty").is_element_displayed(): - wallet.pull_to_refresh() - status_tx_number = transaction.transactions_table.get_transactions_number() - if status_tx_number < 1: - self.driver.fail('No transactions found') + send_tr = wallet.send_transaction_button.click() - for n in range(status_tx_number): - transactions_details = transaction.transactions_table.transaction_by_index(n).click() - tx_hash = transactions_details.get_transaction_hash() - tx_from = transactions_details.get_sender_address() - tx_to = transactions_details.get_recipient_address() - if tx_from != expected_txs_list[tx_hash]['from']: - self.errors.append('Transactions senders do not match!') - if tx_to != expected_txs_list[tx_hash]['to']: - self.errors.append('Transactions recipients do not match!') - transactions_details.close_button.click() + wallet.just_fyi("Check that can't send to invalid address") + send_tr.amount_edit_box.click() + send_tr.amount_edit_box.set_value(send_tr.get_unique_amount()) + send_tr.chose_recipient_button.click() + for address in (basic_user['public_key'], '0xDE709F2102306220921060314715629080E2fB77'): + send_tr.enter_recipient_address_input.set_value(address) + send_tr.enter_recipient_address_input.click() + send_tr.done_button.click() + if send_tr.set_max_button.is_element_displayed(): + self.errors.append('Can proceed with wrong address %s in recipient' % address) + + send_tr.just_fyi('Set one of my accounts') + send_tr.chose_recipient_button.click_if_shown() + send_tr.element_by_translation_id("my-accounts").click() + send_tr.element_by_text(account_name).click() + if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(account_address): + self.errors.append('Added account is not resolved as recipient') + + send_tr.just_fyi('Set contract address from recent and check smart contract error') + send_tr.chose_recipient_button.click() + send_tr.element_by_translation_id("recent").click() + send_tr.element_by_text('↓ 1000 MDS').click() + if not send_tr.element_by_translation_id("warning-sending-to-contract-descr").is_element_displayed(): + self.driver.fail('No warning is shown at attempt to set as recipient smart contract') + send_tr.ok_button.click() + send_tr.element_by_text('↑ 0.001 ETHro').scroll_and_click() + send_tr.add_to_favorites(recent_add_to_fav_name) + wallet.element_by_translation_id("recent").click() + + send_tr.just_fyi('Scan invalid QR') + send_tr.scan_qr_code_button.click() + send_tr.allow_button.click(1) + wallet.enter_qr_edit_box.scan_qr('something%s' % basic_user['address']) + if not send_tr.element_by_text_part('Invalid address').is_element_displayed(10): + self.driver.fail('No error is shown at attempt to scan invalid address') + wallet.ok_button.click() + + send_tr.just_fyi('Scan code, add it to favorites and recheck that it is preserved') + send_tr.scan_qr_code_button.click() + wallet.enter_qr_edit_box.scan_qr(basic_user['address']) + send_tr.add_to_favorites(basic_add_to_fav_name) + send_tr.element_by_translation_id("favourites").scroll_and_click() + for name in (recent_add_to_fav_name, basic_add_to_fav_name): + wallet.element_by_text(name).scroll_to_element() + + send_tr.element_by_text(recent_add_to_fav_name).scroll_and_click() + if str(send_tr.enter_recipient_address_text.text).lower() != send_tr.get_formatted_recipient_address( + recent_add_to_fav_address): + self.errors.append('Recent address that was added to favourites was not resolved correctly') + + send_tr.just_fyi('Set contact') + send_tr.chose_recipient_button.click() + send_tr.element_by_translation_id("contacts").scroll_and_click() + send_tr.element_by_text(nickname).scroll_and_click() + send_tr.recipient_done.click() + if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_status['address']): + self.errors.append('ENS from contact is not resolved as recipient') + + send_tr.just_fyi('Set different ENS options') + send_tr.set_recipient_address(ens_other['ens_another']) + if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_other['address']): + self.errors.append('ENS address on another domain is not resolved as recipient') + send_tr.set_recipient_address('%s.stateofus.eth' % ens_status['ens']) + if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_status['address']): + self.errors.append('ENS address on stateofus.eth is not resolved as recipient') + + send_tr.just_fyi('Check search and set address from search') + send_tr.chose_recipient_button.click() + send_tr.search_by_keyword(ens_status['ens'][:2]) + if not send_tr.element_by_text('@' + ens_status['ens']).is_element_displayed(): + self.errors.append('ENS address from contacts is not shown in search') + send_tr.cancel_button.click() + send_tr.search_by_keyword('my') + for name in (nickname, account_name, recent_add_to_fav_name, basic_add_to_fav_name): + if not send_tr.element_by_text(name).is_element_displayed(): + self.errors.append('%s is not shown in search when searching by namepart' % name) + send_tr.element_by_text(basic_add_to_fav_name).click() + if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address( + '0x' + basic_user['address']): + self.errors.append('QR scanned address that was added to favourites was not resolved correctly') + + send_tr.just_fyi('Check that can not sign tx with invalid password') + self.wallet.next_button.click_if_shown() + self.wallet.ok_got_it_button.click_if_shown() + send_tr.sign_with_password.click_until_presence_of_element(send_tr.enter_password_input) + send_tr.enter_password_input.click() + send_tr.enter_password_input.send_keys('wrong_password') + send_tr.sign_button.click() + if send_tr.element_by_text_part('Transaction sent').is_element_displayed(): + wallet.driver.fail('Transaction was sent with a wrong password') self.errors.verify_no_errors() + +class TestTransactionWalletSingleDevice(SingleDeviceTestCase): + @marks.testrail_id(5429) @marks.medium - @marks.transaction def test_set_currency(self): home = SignInView(self.driver).create_user() user_currency = 'Euro (EUR)' @@ -191,6 +215,24 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): if not wallet.element_by_text_part('EUR').is_element_displayed(20): self.driver.fail('EUR currency is not displayed') + @marks.testrail_id(5358) + @marks.medium + def test_backup_recovery_phrase_warning_from_wallet(self): + sign_in = SignInView(self.driver) + sign_in.create_user() + wallet = sign_in.wallet_button.click() + if wallet.backup_recovery_phrase_warning_text.is_element_present(): + self.driver.fail("'Back up your seed phrase' warning is shown on Wallet while no funds are present") + address = wallet.get_wallet_address() + self.network_api.get_donate(address[2:], external_faucet=True, wait_time=200) + wallet.close_button.click() + wallet.wait_balance_is_changed(scan_tokens=True) + if not wallet.backup_recovery_phrase_warning_text.is_element_present(30): + self.driver.fail("'Back up your seed phrase' warning is not shown on Wallet with funds") + profile = wallet.get_profile_view() + wallet.backup_recovery_phrase_warning_text.click() + profile.backup_recovery_phrase() + @marks.testrail_id(5407) @marks.medium @marks.transaction @@ -276,7 +318,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): @marks.testrail_id(6235) @marks.medium - @marks.transaction def test_can_change_account_settings(self): sign_in_view = SignInView(self.driver) sign_in_view.create_user() @@ -309,7 +350,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): @marks.testrail_id(6282) @marks.medium - @marks.transaction def test_can_scan_eip_681_links(self): sign_in = SignInView(self.driver) sign_in.recover_access(transaction_senders['C']['passphrase']) @@ -418,132 +458,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): self.errors.verify_no_errors() - @marks.testrail_id(6208) - @marks.high - @marks.transaction - def test_send_transaction_with_custom_token(self): - contract_address, name, symbol, decimals = '0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA', 'Weenus 💪', 'WEENUS', '18' - home = SignInView(self.driver).recover_access(wallet_users['B']['passphrase']) - wallet = home.wallet_button.click() - wallet.multiaccount_more_options.click() - wallet.manage_assets_button.click() - token_view = wallet.add_custom_token_button.click() - token_view.contract_address_input.send_keys(contract_address) - if token_view.name_input.text != name: - self.errors.append('Name for custom token was not set') - if token_view.symbol_input.text != symbol: - self.errors.append('Symbol for custom token was not set') - if token_view.decimals_input.text != decimals: - self.errors.append('Decimals for custom token was not set') - token_view.add_button.click() - token_view.close_button.click() - wallet.asset_by_name(symbol).scroll_to_element() - if not wallet.asset_by_name(symbol).is_element_displayed(): - self.errors.append('Custom token is not shown on Wallet view') - recipient = "0x" + basic_user['address'] - amount = '0.000%s' % str(random.randint(10000, 99999)) + '1' - wallet.send_transaction(asset_name=symbol, amount=amount, recipient=recipient) - # TODO: disabled due to 10838 (rechecked 23.11.21, valid) - # transactions_view = wallet.transaction_history_button.click() - # transactions_view.transactions_table.find_transaction(amount=amount, asset=symbol) - - self.errors.verify_no_errors() - - @marks.testrail_id(6328) - @marks.critical - def test_send_transaction_set_recipient_options(self): - home = SignInView(self.driver).recover_access(wallet_users['D']['passphrase']) - nickname = 'my_some_nickname' - account_name = 'my_acc_name' - account_address = '0x8c2E3Cd844848E79cFd4671cE45C12F210b630d7' - recent_add_to_fav_name = 'my_Recent_STT' - recent_add_to_fav_address = '0x58d8c3d70ce4fa4b9fb10a665c8712238746f2ff' - ens_status = ens_user_ropsten - ens_other = ens_user - basic_add_to_fav_name = 'my_basic_address' - - home.just_fyi('Add new account and new ENS contact for recipient') - chat = home.add_contact(ens_status['ens']) - chat.chat_options.click() - chat.view_profile_button.click_until_presence_of_element(chat.remove_from_contacts) - chat.set_nickname(nickname) - wallet = home.wallet_button.click() - wallet.add_account(account_name=account_name) - wallet.accounts_status_account.click() - send_tr = wallet.send_transaction_button.click() - - send_tr.just_fyi('Set one of my accounts') - send_tr.chose_recipient_button.click() - send_tr.element_by_translation_id("my-accounts").click() - send_tr.element_by_text(account_name).click() - if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(account_address): - self.errors.append('Added account is not resolved as recipient') - - send_tr.just_fyi('Set contract address from recent and check smart contract error') - send_tr.chose_recipient_button.click() - send_tr.element_by_translation_id("recent").click() - send_tr.element_by_text('↓ 1000 MDS').click() - if not send_tr.element_by_translation_id("warning-sending-to-contract-descr").is_element_displayed(): - self.driver.fail('No warning is shown at attempt to set as recipient smart contract') - send_tr.ok_button.click() - send_tr.element_by_text('↑ 0.001 ETHro').scroll_and_click() - send_tr.add_to_favorites(recent_add_to_fav_name) - wallet.element_by_translation_id("recent").click() - - send_tr.just_fyi('Scan invalid QR') - send_tr.scan_qr_code_button.click() - send_tr.allow_button.click(1) - wallet.enter_qr_edit_box.scan_qr('something%s' % basic_user['address']) - if not send_tr.element_by_text_part('Invalid address').is_element_displayed(10): - self.driver.fail('No error is shown at attempt to scan invalid address') - wallet.ok_button.click() - - send_tr.just_fyi('Scan code, add it to favorites and recheck that it is preserved') - send_tr.scan_qr_code_button.click() - wallet.enter_qr_edit_box.scan_qr(basic_user['address']) - send_tr.add_to_favorites(basic_add_to_fav_name) - send_tr.element_by_translation_id("favourites").scroll_and_click() - for name in (recent_add_to_fav_name, basic_add_to_fav_name): - wallet.element_by_text(name).scroll_to_element() - - send_tr.element_by_text(recent_add_to_fav_name).scroll_and_click() - if str(send_tr.enter_recipient_address_text.text).lower() != send_tr.get_formatted_recipient_address( - recent_add_to_fav_address): - self.errors.append('Recent address that was added to favourites was not resolved correctly') - - send_tr.just_fyi('Set contact') - send_tr.chose_recipient_button.click() - send_tr.element_by_translation_id("contacts").scroll_and_click() - send_tr.element_by_text(nickname).scroll_and_click() - send_tr.recipient_done.click() - if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_status['address']): - self.errors.append('ENS from contact is not resolved as recipient') - - send_tr.just_fyi('Set different ENS options') - send_tr.set_recipient_address(ens_other['ens_another']) - if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_other['address']): - self.errors.append('ENS address on another domain is not resolved as recipient') - send_tr.set_recipient_address('%s.stateofus.eth' % ens_status['ens']) - if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_status['address']): - self.errors.append('ENS address on stateofus.eth is not resolved as recipient') - - send_tr.just_fyi('Check search and set address from search') - send_tr.chose_recipient_button.click() - send_tr.search_by_keyword(ens_status['ens'][:2]) - if not send_tr.element_by_text('@' + ens_status['ens']).is_element_displayed(): - self.errors.append('ENS address from contacts is not shown in search') - send_tr.cancel_button.click() - send_tr.search_by_keyword('my') - for name in (nickname, account_name, recent_add_to_fav_name, basic_add_to_fav_name): - if not send_tr.element_by_text(name).is_element_displayed(): - self.errors.append('%s is not shown in search when searching by namepart' % name) - send_tr.element_by_text(basic_add_to_fav_name).click() - if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address( - '0x' + basic_user['address']): - self.errors.append('QR scanned address that was added to favourites was not resolved correctly') - - self.errors.verify_no_errors() - @marks.testrail_id(5437) @marks.medium def test_validation_amount_errors(self): diff --git a/test/appium/tests/atomic/zzz_multiple_drivers_tests/test_multiple_driver_tests.py b/test/appium/tests/atomic/zzz_multiple_drivers_tests/test_multiple_driver_tests.py index 10a2e3f7e3..16b85e2e77 100644 --- a/test/appium/tests/atomic/zzz_multiple_drivers_tests/test_multiple_driver_tests.py +++ b/test/appium/tests/atomic/zzz_multiple_drivers_tests/test_multiple_driver_tests.py @@ -243,6 +243,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase): recovery_phrase = profile_1.get_recovery_phrase() profile_1.close_button.click() profile_1.home_button.click() + profile_1.get_recovery_phrase() device_1.just_fyi('Add contact, 1-1 chat (main device): 3-random, contact with ENS, start 1-1') chat_1 = home_1.add_contact(basic_user['public_key']) diff --git a/test/appium/tests/base_test_case.py b/test/appium/tests/base_test_case.py index d3300404a9..74d843acca 100644 --- a/test/appium/tests/base_test_case.py +++ b/test/appium/tests/base_test_case.py @@ -87,7 +87,7 @@ def get_capabilities_sauce_lab(): desired_caps['setWebContentDebuggingEnabled'] = True desired_caps['ignoreUnimportantViews'] = False desired_caps['enableNotificationListener'] = True - desired_caps['maxDuration'] = 1800 + desired_caps['maxDuration'] = 3600 return desired_caps diff --git a/test/appium/tests/users.py b/test/appium/tests/users.py index 95c3d01933..c4a7830902 100644 --- a/test/appium/tests/users.py +++ b/test/appium/tests/users.py @@ -96,7 +96,7 @@ wallet_users['E']['public_key'] = "0x044cf0620ec3ea0aba9fb0e19cb42a6fbd6b4e74f23 "fa1649927ba48adfa7c95991fd51940bc00a71e80b095db5b107f1b" wallet_users['E']['collectibles'] = { 'Coins & Steel Exclusive Item Skin V2': '1', - 'Coins & Steel Founder Aura': '2', + 'Coins & Steel Founder Aura': '1', 'CryptoKittiesRinkeby': '2', 'KudosToken V7': '1', } diff --git a/test/appium/views/base_element.py b/test/appium/views/base_element.py index d0dae09bf8..036124aac0 100644 --- a/test/appium/views/base_element.py +++ b/test/appium/views/base_element.py @@ -190,6 +190,10 @@ class BaseElement(object): except TimeoutException: return False + def click_if_shown(self, sec=5): + if self.is_element_displayed(sec=sec): + self.click() + def is_element_disappeared(self, sec=20): try: return self.wait_for_invisibility_of_element(sec) diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index af3ea5fd6a..0d56ad23d2 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -170,6 +170,8 @@ class WalletView(BaseView): counter, asset, expected_balance)) else: self.driver.info('Balance for %s is equal to %s' % (asset, expected_balance)) + if not self.accounts_status_account.is_element_displayed(): + self.accounts_status_account.scroll_to_element(direction='up') return def wait_balance_is_changed(self, asset='ETH', initial_balance=0, wait_time=400, scan_tokens=False): @@ -268,7 +270,7 @@ class WalletView(BaseView): self.multiaccount_more_options.click() self.manage_assets_button.click() for asset in args: - self.asset_checkbox_by_name(asset).enable() + self.element_by_text(asset).click() self.cross_icon.click() def scan_tokens(self, *args):