mirror of
https://github.com/status-im/status-react.git
synced 2025-01-22 16:59:40 +00:00
fix e2e with scan tokens
This commit is contained in:
parent
4e9b1001df
commit
9f36bd44b2
@ -135,10 +135,20 @@ class NetworkApi(object):
|
||||
errors.append('Recipients balance is not updated on etherscan')
|
||||
|
||||
def faucet(self, address):
|
||||
return requests.request('GET', '%s/0x%s' % (self.faucet_url, address)).json()
|
||||
try:
|
||||
self.log("Trying to get funds from %s" % self.faucet_url)
|
||||
return requests.request('GET', '%s/0x%s' % (self.faucet_url, address)).json()
|
||||
except JSONDecodeError as e:
|
||||
self.log(str(e))
|
||||
pass
|
||||
|
||||
def faucet_backup(self, address):
|
||||
return requests.request('GET', '%s/0x%s' % (self.faucet_backup_url, address)).json()
|
||||
try:
|
||||
self.log("Trying to get funds from %s" % self.faucet_backup_url)
|
||||
return requests.request('GET', '%s/0x%s' % (self.faucet_backup_url, address)).json()
|
||||
except JSONDecodeError as e:
|
||||
self.log(str(e))
|
||||
pass
|
||||
|
||||
def get_donate(self, address, external_faucet=True, wait_time=300):
|
||||
initial_balance = self.get_balance(address)
|
||||
|
@ -208,6 +208,7 @@ class TestWalletManagement(SingleDeviceTestCase):
|
||||
profile = home_view.profile_button.click()
|
||||
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()
|
||||
if not wallet_view.element_by_text('KDO').is_element_displayed():
|
||||
|
@ -51,7 +51,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
|
||||
sign_in_view.just_fyi('Go back to online and check that balance is updated')
|
||||
sign_in_view.toggle_airplane_mode()
|
||||
wallet_view.wait_balance_is_changed('ETH')
|
||||
wallet_view.wait_balance_is_changed('STT')
|
||||
wallet_view.scan_tokens('STT')
|
||||
|
||||
sign_in_view.just_fyi('Send some tokens to other account')
|
||||
recipient = "0x" + basic_user['address']
|
||||
|
@ -78,7 +78,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
|
||||
sign_in_view.just_fyi('Go back to online and check that balance is updated')
|
||||
sign_in_view.toggle_airplane_mode()
|
||||
wallet_view.wait_balance_is_changed('ETH')
|
||||
wallet_view.wait_balance_is_changed('STT')
|
||||
wallet_view.scan_tokens('STT')
|
||||
|
||||
sign_in_view.just_fyi('Send some tokens to other account')
|
||||
recipient = "0x" + basic_user['address']
|
||||
|
@ -97,6 +97,12 @@ class ManageAssetsButton(BaseButton):
|
||||
self.locator = self.Locator.accessibility_id('wallet-manage-assets')
|
||||
|
||||
|
||||
class ScanTokensButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(ScanTokensButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('wallet-scan-token')
|
||||
|
||||
|
||||
class STTCheckBox(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(STTCheckBox, self).__init__(driver)
|
||||
@ -391,6 +397,7 @@ class WalletView(BaseView):
|
||||
self.send_request_button = SendRequestButton(self.driver)
|
||||
self.options_button = OptionsButton(self.driver)
|
||||
self.manage_assets_button = ManageAssetsButton(self.driver)
|
||||
self.scan_tokens_button = ScanTokensButton(self.driver)
|
||||
self.stt_check_box = STTCheckBox(self.driver)
|
||||
self.all_assets_full_names = AssetFullNameInAssets(self.driver)
|
||||
self.all_assets_symbols = AssetSymbolInAssets(self.driver)
|
||||
@ -445,11 +452,13 @@ class WalletView(BaseView):
|
||||
def get_account_options_by_name(self, account_name='Status account'):
|
||||
return AccountOptionsButton(self.driver, account_name)
|
||||
|
||||
|
||||
def get_asset_amount_by_name(self, asset: str):
|
||||
asset_value = AssetText(self.driver, asset)
|
||||
asset_value.scroll_to_element()
|
||||
return float(asset_value.text.split()[0])
|
||||
try:
|
||||
return float(asset_value.text.split()[0])
|
||||
except ValueError:
|
||||
return 0.0
|
||||
|
||||
def verify_currency_balance(self, expected_rate: int, errors: list):
|
||||
usd = self.get_usd_total_value()
|
||||
@ -470,9 +479,9 @@ class WalletView(BaseView):
|
||||
counter += 10
|
||||
time.sleep(10)
|
||||
self.swipe_down()
|
||||
self.driver.info('Waiting %s seconds for %s balance update' % (counter,asset))
|
||||
self.driver.info('Waiting %s seconds for %s balance update to be equal to %s' % (counter,asset, expected_balance))
|
||||
else:
|
||||
self.driver.info('Transaction received, balance updated!')
|
||||
self.driver.info('Balance for %s is equal to %s' % (asset, expected_balance))
|
||||
return
|
||||
|
||||
def wait_balance_is_changed(self, asset ='ETH', initial_balance=0, wait_time=300):
|
||||
@ -528,6 +537,26 @@ class WalletView(BaseView):
|
||||
self.asset_checkbox_by_name(asset).click()
|
||||
self.cross_icon.click()
|
||||
|
||||
def scan_tokens(self, *args):
|
||||
self.multiaccount_more_options.click()
|
||||
self.scan_tokens_button.click()
|
||||
counter = 0
|
||||
if args:
|
||||
for asset in args:
|
||||
while True:
|
||||
if counter >= 20:
|
||||
self.driver.fail('Balance of %s is not changed during 20 seconds!' % asset)
|
||||
elif self.get_asset_amount_by_name(asset) == 0.0:
|
||||
self.multiaccount_more_options.click()
|
||||
self.scan_tokens_button.click()
|
||||
self.driver.info('Trying to scan for tokens one more time and waiting %s seconds for %s '
|
||||
'to update' % (counter, asset))
|
||||
time.sleep(5)
|
||||
counter += 5
|
||||
else:
|
||||
self.driver.info('Balance of %s is updated!' % asset)
|
||||
return self
|
||||
|
||||
def send_transaction(self, **kwargs):
|
||||
send_transaction_view = self.send_transaction_button.click()
|
||||
send_transaction_view.select_asset_button.click()
|
||||
|
Loading…
x
Reference in New Issue
Block a user