2018-07-13 10:56:36 +00:00
|
|
|
import pytest
|
|
|
|
|
2019-03-26 12:09:29 +00:00
|
|
|
from tests import marks, unique_password, common_password
|
2018-06-30 12:17:38 +00:00
|
|
|
from tests.base_test_case import SingleDeviceTestCase
|
2018-11-26 14:06:34 +00:00
|
|
|
from tests.users import transaction_senders, transaction_recipients, basic_user
|
|
|
|
from views.send_transaction_view import SendTransactionView
|
2018-06-30 12:17:38 +00:00
|
|
|
from views.sign_in_view import SignInView
|
2019-02-19 18:07:59 +00:00
|
|
|
from decimal import Decimal
|
2018-06-30 12:17:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestTransactionDApp(SingleDeviceTestCase):
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5309)
|
|
|
|
@marks.critical
|
2018-06-30 12:17:38 +00:00
|
|
|
def test_send_transaction_from_daap(self):
|
2018-09-17 08:50:01 +00:00
|
|
|
sender = transaction_senders['K']
|
2018-06-30 12:17:38 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
2018-12-25 15:39:05 +00:00
|
|
|
home_view = sign_in_view.recover_access(sender['passphrase'])
|
2018-09-17 08:50:01 +00:00
|
|
|
address = sender['address']
|
2018-06-30 12:17:38 +00:00
|
|
|
initial_balance = self.network_api.get_balance(address)
|
2018-12-25 15:39:05 +00:00
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
2018-06-30 12:17:38 +00:00
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.assets_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.request_stt_button.click()
|
2018-09-17 08:50:01 +00:00
|
|
|
send_transaction_view.sign_transaction()
|
2018-06-30 12:17:38 +00:00
|
|
|
self.network_api.verify_balance_is_updated(initial_balance, address)
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5342)
|
|
|
|
@marks.critical
|
2018-06-30 12:17:38 +00:00
|
|
|
def test_sign_message_from_daap(self):
|
|
|
|
password = 'password_for_daap'
|
|
|
|
sign_in_view = SignInView(self.driver)
|
2018-12-25 15:39:05 +00:00
|
|
|
home_view = sign_in_view.create_user(password=password)
|
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
2018-06-30 12:17:38 +00:00
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.transactions_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.sign_message_button.click()
|
|
|
|
send_transaction_view.find_full_text('Test message')
|
|
|
|
send_transaction_view.enter_password_input.send_keys(password)
|
2019-06-12 08:38:02 +00:00
|
|
|
send_transaction_view.sign_button.click()
|
2018-07-09 19:47:50 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5333)
|
|
|
|
@marks.critical
|
2018-07-13 10:56:36 +00:00
|
|
|
def test_deploy_contract_from_daap(self):
|
2018-09-17 08:50:01 +00:00
|
|
|
sender = transaction_senders['L']
|
2018-07-13 10:56:36 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
2018-12-25 15:39:05 +00:00
|
|
|
home_view = sign_in_view.recover_access(sender['passphrase'])
|
2019-06-19 12:04:52 +00:00
|
|
|
# wallet_view = home_view.wallet_button.click()
|
|
|
|
# wallet_view.set_up_wallet() ## will be updated when 'View signing phrase' enabled
|
2018-12-25 15:39:05 +00:00
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
2018-07-13 10:56:36 +00:00
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.transactions_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.deploy_contract_button.click()
|
2018-09-17 08:50:01 +00:00
|
|
|
send_transaction_view.sign_transaction()
|
2018-07-13 10:56:36 +00:00
|
|
|
for text in 'Contract deployed at: ', 'Call contract get function', \
|
|
|
|
'Call contract set function', 'Call function 2 times in a row':
|
2018-07-25 11:09:45 +00:00
|
|
|
if not status_test_dapp.element_by_text(text).is_element_displayed(120):
|
2018-07-13 10:56:36 +00:00
|
|
|
pytest.fail('Contract was not created')
|
|
|
|
|
2019-03-26 12:09:29 +00:00
|
|
|
@marks.testrail_id(5784)
|
|
|
|
@marks.critical
|
|
|
|
def test_sign_typed_message(self):
|
|
|
|
sender = transaction_senders['W']
|
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
home_view = sign_in_view.recover_access(sender['passphrase'])
|
2019-06-19 12:04:52 +00:00
|
|
|
# wallet_view = home_view.wallet_button.click()
|
|
|
|
# wallet_view.set_up_wallet() ## will be updated when 'View signing phrase' enabled
|
2019-03-26 12:09:29 +00:00
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.transactions_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.sign_typed_message_button.click()
|
|
|
|
send_transaction_view.enter_password_input.send_keys(common_password)
|
2019-06-12 08:38:02 +00:00
|
|
|
send_transaction_view.sign_button.click()
|
2019-03-26 12:09:29 +00:00
|
|
|
status_test_dapp.find_text_part('0xde3048417e5881acc9ca8466ab0b3e2f9f965a70acabbda2d140e95a28b13d2d'
|
|
|
|
'2d38eba6c0a5bfdc50e5d59e0ed3226c749732fd4a9374b57f34121eaff2a5081c')
|
|
|
|
|
2019-02-18 08:12:55 +00:00
|
|
|
@marks.testrail_id(5743)
|
|
|
|
@marks.high
|
|
|
|
def test_send_two_transactions_in_batch_in_dapp(self):
|
|
|
|
sender = transaction_senders['W']
|
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
home_view = sign_in_view.recover_access(sender['passphrase'])
|
2019-06-19 12:04:52 +00:00
|
|
|
# wallet_view = home_view.wallet_button.click()
|
|
|
|
# wallet_view.set_up_wallet() ## will be updated when 'View signing phrase' enabled
|
2019-02-18 08:12:55 +00:00
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.transactions_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.send_two_tx_in_batch_button.click()
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
|
|
|
|
# Check that second 'Send transaction' screen appears
|
2019-06-12 12:59:56 +00:00
|
|
|
if not send_transaction_view.element_by_text('Sign with password').is_element_displayed(10):
|
2019-02-18 08:12:55 +00:00
|
|
|
pytest.fail('Second send transaction screen did not appear!')
|
|
|
|
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
|
|
|
|
@marks.testrail_id(5744)
|
2019-03-05 16:43:30 +00:00
|
|
|
@marks.critical
|
2019-02-18 08:12:55 +00:00
|
|
|
def test_send_two_transactions_one_after_another_in_dapp(self):
|
|
|
|
sender = transaction_senders['Z']
|
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
home_view = sign_in_view.recover_access(sender['passphrase'])
|
2019-06-19 12:04:52 +00:00
|
|
|
# wallet_view = home_view.wallet_button.click()
|
|
|
|
# wallet_view.set_up_wallet() ## will be updated when 'View signing phrase' enabled
|
2019-02-18 08:12:55 +00:00
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.transactions_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.send_two_tx_one_by_one_button.click()
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
|
|
|
|
# Check that second 'Send transaction' screen appears
|
2019-06-12 12:59:56 +00:00
|
|
|
if not send_transaction_view.element_by_text('Sign with password').is_element_displayed(20):
|
2019-02-18 08:12:55 +00:00
|
|
|
pytest.fail('Second send transaction screen did not appear!')
|
|
|
|
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
|
2018-07-11 14:14:39 +00:00
|
|
|
@marks.logcat
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5418)
|
|
|
|
@marks.critical
|
2018-07-09 19:47:50 +00:00
|
|
|
def test_logcat_send_transaction_from_daap(self):
|
2018-09-17 08:50:01 +00:00
|
|
|
sender = transaction_senders['M']
|
2018-07-09 19:47:50 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
2018-12-25 15:39:05 +00:00
|
|
|
home_view = sign_in_view.recover_access(sender['passphrase'], unique_password)
|
2019-06-19 12:04:52 +00:00
|
|
|
# wallet_view = home_view.wallet_button.click()
|
|
|
|
# wallet_view.set_up_wallet() ## will be updated when 'View signing phrase' enabled
|
2018-12-25 15:39:05 +00:00
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
2018-07-09 19:47:50 +00:00
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.assets_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.request_stt_button.click()
|
2018-08-23 13:50:19 +00:00
|
|
|
send_transaction_view.sign_transaction(unique_password)
|
|
|
|
send_transaction_view.check_no_values_in_logcat(password=unique_password)
|
2018-07-09 19:47:50 +00:00
|
|
|
|
2018-07-11 14:14:39 +00:00
|
|
|
@marks.logcat
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5420)
|
|
|
|
@marks.critical
|
2018-07-09 19:47:50 +00:00
|
|
|
def test_logcat_sign_message_from_daap(self):
|
|
|
|
sign_in_view = SignInView(self.driver)
|
2018-12-25 15:39:05 +00:00
|
|
|
home_view = sign_in_view.create_user(password=unique_password)
|
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
2018-07-09 19:47:50 +00:00
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.transactions_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.sign_message_button.click()
|
|
|
|
send_transaction_view.sign_transaction_button.click_until_presence_of_element(
|
|
|
|
send_transaction_view.enter_password_input)
|
2018-08-23 13:50:19 +00:00
|
|
|
send_transaction_view.enter_password_input.send_keys(unique_password)
|
2019-06-12 08:38:02 +00:00
|
|
|
send_transaction_view.sign_button.click()
|
2018-08-23 13:50:19 +00:00
|
|
|
send_transaction_view.check_no_values_in_logcat(password=unique_password)
|
2018-07-23 11:38:47 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5372)
|
|
|
|
@marks.high
|
2018-07-23 11:38:47 +00:00
|
|
|
def test_request_eth_in_status_test_dapp(self):
|
|
|
|
sign_in_view = SignInView(self.driver)
|
2018-12-25 15:39:05 +00:00
|
|
|
home_view = sign_in_view.create_user()
|
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
2018-07-23 11:38:47 +00:00
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.assets_button.click()
|
|
|
|
status_test_dapp.request_eth_button.click()
|
2019-06-07 13:40:09 +00:00
|
|
|
status_test_dapp.element_by_text_part('Faucet request').wait_for_visibility_of_element()
|
2018-07-23 11:38:47 +00:00
|
|
|
status_test_dapp.ok_button.click()
|
2018-08-01 00:16:33 +00:00
|
|
|
status_test_dapp.cross_icon.click()
|
2018-07-23 11:38:47 +00:00
|
|
|
wallet_view = sign_in_view.wallet_button.click()
|
2019-06-19 12:04:52 +00:00
|
|
|
# wallet_view.set_up_wallet() ## will be updated when 'View signing phrase' enabled
|
2018-07-23 11:38:47 +00:00
|
|
|
wallet_view.wait_balance_changed_on_wallet_screen()
|
2018-10-07 15:12:21 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5355)
|
2019-03-05 16:43:30 +00:00
|
|
|
@marks.medium
|
2019-06-19 12:04:52 +00:00
|
|
|
@marks.skip # No onboarding for now. TO re-enable once wallet onboarding done
|
2018-11-07 15:50:08 +00:00
|
|
|
def test_onboarding_screen_when_requesting_tokens_for_new_account(self):
|
2018-10-07 15:12:21 +00:00
|
|
|
signin_view = SignInView(self.driver)
|
|
|
|
home_view = signin_view.create_user()
|
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.assets_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.request_stt_button.click()
|
|
|
|
if not send_transaction_view.onboarding_message.is_element_displayed():
|
2018-11-07 15:50:08 +00:00
|
|
|
self.driver.fail('It seems onboarding screen is not shown.')
|
2018-10-07 15:12:21 +00:00
|
|
|
|
2018-11-07 15:50:08 +00:00
|
|
|
@marks.testrail_id(5677)
|
|
|
|
@marks.high
|
2019-06-19 12:04:52 +00:00
|
|
|
@marks.skip # No onboarding for now. TO re-enable once wallet onboarding done
|
2018-11-07 15:50:08 +00:00
|
|
|
def test_onboarding_screen_when_requesting_tokens_for_recovered_account(self):
|
|
|
|
signin_view = SignInView(self.driver)
|
|
|
|
home_view = signin_view.recover_access(passphrase=transaction_senders['U']['passphrase'])
|
2018-10-07 15:12:21 +00:00
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.assets_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.request_stt_button.click()
|
|
|
|
if not send_transaction_view.onboarding_message.is_element_displayed():
|
2018-11-07 15:50:08 +00:00
|
|
|
self.driver.fail('It seems onboarding screen is not shown.')
|
2018-11-07 13:09:23 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5380)
|
|
|
|
@marks.high
|
2019-06-19 12:04:52 +00:00
|
|
|
@marks.skip # No onboarding for now. TO re-enable once wallet onboarding done
|
2018-11-07 13:09:23 +00:00
|
|
|
def test_user_can_complete_tx_to_dapp_when_onboarding_via_dapp_completed(self):
|
|
|
|
user = transaction_recipients['G']
|
|
|
|
signin_view = SignInView(self.driver)
|
|
|
|
home_view = signin_view.recover_access(passphrase=user['passphrase'])
|
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.assets_button.click()
|
|
|
|
|
|
|
|
send_transaction_view = status_test_dapp.request_stt_button.click()
|
|
|
|
if not send_transaction_view.onboarding_message.is_element_displayed():
|
|
|
|
self.driver.fail('It seems onborading screen is not shown.')
|
|
|
|
send_transaction_view.complete_onboarding()
|
|
|
|
|
|
|
|
if not send_transaction_view.sign_transaction_button.is_element_displayed():
|
|
|
|
self.driver.fail('It seems transaction sign screen is not shown.')
|
|
|
|
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
|
|
|
|
if not status_test_dapp.assets_button.is_element_displayed():
|
|
|
|
self.driver.fail('It seems users was not redirected to Status DAPP screen.')
|
2018-11-26 14:06:34 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5685)
|
|
|
|
@marks.medium
|
|
|
|
def test_not_enough_eth_for_gas_validation_from_dapp(self):
|
|
|
|
singin_view = SignInView(self.driver)
|
|
|
|
home_view = singin_view.create_user()
|
|
|
|
wallet = home_view.wallet_button.click()
|
|
|
|
wallet.set_up_wallet()
|
|
|
|
wallet_address = wallet.get_wallet_address()
|
|
|
|
home_view = wallet.get_back_to_home_view()
|
|
|
|
status_test_dapp = home_view.open_status_test_dapp()
|
|
|
|
status_test_dapp.wait_for_d_aap_to_load()
|
|
|
|
status_test_dapp.transactions_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.deploy_contract_button.click()
|
|
|
|
|
|
|
|
warning = 'No "Not enough ETH for gas" warning appeared while {}'
|
|
|
|
sign_button_warning = 'Signin transaction button is enabled while {}'
|
|
|
|
|
|
|
|
# Check whether deploying simple contract with an empty ETH balance triggers the warning
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('deploying a contract with an empty ETH balance'))
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append(sign_button_warning.format('deploying a contract with an empty ETH balance'))
|
|
|
|
|
|
|
|
# Requesting test ETH and waiting till the balance updates
|
|
|
|
send_transaction_view.cross_icon.click()
|
2019-05-09 14:28:33 +00:00
|
|
|
self.network_api.get_donate(wallet_address[2:])
|
2018-11-26 14:06:34 +00:00
|
|
|
self.network_api.verify_balance_is_updated(initial_balance=0, recipient_address=wallet_address[2:])
|
|
|
|
|
|
|
|
status_test_dapp.transactions_button.click()
|
|
|
|
send_transaction_view = status_test_dapp.send_one_tx_in_batch_button.click()
|
|
|
|
send_transaction_view.advanced_button.click()
|
|
|
|
send_transaction_view.transaction_fee_button.click()
|
|
|
|
gas_limit = '100000'
|
|
|
|
send_transaction_view.gas_limit_input.clear()
|
|
|
|
send_transaction_view.gas_limit_input.set_value(gas_limit)
|
|
|
|
gas_price = '999.900000001'
|
|
|
|
send_transaction_view.gas_price_input.clear()
|
|
|
|
send_transaction_view.gas_price_input.set_value(gas_price)
|
|
|
|
send_transaction_view.total_fee_input.click()
|
|
|
|
send_transaction_view.done_button.click()
|
|
|
|
|
|
|
|
# Check whether sending a tx in batch with big gas limit and price triggers the warning and sign button is still
|
|
|
|
# disabled (no funds to pay gas)
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('sending one transaction in batch with big gas '
|
|
|
|
'limit and price (no funds to pay gas)'))
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append(sign_button_warning.
|
|
|
|
format('sending one transaction in batch with big gas '
|
|
|
|
'limit and price (no funds to pay gas)'))
|
|
|
|
|
|
|
|
send_transaction_view.transaction_fee_button.click()
|
|
|
|
gas_price = '999.9'
|
|
|
|
send_transaction_view.gas_price_input.clear()
|
|
|
|
send_transaction_view.gas_price_input.set_value(gas_price)
|
|
|
|
send_transaction_view.total_fee_input.click()
|
|
|
|
send_transaction_view.done_button.click()
|
|
|
|
|
|
|
|
# Check whether sending a tx in batch with normal gas limit and price does not trigger the warning
|
|
|
|
# so the transaction can be signed
|
|
|
|
if send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('"Not enough ETH for gas" warning appeared while sending '
|
|
|
|
'one transaction in batch with normal gas limit and price'))
|
|
|
|
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
if not status_test_dapp.assets_button.is_element_displayed():
|
|
|
|
self.errors.append('Could not sing the transaction!')
|
|
|
|
|
|
|
|
self.verify_no_errors()
|
|
|
|
|
|
|
|
@marks.testrail_id(5686)
|
|
|
|
@marks.medium
|
|
|
|
def test_not_enough_eth_for_gas_validation_from_wallet(self):
|
|
|
|
singin_view = SignInView(self.driver)
|
|
|
|
home_view = singin_view.create_user()
|
|
|
|
wallet = home_view.wallet_button.click()
|
|
|
|
wallet.set_up_wallet()
|
2019-05-27 16:45:20 +00:00
|
|
|
wallet.select_asset("STT")
|
2018-11-26 14:06:34 +00:00
|
|
|
wallet_address = wallet.get_wallet_address()
|
|
|
|
recipient = '0x' + basic_user['address']
|
|
|
|
|
2019-03-21 11:36:09 +00:00
|
|
|
wallet.send_transaction(asset_name='ETHro', amount=0, recipient=recipient, sign_transaction=False)
|
2018-11-26 14:06:34 +00:00
|
|
|
send_transaction_view = SendTransactionView(self.driver)
|
|
|
|
|
|
|
|
warning = 'No "Not enough ETH for gas" warning appeared while {}'
|
|
|
|
sign_button_warning = 'Signin transaction button is enabled {}'
|
|
|
|
|
|
|
|
# Check whether sending 0 ETH with an empty ETH balance triggers the warning
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('sending 0 ETH with an empty ETH balance'))
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append(sign_button_warning.format('sending 0 ETH with an empty ETH balance'))
|
|
|
|
|
2019-06-14 15:28:03 +00:00
|
|
|
send_transaction_view.cancel_button.click()
|
2018-11-26 14:06:34 +00:00
|
|
|
asset_button = send_transaction_view.asset_by_name('STT')
|
|
|
|
send_transaction_view.select_asset_button.click_until_presence_of_element(asset_button)
|
|
|
|
asset_button.click()
|
|
|
|
send_transaction_view.amount_edit_box.set_value('0')
|
|
|
|
send_transaction_view.confirm()
|
|
|
|
|
|
|
|
# Check whether sending 0 STT with an empty ETH balance triggers the warning
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('sending 0 STT with an empty ETH balance'))
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append(sign_button_warning.format('sending 0 STT with an empty ETH balance'))
|
|
|
|
|
2019-06-14 15:28:03 +00:00
|
|
|
send_transaction_view.cancel_button.click()
|
2018-11-26 14:06:34 +00:00
|
|
|
home_view = send_transaction_view.get_back_to_home_view()
|
|
|
|
# Requesting test ETH and waiting till the balance updates
|
|
|
|
self.network_api.faucet(wallet_address[2:])
|
|
|
|
self.network_api.verify_balance_is_updated(initial_balance=0, recipient_address=wallet_address[2:])
|
|
|
|
|
|
|
|
wallet = home_view.wallet_button.click()
|
2019-03-21 11:36:09 +00:00
|
|
|
wallet.send_transaction(asset_name='ETHro', amount=0.1, recipient=recipient, sign_transaction=False)
|
2018-11-26 14:06:34 +00:00
|
|
|
|
|
|
|
# Check whether sending all available ETH triggers the warning
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('sending all available ETH (no funds to pay gas)'))
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append('sending all available ETH (no funds to pay gas)')
|
|
|
|
send_transaction_view.amount_edit_box.clear()
|
2019-02-15 16:14:42 +00:00
|
|
|
|
|
|
|
# Because tx gas price may change we calculate eth value according to current gas fee value
|
|
|
|
send_transaction_view.advanced_button.click()
|
|
|
|
transaction_fee_total = send_transaction_view.get_transaction_fee_total()
|
2019-02-19 18:07:59 +00:00
|
|
|
eth_available_for_tx = str(Decimal('0.1') - Decimal(transaction_fee_total))
|
2019-02-15 16:14:42 +00:00
|
|
|
wei = '0.000000000000000001'
|
|
|
|
eth_value_plus_one_wei = ''.join([eth_available_for_tx, wei[len(eth_available_for_tx):]])
|
|
|
|
send_transaction_view.amount_edit_box.set_value(eth_value_plus_one_wei)
|
2018-11-26 14:06:34 +00:00
|
|
|
send_transaction_view.confirm()
|
|
|
|
|
|
|
|
# Check whether sending big amount of ETH triggers the warning (no funds to pay gas)
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append('sending big amount of ETH (no funds to pay gas)')
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append('sending big amount of ETH (no funds to pay gas)')
|
|
|
|
|
|
|
|
send_transaction_view.amount_edit_box.clear()
|
2019-02-15 16:14:42 +00:00
|
|
|
send_transaction_view.amount_edit_box.set_value(eth_available_for_tx)
|
2018-11-26 14:06:34 +00:00
|
|
|
send_transaction_view.confirm()
|
|
|
|
|
|
|
|
# Check whether sending normal amount of ETH does not trigger the warning
|
|
|
|
if send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append('"Not enough ETH for gas" warning appeared while sending normal amount of ETH')
|
|
|
|
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
if not wallet.send_transaction_button.is_element_displayed():
|
|
|
|
self.errors.append('Could not sing the transaction!')
|
|
|
|
|
|
|
|
self.verify_no_errors()
|
|
|
|
|
|
|
|
@marks.testrail_id(5687)
|
|
|
|
@marks.medium
|
|
|
|
@marks.skip
|
|
|
|
def test_not_enough_eth_for_gas_validation_from_chat(self):
|
|
|
|
signin_view = SignInView(self.driver)
|
|
|
|
home_view = signin_view.create_user()
|
|
|
|
recipient_public_key = basic_user['public_key']
|
|
|
|
wallet = home_view.wallet_button.click()
|
|
|
|
wallet.set_up_wallet()
|
|
|
|
wallet_address = wallet.get_wallet_address()
|
|
|
|
home_view = wallet.get_back_to_home_view()
|
|
|
|
|
|
|
|
chat = home_view.add_contact(recipient_public_key)
|
|
|
|
chat.send_transaction_in_1_1_chat(asset='ETHro', amount='0', wallet_set_up=False, sign_transaction=False)
|
|
|
|
send_transaction_view = SendTransactionView(self.driver)
|
|
|
|
|
|
|
|
warning = 'No "Not enough ETH for gas" warning appeared while {}'
|
|
|
|
sign_button_warning = 'Signin transaction button is enabled {}'
|
|
|
|
|
|
|
|
# Check whether sending 0 ETH with an empty ETH balance triggers the warning
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('sending 0 ETH with an empty ETH balance'))
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append(sign_button_warning.format('sending 0 ETH with an empty ETH balance'))
|
|
|
|
|
|
|
|
send_transaction_view.cross_icon.click()
|
|
|
|
chat.send_transaction_in_1_1_chat(asset='STT', amount='0', wallet_set_up=False, sign_transaction=False)
|
|
|
|
|
|
|
|
# Check whether sending 0 STT with an empty ETH balance triggers the warning
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('sending 0 STT with an empty ETH balance'))
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append(sign_button_warning.format('sending 0 STT with an empty ETH balance'))
|
|
|
|
|
|
|
|
send_transaction_view.cross_icon.click()
|
|
|
|
# Requesting test ETH and waiting till the balance updates
|
|
|
|
self.network_api.faucet(wallet_address[2:])
|
|
|
|
self.network_api.verify_balance_is_updated(initial_balance=0, recipient_address=wallet_address[2:])
|
|
|
|
chat.send_transaction_in_1_1_chat(asset='ETHro', amount='0.1', wallet_set_up=False, sign_transaction=False)
|
|
|
|
|
|
|
|
# Check whether sending all available ETH triggers the warning
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append(warning.format('sending all available ETH'))
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append(sign_button_warning.format('sending all available ETH'))
|
|
|
|
|
|
|
|
chat.send_transaction_in_1_1_chat(asset='ETHro', amount='0.099979000000000001',
|
|
|
|
wallet_set_up=False, sign_transaction=False)
|
|
|
|
|
|
|
|
# Check whether sending big amount of ETH triggers the warning (no funds to pay gas)
|
|
|
|
if not send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append('sending big amount of ETH (no funds to pay gas)')
|
|
|
|
|
|
|
|
# Check whether sign transaction button is disabled
|
|
|
|
send_transaction_view.sign_transaction_button.click()
|
|
|
|
if send_transaction_view.enter_password_input.is_element_displayed():
|
|
|
|
self.errors.append('sending big amount of ETH (no funds to pay gas)')
|
|
|
|
|
|
|
|
chat.send_transaction_in_1_1_chat(asset='ETHro', amount='0.099979', wallet_set_up=False, sign_transaction=False)
|
|
|
|
# Check whether sending normal amount of ETH does not trigger the warning
|
|
|
|
if send_transaction_view.validation_warnings.not_enough_eth_for_gas.is_element_displayed():
|
|
|
|
self.errors.append('"Not enough ETH for gas" warning appeared while sending normal amount of ETH')
|
|
|
|
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
if not wallet.send_transaction_button.is_element_displayed():
|
|
|
|
self.errors.append('Could not sing the transaction!')
|
|
|
|
|
|
|
|
self.verify_no_errors()
|