From b73fcba3950fc491dabdbc53494b5bc2dccea715 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Thu, 28 Jan 2021 16:46:01 +0100 Subject: [PATCH] improve logging, get rid of 2 e2e Signed-off-by: Churikova Tetiana --- .../account_management/test_create_account.py | 2 +- .../test_wallet_management.py | 127 +++++++----------- test/appium/views/base_element.py | 12 +- 3 files changed, 55 insertions(+), 86 deletions(-) diff --git a/test/appium/tests/atomic/account_management/test_create_account.py b/test/appium/tests/atomic/account_management/test_create_account.py index e08688e456..af64df361a 100644 --- a/test/appium/tests/atomic/account_management/test_create_account.py +++ b/test/appium/tests/atomic/account_management/test_create_account.py @@ -1,7 +1,7 @@ import random from support.utilities import fill_string_with_char -from tests import marks, common_password +from tests import marks, common_password, unique_password from tests.base_test_case import SingleDeviceTestCase from views.sign_in_view import SignInView from tests.users import basic_user, transaction_senders, recovery_users 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 768477edad..411596d3dc 100644 --- a/test/appium/tests/atomic/account_management/test_wallet_management.py +++ b/test/appium/tests/atomic/account_management/test_wallet_management.py @@ -52,43 +52,65 @@ class TestWalletManagement(SingleDeviceTestCase): @marks.testrail_id(5384) @marks.critical - def test_open_transaction_on_etherscan(self): + def test_open_transaction_on_etherscan_copy_tx_hash(self): user = wallet_users['D'] - sign_in_view = SignInView(self.driver) - home_view = sign_in_view.recover_access(user['passphrase']) - wallet_view = home_view.wallet_button.click() - wallet_view.set_up_wallet() - wallet_view.accounts_status_account.click() - transactions_view = wallet_view.transaction_history_button.click() - transaction_details = transactions_view.transactions_table.transaction_by_index(0).click() + home = SignInView(self.driver).recover_access(user['passphrase']) + wallet = home.wallet_button.click() + wallet.set_up_wallet() + wallet.accounts_status_account.click() + + wallet.just_fyi("Open transaction on etherscan") + transactions = wallet.transaction_history_button.click() + 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() - base_web_view = wallet_view.get_base_web_view() - base_web_view.open_in_webview() - base_web_view.find_text_part(transaction_hash) + web_page = wallet.get_base_web_view() + web_page.open_in_webview() + web_page.element_by_text_part(transaction_hash).wait_for_visibility_of_element(30) - @marks.testrail_id(5427) - @marks.medium - def test_copy_transaction_hash(self): - user = wallet_users['D'] - sign_in_view = SignInView(self.driver) - home_view = sign_in_view.recover_access(user['passphrase']) - wallet_view = home_view.wallet_button.click() - wallet_view.set_up_wallet() - wallet_view.accounts_status_account.click() - transactions_view = wallet_view.transaction_history_button.click() - transaction_details = transactions_view.transactions_table.transaction_by_index(0).click() - transaction_hash = transaction_details.get_transaction_hash() + wallet.just_fyi("Copy transaction hash") + web_page.click_system_back_button() transaction_details.options_button.click() transaction_details.copy_transaction_hash_button.click() - transaction_details.get_back_to_home_view() - wallet_view.home_button.click() - public_chat = home_view.join_public_chat('testchat') + wallet.home_button.click() + public_chat = 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.high + def test_collectible_from_wallet(self): + passphrase = wallet_users['F']['passphrase'] + home = SignInView(self.driver).recover_access(passphrase=passphrase) + profile = home.profile_button.click() + profile.switch_network() + wallet = profile.wallet_button.click() + wallet.set_up_wallet() + wallet.scan_tokens() + wallet.accounts_status_account.click() + wallet.collectibles_button.click() + + wallet.just_fyi('Check collectibles amount in wallet') + wallet.cryptokitties_in_collectibles_number.wait_for_visibility_of_element(30) + if wallet.cryptokitties_in_collectibles_number.text != '1': + self.errors.append( + 'Wrong number is shown on CK assets: %s' % wallet.cryptokitties_in_collectibles_number.text) + + wallet.just_fyi('Check that collectibles are not shown when sending assets from wallet') + 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.back_button.click(2) + + wallet.just_fyi('Check "Open in OpenSea"') + wallet.element_by_translation_id("check-on-opensea").click() + if not wallet.allow_button.is_element_displayed(40): + self.errors.append('OpenSea app is not opened when navigating from wallet') + self.errors.verify_no_errors() + @marks.testrail_id(5341) @marks.critical def test_manage_assets(self): @@ -126,32 +148,6 @@ class TestWalletManagement(SingleDeviceTestCase): wallet.backup_recovery_phrase_warning_text.click() profile.backup_recovery_phrase() - @marks.testrail_id(5440) - @marks.medium - def test_no_collectibles_to_send_from_wallet(self): - sign_in = SignInView(self.driver) - sign_in.create_user() - profile = sign_in.profile_button.click() - profile.switch_network('Mainnet with upstream RPC') - wallet = sign_in.wallet_button.click() - wallet.set_up_wallet() - assets = ['CryptoKitties', 'CryptoStrikers'] - for asset in assets: - wallet.select_asset(asset) - wallet.accounts_status_account.click_until_presence_of_element(wallet.collectibles_button) - wallet.collectibles_button.click() - for asset in assets: - if not wallet.element_by_text(asset).is_element_displayed(): - self.errors.append('Assets are not shown in Collectibles after adding') - wallet.transaction_history_button.click() - send_transaction = wallet.send_transaction_button.click() - send_transaction.select_asset_button.click() - for asset in assets: - if send_transaction.asset_by_name(asset).is_element_displayed(): - self.errors.append('Collectibles can be sent from wallet') - self.errors.verify_no_errors() - - @marks.testrail_id(5381) @marks.high def test_user_can_see_all_own_assets_after_account_recovering(self): @@ -171,32 +167,6 @@ class TestWalletManagement(SingleDeviceTestCase): if not wallet_view.element_by_text('1').is_element_displayed(): self.driver.fail('User collectibles amount does not match') - @marks.testrail_id(5346) - @marks.high - def test_collectible_from_wallet(self): - passphrase = wallet_users['F']['passphrase'] - signin_view = SignInView(self.driver) - home_view = signin_view.recover_access(passphrase=passphrase) - profile = home_view.profile_button.click() - profile.switch_network() - wallet_view = profile.wallet_button.click() - wallet_view.set_up_wallet() - wallet_view.scan_tokens() - wallet_view.accounts_status_account.click() - wallet_view.collectibles_button.click() - - wallet_view.just_fyi('Check collectibles amount in wallet') - wallet_view.cryptokitties_in_collectibles_number.wait_for_visibility_of_element(30) - if wallet_view.cryptokitties_in_collectibles_number.text != '1': - self.errors.append('Wrong number is shown on CK assets: %s' % wallet_view.cryptokitties_in_collectibles_number.text) - - wallet_view.just_fyi('Check "Open in OpenSea"') - wallet_view.element_by_text('Check on opensea').click() - if not wallet_view.allow_button.is_element_displayed(40): - self.errors.append('OpenSea app is not opened when navigating from wallet') - self.errors.verify_no_errors() - - @marks.testrail_id(6224) @marks.critical def test_add_account_to_multiaccount_instance_generate_new(self): @@ -357,7 +327,6 @@ class TestWalletManagement(SingleDeviceTestCase): 'Wrong address %s is shown in "Receive" popup account ' % wallet_view.address_text.text) self.errors.verify_no_errors() - @marks.testrail_id(5406) @marks.critical def test_ens_username_recipient(self): diff --git a/test/appium/views/base_element.py b/test/appium/views/base_element.py index 09051ba215..3846fd35ee 100644 --- a/test/appium/views/base_element.py +++ b/test/appium/views/base_element.py @@ -67,7 +67,7 @@ class BaseElement(object): return self.driver.find_element(self.by, self.locator) except NoSuchElementException: raise NoSuchElementException( - "Device %s: '%s' is not found on the screen" % (self.driver.number, self.name)) from None + "Device %s: %s by %s: `%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None except Exception as exception: if 'Internal Server Error' in str(exception): continue @@ -90,7 +90,7 @@ class BaseElement(object): .until(expected_conditions.presence_of_element_located((self.by, self.locator))) except TimeoutException: raise TimeoutException( - "Device %s: '%s' is not found on the screen" % (self.driver.number, self.name)) from None + "Device %s: %s by %s: `%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None def wait_for_elements(self, seconds=10): try: @@ -98,7 +98,7 @@ class BaseElement(object): .until(expected_conditions.presence_of_all_elements_located((self.by, self.locator))) except TimeoutException: raise TimeoutException( - "Device %s: '%s' is not found on the screen" % (self.driver.number, self.name)) from None + "Device %s: %s by %s:`%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None def wait_for_visibility_of_element(self, seconds=10, ignored_exceptions=None): try: @@ -106,15 +106,15 @@ class BaseElement(object): .until(expected_conditions.visibility_of_element_located((self.by, self.locator))) except TimeoutException: raise TimeoutException( - "Device %s: '%s' is not found on the screen" % (self.driver.number, self.name)) from None + "Device %s: %s by %s:`%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None def wait_for_invisibility_of_element(self, seconds=10): try: return WebDriverWait(self.driver, seconds) \ .until(expected_conditions.invisibility_of_element_located((self.by, self.locator))) except TimeoutException: - raise TimeoutException("Device %s: '%s' is still visible on the screen after %s seconds" % ( - self.driver.number, self.name, seconds)) from None + raise TimeoutException("Device %s: %s by %s:* `%s` is still visible on the screen after %s seconds" % ( + self.driver.number, self.name, self.by, self.locator, seconds)) from None def scroll_to_element(self, depth: int = 9, direction='down'): self.driver.info('*Scrolling %s to %s*' % (direction, self.name))