2018-06-29 17:27:30 +00:00
|
|
|
import pytest
|
|
|
|
|
2018-10-04 09:51:03 +00:00
|
|
|
from support.utilities import fill_string_with_char
|
2018-09-17 08:50:01 +00:00
|
|
|
from tests import marks, unique_password
|
2018-07-03 12:40:44 +00:00
|
|
|
from tests.base_test_case import SingleDeviceTestCase
|
2020-01-21 13:59:01 +00:00
|
|
|
from tests.users import basic_user, transaction_senders, recovery_users, ens_user
|
2018-06-29 17:27:30 +00:00
|
|
|
from views.sign_in_view import SignInView
|
2019-09-18 07:20:29 +00:00
|
|
|
from views.recover_access_view import RecoverAccessView
|
2018-06-29 17:27:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
@marks.all
|
|
|
|
@marks.account
|
2018-07-03 12:40:44 +00:00
|
|
|
class TestRecoverAccountSingleDevice(SingleDeviceTestCase):
|
2018-06-29 17:27:30 +00:00
|
|
|
|
2019-10-10 07:29:04 +00:00
|
|
|
@marks.testrail_id(6231)
|
|
|
|
@marks.medium
|
|
|
|
def test_no_backup_seedphrase_option_for_recovered_account(self):
|
2018-07-03 12:40:44 +00:00
|
|
|
sign_in = SignInView(self.driver)
|
2019-10-10 07:29:04 +00:00
|
|
|
sign_in.recover_access(passphrase=basic_user['passphrase'], password=unique_password)
|
|
|
|
profile_view = sign_in.profile_button.click()
|
|
|
|
profile_view.privacy_and_security_button.click()
|
|
|
|
profile_view.backup_recovery_phrase_button.click()
|
|
|
|
if profile_view.profile_button.counter.is_element_displayed():
|
|
|
|
self.errors.append('Profile button counter is shown on recovered account')
|
|
|
|
profile_view.backup_recovery_phrase_button.click()
|
|
|
|
if not profile_view.backup_recovery_phrase_button.is_element_displayed():
|
|
|
|
self.errors.append('Back up seed phrase option is active for recovered account!')
|
2019-10-29 08:25:57 +00:00
|
|
|
self.errors.verify_no_errors()
|
2018-06-29 17:27:30 +00:00
|
|
|
|
2018-07-11 14:14:39 +00:00
|
|
|
@marks.logcat
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5366)
|
|
|
|
@marks.critical
|
2018-07-09 19:47:50 +00:00
|
|
|
def test_logcat_recovering_account(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2018-09-17 08:50:01 +00:00
|
|
|
sign_in.recover_access(passphrase=basic_user['passphrase'], password=unique_password)
|
2019-09-24 14:22:20 +00:00
|
|
|
values_in_logcat = sign_in.find_values_in_logcat(passphrase=basic_user['passphrase'], password=unique_password)
|
|
|
|
if values_in_logcat:
|
|
|
|
self.driver.fail(values_in_logcat)
|
2018-10-04 09:51:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestRecoverAccessFromSignInScreen(SingleDeviceTestCase):
|
2020-01-03 15:24:05 +00:00
|
|
|
|
2018-10-04 09:51:03 +00:00
|
|
|
@marks.testrail_id(5363)
|
2019-03-05 16:43:30 +00:00
|
|
|
@marks.high
|
2018-10-04 09:51:03 +00:00
|
|
|
def test_pass_phrase_validation(self):
|
|
|
|
signin_view = SignInView(self.driver)
|
2020-07-02 09:23:50 +00:00
|
|
|
signin_view.get_started_button.click_until_presence_of_element(signin_view.access_key_button)
|
2019-09-18 07:20:29 +00:00
|
|
|
signin_view.access_key_button.click()
|
|
|
|
recover_access_view = RecoverAccessView(self.driver)
|
2018-10-04 09:51:03 +00:00
|
|
|
validations = [
|
2019-09-18 07:20:29 +00:00
|
|
|
# empty value
|
2018-10-04 09:51:03 +00:00
|
|
|
{
|
|
|
|
'phrase': ' ',
|
2019-09-18 07:20:29 +00:00
|
|
|
'element to check': recover_access_view.warnings.invalid_recovery_phrase,
|
2018-10-04 09:51:03 +00:00
|
|
|
'validation message': 'Required field',
|
2019-09-18 07:20:29 +00:00
|
|
|
'words count': 1,
|
|
|
|
'popup': False
|
2018-10-04 09:51:03 +00:00
|
|
|
},
|
2019-09-18 07:20:29 +00:00
|
|
|
# invalid seed phrase
|
2018-10-04 09:51:03 +00:00
|
|
|
{
|
|
|
|
'phrase': 'a',
|
|
|
|
'element to check': recover_access_view.warnings.invalid_recovery_phrase,
|
2019-09-18 07:20:29 +00:00
|
|
|
'validation message': 'Seed phrase is invalid',
|
|
|
|
'words count': 1,
|
|
|
|
'popup' : False
|
2018-10-04 09:51:03 +00:00
|
|
|
},
|
2020-01-03 15:27:50 +00:00
|
|
|
# mnemonic but checksum validation fails
|
2018-10-04 09:51:03 +00:00
|
|
|
{
|
2020-01-03 15:27:50 +00:00
|
|
|
'phrase': 'one two three four five six seven eight nine ten eleven twelve',
|
2018-10-04 09:51:03 +00:00
|
|
|
'element to check': recover_access_view.warnings.invalid_recovery_phrase,
|
2019-09-18 07:20:29 +00:00
|
|
|
'validation message': '',
|
|
|
|
'words count': 12,
|
|
|
|
'popup': True
|
2018-10-04 09:51:03 +00:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2020-04-10 10:25:46 +00:00
|
|
|
recover_access_view.just_fyi("check that seed phrase is required (can't be empty)")
|
2019-09-18 07:20:29 +00:00
|
|
|
recover_access_view.enter_seed_phrase_button.click()
|
|
|
|
recover_access_view.next_button.click()
|
|
|
|
if recover_access_view.reencrypt_your_key_button.is_element_displayed():
|
|
|
|
self.errors.append("Possible to create account with empty seed phrase")
|
|
|
|
|
2020-05-19 10:40:39 +00:00
|
|
|
signin_view = SignInView(self.driver, skip_popups=False)
|
2018-10-04 09:51:03 +00:00
|
|
|
# we're performing the same steps changing only phrase per attempt
|
|
|
|
for validation in validations:
|
2019-09-18 07:20:29 +00:00
|
|
|
phrase, elm, msg, words_count, popup = validation.get('phrase'), \
|
|
|
|
validation.get('element to check'), \
|
|
|
|
validation.get('validation message'), \
|
|
|
|
validation.get('words count'),\
|
|
|
|
validation.get('popup')
|
2019-07-15 15:53:56 +00:00
|
|
|
if signin_view.access_key_button.is_element_displayed():
|
|
|
|
signin_view.access_key_button.click()
|
2019-08-18 23:31:42 +00:00
|
|
|
if recover_access_view.enter_seed_phrase_button.is_element_displayed():
|
|
|
|
recover_access_view.enter_seed_phrase_button.click()
|
2019-07-03 14:29:01 +00:00
|
|
|
|
2018-10-04 09:51:03 +00:00
|
|
|
recover_access_view.send_as_keyevent(phrase)
|
|
|
|
|
2020-04-10 10:25:46 +00:00
|
|
|
# TODO: still disabled because tooltips are not visible
|
|
|
|
# if msg and not elm.is_element_displayed():
|
2019-09-18 07:20:29 +00:00
|
|
|
# self.errors.append('"{}" message is not shown'.format(msg))
|
|
|
|
|
2020-04-10 10:25:46 +00:00
|
|
|
recover_access_view.just_fyi('check that words count is shown')
|
2019-09-18 07:20:29 +00:00
|
|
|
if words_count == 1:
|
|
|
|
if not signin_view.element_by_text('%s word' % words_count):
|
|
|
|
self.errors.append('"%s word" is not shown ' % words_count)
|
|
|
|
else:
|
|
|
|
if not signin_view.element_by_text('%s words' % words_count):
|
|
|
|
self.errors.append('"%s words" is not shown ' % words_count)
|
|
|
|
|
2020-04-10 10:25:46 +00:00
|
|
|
recover_access_view.just_fyi('check that "Next" is disabled unless we use allowed count of words')
|
2019-09-18 07:20:29 +00:00
|
|
|
if words_count != 12 or 15 or 18 or 21 or 24:
|
|
|
|
recover_access_view.next_button.click()
|
|
|
|
if recover_access_view.reencrypt_your_key_button.is_element_displayed():
|
|
|
|
self.errors.append("Possible to create account with wrong count (%s) of words" % words_count)
|
|
|
|
|
2020-04-10 10:25:46 +00:00
|
|
|
recover_access_view.just_fyi('check behavior for popup "Custom seed phrase"')
|
2019-09-18 07:20:29 +00:00
|
|
|
if popup:
|
2020-01-08 15:12:12 +00:00
|
|
|
text = 'Invalid seed phrase'
|
2019-09-18 07:20:29 +00:00
|
|
|
if not recover_access_view.find_full_text(text):
|
|
|
|
self.errors.append('"%s" text is not shown' % text)
|
|
|
|
recover_access_view.cancel_custom_seed_phrase_button.click()
|
2020-01-03 15:27:50 +00:00
|
|
|
|
|
|
|
recover_access_view.click_system_back_button()
|
2018-10-04 09:51:03 +00:00
|
|
|
|
2019-10-29 08:25:57 +00:00
|
|
|
self.errors.verify_no_errors()
|
2018-10-04 09:51:03 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5499)
|
2019-03-05 16:43:30 +00:00
|
|
|
@marks.medium
|
2018-10-04 09:51:03 +00:00
|
|
|
def test_passphrase_whitespaces_ignored_while_recovering_access(self):
|
|
|
|
signin_view = SignInView(self.driver)
|
|
|
|
sender = transaction_senders['U']
|
|
|
|
passphrase = fill_string_with_char(sender['passphrase'], ' ', 3, True, True)
|
|
|
|
home_view = signin_view.recover_access(passphrase=passphrase)
|
|
|
|
|
2018-10-07 15:12:21 +00:00
|
|
|
if not home_view.profile_button.is_element_displayed():
|
|
|
|
self.driver.fail('Something went wrong. Probably, could not reach the home screen out.')
|
2018-11-16 15:55:12 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5394)
|
|
|
|
@marks.high
|
2019-08-23 10:24:52 +00:00
|
|
|
def test_account_recovery_with_uppercase_recovery_phrase(self):
|
|
|
|
user = transaction_senders['A']
|
|
|
|
passphrase = user['passphrase']
|
2018-11-16 15:55:12 +00:00
|
|
|
capitalized_passphrase = passphrase.upper()
|
|
|
|
signin_view = SignInView(self.driver)
|
2019-08-23 10:24:52 +00:00
|
|
|
signin_view.recover_access(capitalized_passphrase)
|
|
|
|
profile_view = signin_view.profile_button.click()
|
|
|
|
username = profile_view.default_username_text.text
|
2020-04-10 10:25:46 +00:00
|
|
|
public_key = signin_view.get_public_key_and_username()
|
2019-08-23 10:24:52 +00:00
|
|
|
if username != user['username'] or public_key != user['public_key']:
|
|
|
|
self.driver.fail('Incorrect user was recovered')
|
2019-02-26 18:05:22 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5719)
|
|
|
|
@marks.medium
|
|
|
|
def test_special_characters_in_password_when_recover_account(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2020-01-21 13:59:01 +00:00
|
|
|
sign_in.recover_access(passphrase=ens_user['passphrase'], password=basic_user['special_chars_password'])
|
2019-02-26 18:05:22 +00:00
|
|
|
sign_in.relogin(password=basic_user['special_chars_password'])
|
2019-08-05 17:03:00 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5455)
|
|
|
|
@marks.medium
|
|
|
|
def test_recover_accounts_with_certain_seedphrase(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
for phrase, account in recovery_users.items():
|
|
|
|
home_view = sign_in.recover_access(passphrase=phrase, password=unique_password)
|
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
wallet_view.set_up_wallet()
|
|
|
|
address = wallet_view.get_wallet_address()
|
|
|
|
if address != account:
|
|
|
|
self.errors.append('Restored wallet address "%s" does not match expected "%s"' % (address, account))
|
|
|
|
profile_view = home_view.profile_button.click()
|
|
|
|
profile_view.logout()
|
2019-10-29 08:25:57 +00:00
|
|
|
self.errors.verify_no_errors()
|