e2e: checking balance on mobile network

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2021-03-02 11:20:00 +01:00
parent c703e45105
commit a7f9a98f48
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
7 changed files with 39 additions and 20 deletions

View File

@ -165,8 +165,6 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.next_button.click() sign_in.next_button.click()
if sign_in.reencrypt_your_key_button.is_element_displayed(): if sign_in.reencrypt_your_key_button.is_element_displayed():
self.errors.append("Possible to create account with empty seed phrase") self.errors.append("Possible to create account with empty seed phrase")
sign_in = SignInView(self.driver, skip_popups=False)
for validation in validations: for validation in validations:
sign_in.just_fyi("Checking %s" % validation.get('case')) sign_in.just_fyi("Checking %s" % validation.get('case'))
phrase, msg, words_count, popup = validation.get('phrase'), \ phrase, msg, words_count, popup = validation.get('phrase'), \

View File

@ -14,7 +14,7 @@ class TestDApps(SingleDeviceTestCase):
status_test_dapp = home_view.open_status_test_dapp() status_test_dapp = home_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load() status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.transactions_button.click() 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: for element in status_test_dapp.element_by_text('eth_uninstallFilter'), status_test_dapp.ok_button:
if element.is_element_displayed(10): if element.is_element_displayed(10):
self.driver.fail("'Test filters' button produced an error") self.driver.fail("'Test filters' button produced an error")

View File

@ -170,26 +170,34 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5314) @marks.testrail_id(5314)
@marks.critical @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'] address = wallet_users['D']['address']
passphrase = wallet_users['D']['passphrase'] passphrase = wallet_users['D']['passphrase']
ropsten_txs = self.network_api.get_transactions(address) ropsten_txs = self.network_api.get_transactions(address)
ropsten_tokens = self.network_api.get_token_transactions(address) ropsten_tokens = self.network_api.get_token_transactions(address)
expected_txs_list = get_merged_txs_list(ropsten_txs, ropsten_tokens) expected_txs_list = get_merged_txs_list(ropsten_txs, ropsten_tokens)
signin_view = SignInView(self.driver) sign_in = SignInView(self.driver)
home_view = signin_view.recover_access(passphrase=passphrase) sign_in.switch_to_mobile(before_login=True)
wallet_view = home_view.wallet_button.click() home = sign_in.recover_access(passphrase=passphrase)
wallet_view.set_up_wallet()
wallet_view.accounts_status_account.click()
transaction_view = wallet_view.transaction_history_button.click()
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: if status_tx_number < 1:
self.driver.fail('No transactions found') self.driver.fail('No transactions found')
for n in range(status_tx_number): 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_hash = transactions_details.get_transaction_hash()
tx_from = transactions_details.get_sender_address() tx_from = transactions_details.get_sender_address()
tx_to = transactions_details.get_recipient_address() tx_to = transactions_details.get_recipient_address()

View File

@ -410,6 +410,22 @@ class BaseView(object):
size = self.driver.get_window_size() 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) 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): def get_status_test_dapp_view(self):
from views.web_views.status_test_dapp import StatusTestDAppView from views.web_views.status_test_dapp import StatusTestDAppView
return StatusTestDAppView(self.driver) return StatusTestDAppView(self.driver)

View File

@ -176,7 +176,7 @@ class ChatElementByText(Text):
status = '' status = ''
if sent.is_element_displayed(10, ignored_exceptions=NoSuchElementException): if sent.is_element_displayed(10, ignored_exceptions=NoSuchElementException):
status = 'sent' status = 'sent'
if delivered.is_element_displayed(20, ignored_exceptions=NoSuchElementException): if delivered.is_element_displayed(30, ignored_exceptions=NoSuchElementException):
status = 'delivered' status = 'delivered'
return status return status

View File

@ -90,13 +90,10 @@ class TransactionTable(BaseElement):
element.find_element() element.find_element()
return element return element
except NoSuchElementException: except NoSuchElementException:
time.sleep(20) from views.base_view import BaseView
self.refresh_transactions() BaseView(self.driver).pull_to_refresh()
self.driver.fail('Transaction %s %s was not found on Wallet/Transaction screen' %(amount, asset)) 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): def get_transactions_number(self):
element = self.TransactionElement(self.driver) element = self.TransactionElement(self.driver)
element.locator = '//android.view.ViewGroup[@content-desc="transaction-item"]' element.locator = '//android.view.ViewGroup[@content-desc="transaction-item"]'

View File

@ -165,8 +165,8 @@ class WalletView(BaseView):
if not self.transaction_history_button.is_element_displayed(): if not self.transaction_history_button.is_element_displayed():
self.wallet_account_by_name(self.status_account_name).click() self.wallet_account_by_name(self.status_account_name).click()
if (counter/60).is_integer(): if (counter/60).is_integer():
self.driver.swipe(500, 500, 500, 1000) self.pull_to_refresh()
self.driver.info("*Refreshing transaction history*") counter+=20
counter += 10 counter += 10
time.sleep(10) time.sleep(10)
self.driver.info('*Waiting %ss for %s updated balance*' % (counter,asset)) self.driver.info('*Waiting %ss for %s updated balance*' % (counter,asset))