diff --git a/test/appium/support/api/network_api.py b/test/appium/support/api/network_api.py index d1db271c01..a376541b90 100644 --- a/test/appium/support/api/network_api.py +++ b/test/appium/support/api/network_api.py @@ -1,11 +1,13 @@ import logging import time +from datetime import datetime from decimal import Decimal from json import JSONDecodeError from os import environ from typing import List import pytest +import pytz import requests from selenium.common import TimeoutException @@ -38,7 +40,7 @@ class NetworkApi: return self.send_etherscan_request(params) def get_transactions(self, address: str) -> List[dict]: - params = {'module': 'account', 'action': 'txlist', 'address': address, 'sort': 'desc'} + params = {'module': 'account', 'action': 'txlist', 'address': address, 'page': 1, 'offset': 10, 'sort': 'desc'} return self.send_etherscan_request(params) def is_transaction_successful(self, transaction_hash: str) -> int: @@ -106,22 +108,28 @@ class NetworkApi: self.log("Failed iterate transactions(Etherscan unexpected error): " + str(e)) continue - def wait_for_confirmation_of_transaction(self, address, amount, confirmations=6, token=False): + def wait_for_confirmation_of_transaction(self, address, tx_time, confirmations=7, token=False): + expected_tx_timestamp = datetime.strptime(tx_time, "%Y-%m-%dT%H:%M:%S%z").replace(tzinfo=pytz.UTC) start_time = time.time() if token: token_info = "token transaction" else: token_info = "ETH transaction" - self.log('Waiting %s %s for %s to have %s confirmations' % (amount, token_info, address, confirmations)) + self.log('Waiting for %s of %s to have %s confirmations' % (token_info, address, confirmations)) while round(time.time() - start_time, ndigits=2) < 600: # should be < idleTimeout capability - transaction = self.find_transaction_by_unique_amount(address, amount, token) + if token: + transaction = self.get_token_transactions(address)[0] + else: + transaction = self.get_transactions(address)[0] + tx_timestamp = datetime.fromtimestamp(int(transaction['timeStamp'])).replace(tzinfo=pytz.UTC) + if tx_timestamp > expected_tx_timestamp: + if int(transaction['confirmations']) >= confirmations: + return + time.sleep(20) self.log( 'Expected amount of confirmations is %s, in fact %s' % (confirmations, transaction['confirmations'])) - if int(transaction['confirmations']) >= confirmations: - return - time.sleep(20) - pytest.fail('Transaction with amount %s was not confirmed, address is %s, still has %s confirmations' % ( - amount, address, int(transaction['confirmations']))) + pytest.fail('The last transaction was not confirmed, address is %s, still has %s confirmations' % ( + address, int(transaction['confirmations']))) def verify_balance_is_updated(self, initial_balance, recipient_address, wait_time=360): counter = 0 diff --git a/test/appium/tests/critical/test_deep_and_universal_links.py b/test/appium/tests/critical/test_deep_and_universal_links.py index 1f51fd1889..837f1c9563 100644 --- a/test/appium/tests/critical/test_deep_and_universal_links.py +++ b/test/appium/tests/critical/test_deep_and_universal_links.py @@ -48,11 +48,11 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase): self.profile_view.close_button.click() community_urls = { - "https://status.app/c/ixyACjgKDVNOVCBjb21tdW5pdHkSHHJlcXVpcmUgMTAgU05UIEdvZXJsaSB0byB1c2UYASIHI2VhYjcwMAM=#zQ3shUeGnhM33QW4g9JfYfeLFAH9ZwbDboNYn5exCR7S3ii1y": + "https://status.app/c/ixyACjgKDVNOVCBjb21tdW5pdHkSHHJlcXVpcmUgMTAgU05UIEdvZXJsaSB0byB1c2UYASIHI2VhYjcwMAM=#zQ3shhxbnaCooVQqaEkZRuRbez2SRws52Sas9HxkZNGimLRpi": "SNT community", - "https://status.app/c/G0UAAMTyNsn2QZDEG0EXftOl8pOEfwEBOOSA_YTfIk85xmADDgINGmxpUHAXzK36bN0fK42Xf4YD2yjPk1z2pbFwFw==#zQ3sheoNX5kiuM393TJ6xDnL57aQoiwFWEuJnazJ6W2eNuh9u": + "https://status.app/c/G0UAAMTyNsn2QZDEG0EXftOl8pOEfwEBOOSA_YTfIk85xmADDgINGmxpUHAXzK36bN0fK42Xf4YD2yjPk1z2pbFwFw==#zQ3shQGRffgENQzqDLAVCUbF8S2iPZHFfCGCPbApUfAoCNBMu": "open community", - "https://status.app/c/G00AAGS9TbI9mSR-ZNmFrhRjNuEeXAAbcAIUaLLJyjMOG3ACJQ12oIHD78QhzO9s_T5bUeU7rnATWJg3mGgTUemrAg==#zQ3shp9f5M3uyMpwTi3rFpFrP6WCWmNsW9pgK9cjXVTaf2vgj": + "https://status.app/c/G00AAGS9TbI9mSR-ZNmFrhRjNuEeXAAbcAIUaLLJyjMOG3ACJQ12oIHD78QhzO9s_T5bUeU7rnATWJg3mGgTUemrAg==#zQ3shf1JfZjB7yJ1EorFnnmeTs2PN5chpD98Li5kLN7wd2SpL": "closed community" } for url, text in community_urls.items(): @@ -98,11 +98,11 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase): self.browser_view.click_system_back_button() community_links = { - "status.app://c/ixyACjgKDVNOVCBjb21tdW5pdHkSHHJlcXVpcmUgMTAgU05UIEdvZXJsaSB0byB1c2UYASIHI2VhYjcwMAM=#zQ3shUeGnhM33QW4g9JfYfeLFAH9ZwbDboNYn5exCR7S3ii1y": + "status.app://c/ixyACjgKDVNOVCBjb21tdW5pdHkSHHJlcXVpcmUgMTAgU05UIEdvZXJsaSB0byB1c2UYASIHI2VhYjcwMAM=#zQ3shhxbnaCooVQqaEkZRuRbez2SRws52Sas9HxkZNGimLRpi": "SNT community", - "status.app://c/G0UAAMTyNsn2QZDEG0EXftOl8pOEfwEBOOSA_YTfIk85xmADDgINGmxpUHAXzK36bN0fK42Xf4YD2yjPk1z2pbFwFw==#zQ3sheoNX5kiuM393TJ6xDnL57aQoiwFWEuJnazJ6W2eNuh9u": + "status.app://c/G0UAAMTyNsn2QZDEG0EXftOl8pOEfwEBOOSA_YTfIk85xmADDgINGmxpUHAXzK36bN0fK42Xf4YD2yjPk1z2pbFwFw==#zQ3shQGRffgENQzqDLAVCUbF8S2iPZHFfCGCPbApUfAoCNBMu": "open community", - "status.app://c/G00AAGS9TbI9mSR-ZNmFrhRjNuEeXAAbcAIUaLLJyjMOG3ACJQ12oIHD78QhzO9s_T5bUeU7rnATWJg3mGgTUemrAg==#zQ3shp9f5M3uyMpwTi3rFpFrP6WCWmNsW9pgK9cjXVTaf2vgj": + "status.app://c/G00AAGS9TbI9mSR-ZNmFrhRjNuEeXAAbcAIUaLLJyjMOG3ACJQ12oIHD78QhzO9s_T5bUeU7rnATWJg3mGgTUemrAg==#zQ3shf1JfZjB7yJ1EorFnnmeTs2PN5chpD98Li5kLN7wd2SpL": "closed community" } for link, text in community_links.items(): diff --git a/test/appium/tests/critical/test_wallet.py b/test/appium/tests/critical/test_wallet.py index d6e65da56f..41bd850627 100644 --- a/test/appium/tests/critical/test_wallet.py +++ b/test/appium/tests/critical/test_wallet.py @@ -135,11 +135,14 @@ class TestWalletMultipleDevice(MultipleSharedDeviceTestCase): self.wallet_1.just_fyi("Sending funds from wallet") amount_to_send = 0.0001 + device_time_before_sending = self.wallet_1.driver.device_time self.wallet_1.send_asset(address='arb1:' + self.receiver['wallet_address'], asset_name='Ether', amount=amount_to_send) + self.network_api.wait_for_confirmation_of_transaction(address=self.sender['wallet_address'], + tx_time=device_time_before_sending) - device_time = self.wallet_1.driver.device_time + device_time_after_sending = self.wallet_1.driver.device_time self._check_balances_after_tx(amount_to_send, sender_balance, receiver_balance, eth_amount_sender, eth_amount_receiver) @@ -164,10 +167,13 @@ class TestWalletMultipleDevice(MultipleSharedDeviceTestCase): self.wallet_1.just_fyi("Sending asset from drawer") amount_to_send = 0.0001 + device_time_before_sending = self.wallet_1.driver.device_time self.wallet_1.send_asset_from_drawer(address='arb1:' + self.receiver['wallet_address'], asset_name='Ether', amount=amount_to_send) - device_time = self.wallet_1.driver.device_time + self.network_api.wait_for_confirmation_of_transaction(address=self.sender['wallet_address'], + tx_time=device_time_before_sending) + device_time_after_sending = self.wallet_1.driver.device_time self._check_balances_after_tx(amount_to_send, sender_balance, receiver_balance, eth_amount_sender, eth_amount_receiver) diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index f73dd9a9e6..506f8f9837 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -290,8 +290,11 @@ class ProfileView(BaseView): self.advertise_device_button = Button(self.driver, accessibility_id="advertise-device") self.sync_all_button = Button(self.driver, translation_id="sync-all-devices") self.syncing_button = Button(self.driver, accessibility_id="icon, Syncing, label-component, icon") - self.sync_plus_button = Button(self.driver, - xpath="//*[@text='Syncing']/following-sibling::android.view.ViewGroup[1]") + self.paired_devices_button = Button(self.driver, + accessibility_id="icon, Paired devices, 0 devices, label-component, icon") + self.sync_plus_button = Button( + self.driver, + xpath="//*[@text='Paired devices']/following-sibling::android.view.ViewGroup[@content-desc='icon']") # Keycard self.keycard_button = Button(self.driver, accessibility_id="keycard-button") @@ -539,6 +542,7 @@ class ProfileView(BaseView): def get_sync_code(self): self.syncing_button.scroll_and_click() + self.paired_devices_button.click() self.sync_plus_button.click() for checkbox in Button( self.driver, diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index a6fb04ef31..048bae87c1 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -261,7 +261,7 @@ class SignInView(BaseView): # self.identifiers_button.wait_and_click(30) if enable_notifications: self.enable_notifications_button.click_until_presence_of_element(self.start_button) - if self.allow_button.is_element_displayed(): + if self.allow_button.is_element_displayed(10): self.allow_button.click() else: self.maybe_later_button.click_until_presence_of_element(self.start_button) diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index 0865b3c7dd..4c90098d3f 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -160,7 +160,6 @@ class WalletView(BaseView): self.add_account_button.click() self.add_account_to_watch.click() self.address_to_watch_input.send_keys(address) - self.account_has_activity_label.wait_for_visibility_of_element() self.add_account_continue_button.click() SignInView(self.driver).profile_title_input.send_keys(account_name) self.add_watched_address_button.click()