From a7f9a98f4847fbdf3d71f4d620988aa238434853 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Tue, 2 Mar 2021 11:20:00 +0100 Subject: [PATCH] e2e: checking balance on mobile network Signed-off-by: Churikova Tetiana --- .../account_management/test_create_account.py | 2 -- .../atomic/dapps_and_browsing/test_dapps.py | 2 +- .../tests/atomic/transactions/test_wallet.py | 26 ++++++++++++------- test/appium/views/base_view.py | 16 ++++++++++++ test/appium/views/chat_view.py | 2 +- test/appium/views/transactions_view.py | 7 ++--- test/appium/views/wallet_view.py | 4 +-- 7 files changed, 39 insertions(+), 20 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 9fdc4e8548..f220cb1818 100644 --- a/test/appium/tests/atomic/account_management/test_create_account.py +++ b/test/appium/tests/atomic/account_management/test_create_account.py @@ -165,8 +165,6 @@ class TestCreateAccount(SingleDeviceTestCase): sign_in.next_button.click() if sign_in.reencrypt_your_key_button.is_element_displayed(): self.errors.append("Possible to create account with empty seed phrase") - - sign_in = SignInView(self.driver, skip_popups=False) for validation in validations: sign_in.just_fyi("Checking %s" % validation.get('case')) phrase, msg, words_count, popup = validation.get('phrase'), \ diff --git a/test/appium/tests/atomic/dapps_and_browsing/test_dapps.py b/test/appium/tests/atomic/dapps_and_browsing/test_dapps.py index 6d23e4bfb8..03af226c67 100644 --- a/test/appium/tests/atomic/dapps_and_browsing/test_dapps.py +++ b/test/appium/tests/atomic/dapps_and_browsing/test_dapps.py @@ -14,7 +14,7 @@ class TestDApps(SingleDeviceTestCase): status_test_dapp = home_view.open_status_test_dapp() status_test_dapp.wait_for_d_aap_to_load() status_test_dapp.transactions_button.click() - status_test_dapp.test_filters_button.click() + status_test_dapp.test_filters_button.scroll_and_click() for element in status_test_dapp.element_by_text('eth_uninstallFilter'), status_test_dapp.ok_button: if element.is_element_displayed(10): self.driver.fail("'Test filters' button produced an error") diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index a4daba94e2..1a547b4a6f 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -170,26 +170,34 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): @marks.testrail_id(5314) @marks.critical - def test_can_see_all_transactions_in_history(self): + def test_can_see_balance_and_all_transactions_history_on_cellular(self): address = wallet_users['D']['address'] passphrase = wallet_users['D']['passphrase'] 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) - signin_view = SignInView(self.driver) - home_view = signin_view.recover_access(passphrase=passphrase) - wallet_view = home_view.wallet_button.click() - wallet_view.set_up_wallet() - wallet_view.accounts_status_account.click() - transaction_view = wallet_view.transaction_history_button.click() + sign_in = SignInView(self.driver) + sign_in.switch_to_mobile(before_login=True) + home = sign_in.recover_access(passphrase=passphrase) - status_tx_number = transaction_view.transactions_table.get_transactions_number() + wallet = home.wallet_button.click() + wallet.set_up_wallet() + for asset in ('ETH', 'MDS', 'STT'): + wallet.wait_balance_is_changed(asset) + 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') for n in range(status_tx_number): - transactions_details = transaction_view.transactions_table.transaction_by_index(n).click() + 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() diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index a359c49c07..16ecdc9407 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -410,6 +410,22 @@ class BaseView(object): size = self.driver.get_window_size() self.driver.swipe(size["width"]*0.2, size["height"]*0.8, size["width"]*0.8, size["height"]*0.8) + def switch_to_mobile(self, before_login=False, sync=False): + self.driver.info("*Turning on mobile data, syncing is %s*" % str(sync)) + self.driver.set_network_connection(4) + if before_login is False: + from views.home_view import HomeView + home = HomeView(self.driver) + if sync is True: + home.continue_syncing_button.wait_and_click() + else: + home.stop_syncing_button.wait_and_click() + + def pull_to_refresh(self, wait_sec=20): + self.driver.info("*Pull to refresh view*") + self.driver.swipe(500, 500, 500, 1000) + time.sleep(wait_sec) + def get_status_test_dapp_view(self): from views.web_views.status_test_dapp import StatusTestDAppView return StatusTestDAppView(self.driver) diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index e296a8a384..07005f83a8 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -176,7 +176,7 @@ class ChatElementByText(Text): status = '' if sent.is_element_displayed(10, ignored_exceptions=NoSuchElementException): status = 'sent' - if delivered.is_element_displayed(20, ignored_exceptions=NoSuchElementException): + if delivered.is_element_displayed(30, ignored_exceptions=NoSuchElementException): status = 'delivered' return status diff --git a/test/appium/views/transactions_view.py b/test/appium/views/transactions_view.py index 29a96ec8a8..2afa787465 100644 --- a/test/appium/views/transactions_view.py +++ b/test/appium/views/transactions_view.py @@ -90,13 +90,10 @@ class TransactionTable(BaseElement): element.find_element() return element except NoSuchElementException: - time.sleep(20) - self.refresh_transactions() + from views.base_view import BaseView + BaseView(self.driver).pull_to_refresh() self.driver.fail('Transaction %s %s was not found on Wallet/Transaction screen' %(amount, asset)) - def refresh_transactions(self): - self.driver.swipe(500, 500, 500, 1000) - def get_transactions_number(self): element = self.TransactionElement(self.driver) element.locator = '//android.view.ViewGroup[@content-desc="transaction-item"]' diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index db46348a0e..9aa3df1c1f 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -165,8 +165,8 @@ class WalletView(BaseView): if not self.transaction_history_button.is_element_displayed(): self.wallet_account_by_name(self.status_account_name).click() if (counter/60).is_integer(): - self.driver.swipe(500, 500, 500, 1000) - self.driver.info("*Refreshing transaction history*") + self.pull_to_refresh() + counter+=20 counter += 10 time.sleep(10) self.driver.info('*Waiting %ss for %s updated balance*' % (counter,asset))