2018-07-13 10:56:36 +00:00
|
|
|
|
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)
|
2020-05-14 10:41:09 +00:00
|
|
|
home_view = sign_in_view.recover_access(sender['passphrase'], unique_password)
|
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)
|
2019-07-12 07:16:02 +00:00
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
wallet_view.set_up_wallet()
|
2020-05-14 10:41:09 +00:00
|
|
|
initial_amount_STT = wallet_view.get_asset_amount_by_name('STT')
|
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()
|
2020-05-14 10:41:09 +00:00
|
|
|
send_transaction_view.sign_transaction(unique_password)
|
2018-06-30 12:17:38 +00:00
|
|
|
self.network_api.verify_balance_is_updated(initial_balance, address)
|
2020-05-14 10:41:09 +00:00
|
|
|
status_test_dapp.wallet_button.click()
|
|
|
|
|
|
|
|
send_transaction_view.just_fyi('Verify that wallet balance is updated')
|
|
|
|
wallet_view.wait_balance_is_changed('STT', initial_amount_STT)
|
|
|
|
|
|
|
|
send_transaction_view.just_fyi('Check logcat for sensitive data')
|
|
|
|
values_in_logcat = send_transaction_view.find_values_in_logcat(password=unique_password)
|
|
|
|
if values_in_logcat:
|
|
|
|
self.driver.fail(values_in_logcat)
|
2018-06-30 12:17:38 +00:00
|
|
|
|
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)
|
2019-07-12 07:16:02 +00:00
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
wallet_view.set_up_wallet()
|
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.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()
|
2020-05-14 10:41:09 +00:00
|
|
|
if not status_test_dapp.element_by_text_part('Signed message').is_element_displayed():
|
|
|
|
self.driver.fail('Message was not signed')
|
|
|
|
|
|
|
|
send_transaction_view.just_fyi('Check logcat for sensitive data')
|
|
|
|
values_in_logcat = send_transaction_view.find_values_in_logcat(password=password)
|
|
|
|
if values_in_logcat:
|
|
|
|
self.driver.fail(values_in_logcat)
|
2018-07-09 19:47:50 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5333)
|
2020-05-15 11:51:05 +00:00
|
|
|
@marks.low
|
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-07-12 07:16:02 +00:00
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
wallet_view.set_up_wallet()
|
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()
|
2020-05-15 11:51:05 +00:00
|
|
|
send_transaction_view.sign_transaction(default_gas_price=False)
|
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':
|
2019-11-12 10:21:55 +00:00
|
|
|
if not status_test_dapp.element_by_text(text).is_element_displayed(180):
|
2019-10-21 12:48:45 +00:00
|
|
|
self.driver.fail('Contract was not created')
|
2018-07-13 10:56:36 +00:00
|
|
|
|
2019-03-26 12:09:29 +00:00
|
|
|
@marks.testrail_id(5784)
|
2020-05-19 10:40:39 +00:00
|
|
|
@marks.medium
|
2019-03-26 12:09:29 +00:00
|
|
|
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-07-12 07:16:02 +00:00
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
wallet_view.set_up_wallet()
|
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()
|
2019-12-11 13:24:13 +00:00
|
|
|
status_test_dapp.transactions_button.click_until_presence_of_element(status_test_dapp.sign_typed_message_button)
|
2019-03-26 12:09:29 +00:00
|
|
|
send_transaction_view = status_test_dapp.sign_typed_message_button.click()
|
|
|
|
send_transaction_view.enter_password_input.send_keys(common_password)
|
2019-09-26 09:11:46 +00:00
|
|
|
send_transaction_view.sign_button.click_until_presence_of_element(send_transaction_view.ok_button)
|
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-07-12 07:16:02 +00:00
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
wallet_view.set_up_wallet()
|
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()
|
2019-12-06 15:42:30 +00:00
|
|
|
status_test_dapp.transactions_button.click_until_presence_of_element(status_test_dapp.send_two_tx_in_batch_button)
|
2019-02-18 08:12:55 +00:00
|
|
|
send_transaction_view = status_test_dapp.send_two_tx_in_batch_button.click()
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
|
2020-04-07 14:57:31 +00:00
|
|
|
wallet_view.just_fyi('Check that second "Send transaction" screen appears')
|
2020-05-14 10:41:09 +00:00
|
|
|
if not send_transaction_view.sign_with_password.is_element_displayed(10):
|
2019-10-21 12:48:45 +00:00
|
|
|
self.driver.fail('Second send transaction screen did not appear!')
|
2019-02-18 08:12:55 +00:00
|
|
|
|
|
|
|
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-07-12 07:16:02 +00:00
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
wallet_view.set_up_wallet()
|
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()
|
|
|
|
|
2020-05-14 10:41:09 +00:00
|
|
|
send_transaction_view.just_fyi('Check that second "Send transaction" screen appears')
|
|
|
|
if not send_transaction_view.sign_with_password.is_element_displayed(20):
|
2019-10-21 12:48:45 +00:00
|
|
|
self.driver.fail('Second send transaction screen did not appear!')
|
2019-02-18 08:12:55 +00:00
|
|
|
|
|
|
|
send_transaction_view.sign_transaction()
|
|
|
|
|
2018-11-07 15:50:08 +00:00
|
|
|
@marks.testrail_id(5677)
|
|
|
|
@marks.high
|
|
|
|
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
|
|
|
|