2017-10-19 13:49:20 +00:00
|
|
|
import pytest
|
2018-01-26 11:07:09 +00:00
|
|
|
from tests import api_requests, transaction_users_wallet
|
2018-01-03 09:34:40 +00:00
|
|
|
from tests.base_test_case import SingleDeviceTestCase
|
|
|
|
from views.console_view import ConsoleView
|
2017-10-19 13:49:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.all
|
|
|
|
class TestWallet(SingleDeviceTestCase):
|
|
|
|
|
|
|
|
@pytest.mark.wallet
|
2017-10-23 10:23:14 +00:00
|
|
|
def test_wallet_error_messages(self):
|
2018-01-03 09:34:40 +00:00
|
|
|
console = ConsoleView(self.driver)
|
2018-01-26 11:07:09 +00:00
|
|
|
console.create_user()
|
2018-01-14 17:43:36 +00:00
|
|
|
console.back_button.click()
|
|
|
|
wallet_view = console.wallet_button.click()
|
|
|
|
send_transaction = wallet_view.send_button.click()
|
2018-01-03 09:34:40 +00:00
|
|
|
send_transaction.amount_edit_box.send_keys('asd')
|
|
|
|
send_transaction.find_full_text('Amount is not a valid number')
|
|
|
|
send_transaction.amount_edit_box.send_keys('0,1')
|
|
|
|
send_transaction.find_full_text('Insufficient funds')
|
2017-10-19 13:49:20 +00:00
|
|
|
|
2017-10-23 20:46:49 +00:00
|
|
|
@pytest.mark.wallet
|
2017-12-27 18:03:57 +00:00
|
|
|
def test_eth_and_currency_balance(self):
|
2017-10-23 20:46:49 +00:00
|
|
|
errors = list()
|
2018-01-03 09:34:40 +00:00
|
|
|
console = ConsoleView(self.driver)
|
2018-01-26 11:07:09 +00:00
|
|
|
console.recover_access(passphrase=transaction_users_wallet['A_USER']['passphrase'],
|
|
|
|
password=transaction_users_wallet['A_USER']['password'],
|
|
|
|
username=transaction_users_wallet['A_USER']['username'])
|
2018-01-14 17:43:36 +00:00
|
|
|
home_view = console.get_home_view()
|
|
|
|
wallet = home_view.wallet_button.click()
|
2017-12-07 13:14:45 +00:00
|
|
|
address = transaction_users_wallet['A_USER']['address']
|
2018-01-03 09:34:40 +00:00
|
|
|
balance = api_requests.get_balance(address) / 1000000000000000000
|
|
|
|
eth_rate = api_requests.get_ethereum_price_in_usd()
|
2017-10-23 20:46:49 +00:00
|
|
|
wallet_balance = wallet.get_eth_value()
|
|
|
|
if wallet_balance != balance:
|
|
|
|
errors.append('Balance %s is not equal to the expected %s' % (wallet_balance, balance))
|
2017-12-27 18:03:57 +00:00
|
|
|
wallet.verify_currency_balance(eth_rate, errors)
|
2017-10-23 20:46:49 +00:00
|
|
|
assert not errors, 'errors occurred:\n{}'.format('\n'.join(errors))
|