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
|
2020-09-04 15:34:58 +00:00
|
|
|
from tests.users import transaction_senders
|
2018-06-30 12:17:38 +00:00
|
|
|
from views.sign_in_view import SignInView
|
|
|
|
|
|
|
|
|
|
|
|
class TestTransactionDApp(SingleDeviceTestCase):
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5309)
|
|
|
|
@marks.critical
|
2021-08-20 09:47:30 +00:00
|
|
|
@marks.transaction
|
2021-11-18 15:16:48 +00:00
|
|
|
def test_request_stt_from_dapp(self):
|
2018-09-17 08:50:01 +00:00
|
|
|
sender = transaction_senders['K']
|
2021-05-13 16:03:01 +00:00
|
|
|
home = SignInView(self.driver).recover_access(sender['passphrase'], unique_password)
|
2021-06-29 15:55:55 +00:00
|
|
|
wallet = home.wallet_button.click()
|
2021-06-30 13:45:15 +00:00
|
|
|
wallet.scan_tokens()
|
2021-11-18 15:16:48 +00:00
|
|
|
initial_amount_stt = wallet.get_asset_amount_by_name('STT')
|
2021-05-13 16:03:01 +00:00
|
|
|
status_test_dapp = home.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()
|
2022-01-17 19:23:38 +00:00
|
|
|
status_test_dapp.request_stt_button.wait_for_element(60)
|
2021-05-13 16:03:01 +00:00
|
|
|
send_transaction = status_test_dapp.request_stt_button.click()
|
2021-09-08 14:44:20 +00:00
|
|
|
if not send_transaction.onboarding_message.is_element_displayed(30):
|
2021-05-13 16:03:01 +00:00
|
|
|
self.driver.fail('It seems onboarding screen is not shown.')
|
|
|
|
home.ok_got_it_button.click()
|
|
|
|
home.cancel_button.click()
|
|
|
|
send_transaction = status_test_dapp.request_stt_button.click()
|
|
|
|
send_transaction.sign_transaction(unique_password)
|
2020-05-14 10:41:09 +00:00
|
|
|
status_test_dapp.wallet_button.click()
|
|
|
|
|
2021-05-13 16:03:01 +00:00
|
|
|
send_transaction.just_fyi('Verify that wallet balance is updated')
|
2021-11-18 15:16:48 +00:00
|
|
|
wallet.wait_balance_is_changed('STT', initial_amount_stt, scan_tokens=True)
|
2020-05-14 10:41:09 +00:00
|
|
|
|
2021-05-13 16:03:01 +00:00
|
|
|
send_transaction.just_fyi('Check logcat for sensitive data')
|
|
|
|
values_in_logcat = send_transaction.find_values_in_logcat(password=unique_password)
|
2020-05-14 10:41:09 +00:00
|
|
|
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
|
2021-08-20 09:47:30 +00:00
|
|
|
@marks.transaction
|
2021-06-18 11:09:03 +00:00
|
|
|
def test_sign_message_and_2tx_in_batch_and_transactions_filters_from_daap(self):
|
2018-06-30 12:17:38 +00:00
|
|
|
password = 'password_for_daap'
|
2021-05-13 16:03:01 +00:00
|
|
|
home = SignInView(self.driver).recover_access(passphrase=transaction_senders['W']['passphrase'],
|
2021-11-18 15:16:48 +00:00
|
|
|
password=password)
|
2021-05-13 16:03:01 +00:00
|
|
|
wallet = home.wallet_button.click()
|
2021-08-19 11:41:41 +00:00
|
|
|
|
2021-05-13 16:03:01 +00:00
|
|
|
status_test_dapp = home.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()
|
2021-05-13 16:03:01 +00:00
|
|
|
|
|
|
|
wallet.just_fyi("Checking signing message")
|
|
|
|
send_transaction = status_test_dapp.sign_message_button.click()
|
2021-06-18 11:09:03 +00:00
|
|
|
status_test_dapp.set_up_wallet_when_sending_tx()
|
2021-05-13 16:03:01 +00:00
|
|
|
if not send_transaction.element_by_text("Test message").is_element_displayed():
|
|
|
|
self.errors.append("No message shown when signing!")
|
|
|
|
send_transaction.enter_password_input.send_keys(password)
|
|
|
|
send_transaction.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():
|
2021-05-13 16:03:01 +00:00
|
|
|
self.errors.append('Message was not signed')
|
|
|
|
send_transaction.just_fyi('Check logcat for sensitive data')
|
|
|
|
values_in_logcat = send_transaction.find_values_in_logcat(password=password)
|
2020-05-14 10:41:09 +00:00
|
|
|
if values_in_logcat:
|
2021-05-13 16:03:01 +00:00
|
|
|
self.errors.append("When signing message from dapp: %s" % values_in_logcat)
|
2019-02-18 08:12:55 +00:00
|
|
|
|
2021-05-13 16:03:01 +00:00
|
|
|
wallet.just_fyi("Checking send 2 txs in batch")
|
|
|
|
status_test_dapp.send_two_tx_in_batch_button.scroll_to_element()
|
|
|
|
send_transaction = status_test_dapp.send_two_tx_in_batch_button.click()
|
|
|
|
send_transaction.sign_transaction(password)
|
|
|
|
if not send_transaction.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!')
|
2021-05-13 16:03:01 +00:00
|
|
|
send_transaction.sign_transaction(password)
|
2019-02-18 08:12:55 +00:00
|
|
|
|
2021-05-13 16:03:01 +00:00
|
|
|
wallet.just_fyi("Checking send 2 txs one after another")
|
|
|
|
status_test_dapp.send_two_tx_one_by_one_button.scroll_to_element()
|
|
|
|
send_transaction = status_test_dapp.send_two_tx_one_by_one_button.click()
|
|
|
|
send_transaction.sign_transaction(password)
|
|
|
|
if not send_transaction.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!')
|
2021-05-13 16:03:01 +00:00
|
|
|
send_transaction.sign_transaction(password)
|
2019-02-18 08:12:55 +00:00
|
|
|
|
2021-05-13 16:03:01 +00:00
|
|
|
wallet.just_fyi("Checking test filters")
|
|
|
|
status_test_dapp.test_filters_button.scroll_and_click()
|
|
|
|
for element in status_test_dapp.element_by_text('eth_uninstallFilter'), status_test_dapp.ok_button:
|
|
|
|
if element.is_element_displayed(10):
|
|
|
|
self.driver.fail("'Test filters' button produced an error")
|
|
|
|
self.errors.verify_no_errors()
|
2019-02-18 08:12:55 +00:00
|
|
|
|
2021-05-13 16:03:01 +00:00
|
|
|
@marks.testrail_id(5784)
|
|
|
|
@marks.medium
|
2021-08-20 09:47:30 +00:00
|
|
|
@marks.transaction
|
|
|
|
def test_sign_typed_message_deploy_simple_contract_request_pub_key_from_dapp(self):
|
2021-05-13 16:03:01 +00:00
|
|
|
user = transaction_senders['W']
|
|
|
|
home = SignInView(self.driver).recover_access(passphrase=user['passphrase'])
|
|
|
|
|
|
|
|
home.just_fyi("Checking requesting public key from dapp")
|
|
|
|
status_test_dapp = home.open_status_test_dapp(allow_all=False)
|
|
|
|
status_test_dapp.status_api_button.click_until_presence_of_element(status_test_dapp.request_contact_code_button)
|
|
|
|
status_test_dapp.request_contact_code_button.click_until_presence_of_element(status_test_dapp.deny_button)
|
|
|
|
status_test_dapp.deny_button.click()
|
|
|
|
if status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
|
|
|
|
self.errors.append('Public key is returned but access was not allowed')
|
|
|
|
status_test_dapp.request_contact_code_button.click_until_presence_of_element(status_test_dapp.deny_button)
|
|
|
|
status_test_dapp.allow_button.click()
|
|
|
|
if not status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
|
|
|
|
self.errors.append('Public key is not returned')
|
2021-06-23 15:12:42 +00:00
|
|
|
status_test_dapp.get_empty_dapp_tab()
|
2021-11-18 15:16:48 +00:00
|
|
|
home.wallet_button.click()
|
2021-05-13 16:03:01 +00:00
|
|
|
|
|
|
|
home.just_fyi("Checking sign typed message")
|
|
|
|
home.open_status_test_dapp(allow_all=True)
|
|
|
|
status_test_dapp.transactions_button.click_until_presence_of_element(status_test_dapp.sign_typed_message_button)
|
|
|
|
send_transaction = status_test_dapp.sign_typed_message_button.click()
|
|
|
|
send_transaction.enter_password_input.send_keys(common_password)
|
|
|
|
send_transaction.sign_button.click_until_absense_of_element(send_transaction.sign_button)
|
|
|
|
if not status_test_dapp.element_by_text_part('0xde3048417e5881acc9ca8466ab0b3e2f9f96').is_element_displayed(30):
|
|
|
|
self.errors.append("Hash of signed typed message is not shown!")
|
|
|
|
|
|
|
|
home.just_fyi("Checking deploy simple contract")
|
|
|
|
send_transaction = status_test_dapp.deploy_contract_button.click()
|
2021-09-17 16:20:12 +00:00
|
|
|
send_transaction.sign_transaction()
|
2021-05-13 16:03:01 +00:00
|
|
|
if not status_test_dapp.element_by_text('Contract deployed at: ').is_element_displayed(180):
|
|
|
|
self.errors.append('Contract was not created')
|
|
|
|
for text in ['Call contract get function',
|
2021-11-18 15:16:48 +00:00
|
|
|
'Call contract set function', 'Call function 2 times in a row']:
|
2021-05-13 16:03:01 +00:00
|
|
|
status_test_dapp.element_by_text(text).scroll_to_element()
|
|
|
|
self.errors.verify_no_errors()
|