Add test to send Max tokens from wallet
Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
parent
5232432ec5
commit
2cf4be4b34
|
@ -661,7 +661,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
|
||||||
mailserver = mailserver_1 if profile_view.element_by_text(mailserver_2).is_element_present() else mailserver_2
|
mailserver = mailserver_1 if profile_view.element_by_text(mailserver_2).is_element_present() else mailserver_2
|
||||||
profile_view.mail_server_button.click()
|
profile_view.mail_server_button.click()
|
||||||
profile_view.mail_server_auto_selection_button.click()
|
profile_view.mail_server_auto_selection_button.click()
|
||||||
profile_view.element_by_text(mailserver).click()
|
profile_view.mail_server_by_name(mailserver).click()
|
||||||
profile_view.confirm_button.click()
|
profile_view.confirm_button.click()
|
||||||
|
|
||||||
profile_view.just_fyi('check that mailserver is pinned')
|
profile_view.just_fyi('check that mailserver is pinned')
|
||||||
|
@ -670,17 +670,12 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
|
||||||
self.errors.append('"%s" mailserver is not pinned' % mailserver)
|
self.errors.append('"%s" mailserver is not pinned' % mailserver)
|
||||||
profile_view.get_back_to_home_view()
|
profile_view.get_back_to_home_view()
|
||||||
|
|
||||||
profile_view.just_fyi('relogin and check that settings are preserved')
|
profile_view.just_fyi('Relogin and check that settings are preserved')
|
||||||
home_view.relogin()
|
home_view.relogin()
|
||||||
home_view.profile_button.click()
|
home_view.profile_button.click()
|
||||||
profile_view.sync_settings_button.click()
|
profile_view.sync_settings_button.click()
|
||||||
if not profile_view.element_by_text(mailserver).is_element_displayed():
|
if not profile_view.element_by_text(mailserver).is_element_displayed():
|
||||||
self.errors.append('"%s" mailserver is not pinned' % mailserver)
|
self.errors.append('"%s" mailserver is not pinned' % mailserver)
|
||||||
profile_view.mail_server_button.click()
|
|
||||||
profile_view.mail_server_auto_selection_button.click()
|
|
||||||
profile_view.element_by_text(mailserver).click()
|
|
||||||
if profile_view.confirm_button.is_element_displayed():
|
|
||||||
self.errors.append('can select mailserver with "Autoselection" switched on')
|
|
||||||
|
|
||||||
self.errors.verify_no_errors()
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@ -791,7 +786,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
|
||||||
# TODO: temporary pin mailserver to avoid issue 9269 - should be disabled after fix
|
# TODO: temporary pin mailserver to avoid issue 9269 - should be disabled after fix
|
||||||
mailserver = mailserver_1 if profile_1.element_by_text(mailserver_2).is_element_present() else mailserver_2
|
mailserver = mailserver_1 if profile_1.element_by_text(mailserver_2).is_element_present() else mailserver_2
|
||||||
profile_1.mail_server_auto_selection_button.click()
|
profile_1.mail_server_auto_selection_button.click()
|
||||||
profile_1.element_by_text(mailserver).click()
|
profile_1.mail_server_by_name(mailserver).click()
|
||||||
profile_1.confirm_button.click()
|
profile_1.confirm_button.click()
|
||||||
profile_1.just_fyi('add custom mailserver (check address/name validation) and connect to it')
|
profile_1.just_fyi('add custom mailserver (check address/name validation) and connect to it')
|
||||||
profile_1.plus_button.click()
|
profile_1.plus_button.click()
|
||||||
|
|
|
@ -3,8 +3,8 @@ import string
|
||||||
|
|
||||||
from support.utilities import get_merged_txs_list
|
from support.utilities import get_merged_txs_list
|
||||||
from tests import marks, unique_password
|
from tests import marks, unique_password
|
||||||
from tests.base_test_case import SingleDeviceTestCase
|
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
||||||
from tests.users import transaction_senders, basic_user, wallet_users, ens_user_ropsten
|
from tests.users import transaction_senders, basic_user, wallet_users, ens_user_ropsten, transaction_recipients
|
||||||
from views.send_transaction_view import SendTransactionView
|
from views.send_transaction_view import SendTransactionView
|
||||||
from views.sign_in_view import SignInView
|
from views.sign_in_view import SignInView
|
||||||
|
|
||||||
|
@ -672,3 +672,49 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
|
||||||
self.errors.append(warning % (errors['sending_screen']['Network fee'],screen))
|
self.errors.append(warning % (errors['sending_screen']['Network fee'],screen))
|
||||||
self.errors.verify_no_errors()
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
|
||||||
|
class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):
|
||||||
|
|
||||||
|
@marks.testrail_id(6330)
|
||||||
|
@marks.medium
|
||||||
|
def test_can_send_all_tokens_via_max_option(self):
|
||||||
|
sender = transaction_senders['V']
|
||||||
|
receiver = transaction_recipients['K']
|
||||||
|
self.create_drivers(2)
|
||||||
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||||
|
|
||||||
|
device_1_home, device_2_home = device_1.recover_access(sender['passphrase']), \
|
||||||
|
device_2.recover_access(receiver['passphrase'])
|
||||||
|
|
||||||
|
wallet_view_serder = device_1_home.wallet_button.click()
|
||||||
|
wallet_view_serder.set_up_wallet()
|
||||||
|
wallet_view_receiver = device_2_home.wallet_button.click()
|
||||||
|
wallet_view_receiver.set_up_wallet()
|
||||||
|
|
||||||
|
if wallet_view_receiver.asset_by_name('STT').is_element_present(10):
|
||||||
|
initial_balance = wallet_view_receiver.get_asset_amount_by_name("STT")
|
||||||
|
else:
|
||||||
|
initial_balance = '0'
|
||||||
|
|
||||||
|
device_1.just_fyi("Sending token amount to device who will use Set Max option for token")
|
||||||
|
amount = '0.012345678912345678'
|
||||||
|
wallet_view_serder.accounts_status_account.click()
|
||||||
|
wallet_view_serder.send_transaction(asset_name='STT', amount=amount, recipient=receiver['address'], default_gas_price=False)
|
||||||
|
wallet_view_receiver.wait_balance_is_changed(asset='STT', initial_balance=initial_balance, scan_tokens=True)
|
||||||
|
wallet_view_receiver.accounts_status_account.click()
|
||||||
|
|
||||||
|
device_1.just_fyi("Send all tokens via Set Max option")
|
||||||
|
send_transaction_view = wallet_view_receiver.send_transaction_button.click()
|
||||||
|
send_transaction_view.select_asset_button.click()
|
||||||
|
asset_name = 'STT'
|
||||||
|
asset_button = send_transaction_view.asset_by_name(asset_name)
|
||||||
|
send_transaction_view.select_asset_button.click_until_presence_of_element(
|
||||||
|
send_transaction_view.eth_asset_in_select_asset_bottom_sheet_button)
|
||||||
|
asset_button.click()
|
||||||
|
send_transaction_view.set_max_button.click()
|
||||||
|
send_transaction_view.set_recipient_address(sender['address'])
|
||||||
|
send_transaction_view.sign_transaction_button.click()
|
||||||
|
send_transaction_view.sign_transaction(default_gas_price=False)
|
||||||
|
wallet_view_receiver.back_button.click()
|
||||||
|
initial_balance = float(initial_balance) + float(amount)
|
||||||
|
wallet_view_receiver.wait_balance_is_changed(asset='STT', initial_balance=str(initial_balance), scan_tokens=True)
|
||||||
|
|
|
@ -341,6 +341,15 @@ transaction_recipients['J']['username'] = "Seashell Amazing Gemsbuck"
|
||||||
transaction_recipients['J']['address'] = "0xa03a75b7888cac24b35b4d1f5924406f3b491795"
|
transaction_recipients['J']['address'] = "0xa03a75b7888cac24b35b4d1f5924406f3b491795"
|
||||||
transaction_recipients['J']['public_key'] = "0x04e7e481932714c1a13ffb29fc79446ee9f30d27b4dec47af9dcd20c68a771c2520a0e" \
|
transaction_recipients['J']['public_key'] = "0x04e7e481932714c1a13ffb29fc79446ee9f30d27b4dec47af9dcd20c68a771c2520a0e" \
|
||||||
"7a80804ff59a750693492a65be9682d0b850b4080d976cf9e43ff37ec841"
|
"7a80804ff59a750693492a65be9682d0b850b4080d976cf9e43ff37ec841"
|
||||||
|
|
||||||
|
transaction_recipients['K'] = dict()
|
||||||
|
transaction_recipients['K']['passphrase'] = "core orphan clerk involve trade admit exhibit valid short canvas disorder world"
|
||||||
|
transaction_recipients['K']['username'] = "Upright Authorized Waterstrider"
|
||||||
|
transaction_recipients['K']['address'] = "0x6a1aC3a7a5A064FF6E0f169E0d384703245556b4"
|
||||||
|
transaction_recipients['K']['public_key'] = "0x04d1c98a6e25a7ea0241349a41709c5dc51c7c1d59224076d13d1ebe16671eedc8f" \
|
||||||
|
"3b23ab95db679a9124752ed77339424034fd9a12f0184894c0d7a25710d2f3c"
|
||||||
|
|
||||||
|
|
||||||
recovery_users = {
|
recovery_users = {
|
||||||
"radar blur cabbage chef fix engine embark joy scheme fiction master release":
|
"radar blur cabbage chef fix engine embark joy scheme fiction master release":
|
||||||
"0xaC39b311DCEb2A4b2f5d8461c1cdaF756F4F7Ae9",
|
"0xaC39b311DCEb2A4b2f5d8461c1cdaF756F4F7Ae9",
|
||||||
|
|
|
@ -404,7 +404,8 @@ class MailServerAddressInput(BaseEditBox):
|
||||||
class MailServerAutoSelectionButton(BaseButton):
|
class MailServerAutoSelectionButton(BaseButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(MailServerAutoSelectionButton, self).__init__(driver)
|
super(MailServerAutoSelectionButton, self).__init__(driver)
|
||||||
self.locator = self.Locator.accessibility_id("checkbox")
|
self.locator = self.Locator.xpath_selector("//*[@text='Automatic selection']/following-sibling::*[1]")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MailServerElement(BaseButton):
|
class MailServerElement(BaseButton):
|
||||||
|
@ -415,8 +416,10 @@ class MailServerElement(BaseButton):
|
||||||
self.locator = self.Locator.xpath_selector("//*[@content-desc='mailserver-item']//*[@text='%s']" % server_name)
|
self.locator = self.Locator.xpath_selector("//*[@content-desc='mailserver-item']//*[@text='%s']" % server_name)
|
||||||
|
|
||||||
def click(self):
|
def click(self):
|
||||||
self.scroll_to_element().click()
|
size = self.driver.get_window_size()
|
||||||
|
self.driver.swipe(500, size["height"]*0.8, 500, size["height"]*0.05)
|
||||||
self.driver.info('Tap on "%s" mailserver value' % self.server_name)
|
self.driver.info('Tap on "%s" mailserver value' % self.server_name)
|
||||||
|
self.find_element().click()
|
||||||
|
|
||||||
|
|
||||||
class MailServerConnectButton(BaseButton):
|
class MailServerConnectButton(BaseButton):
|
||||||
|
|
|
@ -484,7 +484,7 @@ class WalletView(BaseView):
|
||||||
self.driver.info('Balance for %s is equal to %s' % (asset, expected_balance))
|
self.driver.info('Balance for %s is equal to %s' % (asset, expected_balance))
|
||||||
return
|
return
|
||||||
|
|
||||||
def wait_balance_is_changed(self, asset ='ETH', initial_balance=0, wait_time=300):
|
def wait_balance_is_changed(self, asset ='ETH', initial_balance=0, wait_time=300, scan_tokens=False):
|
||||||
counter = 0
|
counter = 0
|
||||||
while True:
|
while True:
|
||||||
if counter >= wait_time:
|
if counter >= wait_time:
|
||||||
|
@ -497,6 +497,8 @@ class WalletView(BaseView):
|
||||||
elif not self.asset_by_name(asset).is_element_present(10):
|
elif not self.asset_by_name(asset).is_element_present(10):
|
||||||
counter += 10
|
counter += 10
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
if scan_tokens:
|
||||||
|
self.scan_tokens()
|
||||||
self.swipe_down()
|
self.swipe_down()
|
||||||
self.driver.info('Waiting %s seconds for %s to display asset' % (counter, asset))
|
self.driver.info('Waiting %s seconds for %s to display asset' % (counter, asset))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue