test_recover + test_sign_in

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2021-01-28 13:55:23 +01:00
parent 56c4ffc39f
commit ad006b018c
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
6 changed files with 158 additions and 208 deletions

View File

@ -1,21 +1,46 @@
import random
from support.utilities import fill_string_with_char
from tests import marks, common_password
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
from tests.users import basic_user
from tests.users import basic_user, transaction_senders, recovery_users
class TestCreateAccount(SingleDeviceTestCase):
@marks.testrail_id(5356)
@marks.critical
def test_switch_users_and_add_new_account(self):
def test_switch_users_special_char_password_and_add_new_account_logcat(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
public_key = home.get_public_key_and_username()
sign_in.just_fyi("Creating multiaccount with special char password")
password=basic_user['special_chars_password']
home = sign_in.create_user(password=password)
public_key, default_username = home.get_public_key_and_username(return_username=True)
profile = home.get_profile_view()
profile.logout()
sign_in.just_fyi('Check that cannot login with incorrect password, and can login with valid data')
if sign_in.ok_button.is_element_displayed():
sign_in.ok_button.click()
sign_in.multi_account_on_login_button.click()
sign_in.password_input.set_value(common_password)
sign_in.sign_in_button.click()
sign_in.element_by_translation_id("wrong-password").wait_for_visibility_of_element(20)
if not sign_in.element_by_text(default_username).is_element_displayed():
self.driver.fail('Username is not shown while login')
sign_in.password_input.set_value(password)
sign_in.sign_in_button.click()
if not sign_in.home_button.is_element_displayed(10):
self.driver.fail('User is not logged in')
values_in_logcat = sign_in.find_values_in_logcat(password=password)
if values_in_logcat:
self.driver.fail(values_in_logcat)
sign_in.profile_button.click()
profile.logout()
sign_in.just_fyi('Create another multiaccount')
if sign_in.ok_button.is_element_displayed():
sign_in.ok_button.click()
sign_in.your_keys_more_icon.click()
@ -29,10 +54,40 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.next_button.click()
sign_in.maybe_later_button.click_until_presence_of_element(sign_in.lets_go_button)
sign_in.lets_go_button.click()
if sign_in.get_public_key_and_username() == public_key:
self.driver.fail('New account was not created')
@marks.testrail_id(5394)
@marks.high
def test_account_recovery_with_uppercase_whitespaces_seed_phrase_special_char_passw_logcat(self):
user = transaction_senders['A']
passphrase = user['passphrase']
password = basic_user['special_chars_password']
passphrase = fill_string_with_char(passphrase.upper(), ' ', 3, True, True)
sign_in = SignInView(self.driver)
sign_in.just_fyi("Restore multiaccount from uppercase seed phrase with whitespaces and set password with special chars")
sign_in.recover_access(passphrase, password=password)
profile = sign_in.profile_button.click()
username = profile.default_username_text.text
public_key = sign_in.get_public_key_and_username()
sign_in.just_fyi("Check public key matches expected and no back up seed phrase is available")
profile.privacy_and_security_button.click()
profile.backup_recovery_phrase_button.click()
if not profile.backup_recovery_phrase_button.is_element_displayed():
self.errors.append('Back up seed phrase option is active for recovered account!')
if username != user['username'] or public_key != user['public_key']:
self.driver.fail('Incorrect user was recovered')
values_in_logcat = sign_in.find_values_in_logcat(passphrase=passphrase, password=password)
if values_in_logcat:
self.driver.fail(values_in_logcat)
profile.profile_button.double_click()
sign_in.just_fyi("Check relogin with special char password")
sign_in.relogin(password=basic_user['special_chars_password'])
self.errors.verify_no_errors()
@marks.testrail_id(5379)
@marks.high
def test_home_view(self):
@ -75,6 +130,85 @@ class TestCreateAccount(SingleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(5363)
@marks.high
def test_pass_phrase_validation(self):
signin_view = SignInView(self.driver)
signin_view.get_started_button.click_until_presence_of_element(signin_view.access_key_button)
signin_view.access_key_button.click()
validations = [
{
'case': 'empty value',
'phrase': ' ',
'validation message': 'Required field',
'words count': 1,
'popup': False
},
{
'case': '1 word seed',
'phrase': 'a',
'validation message': '',
'words count': 1,
'popup' : False
},
{
'case': 'mnemonic but checksum validation fails',
'phrase': 'one two three four five six seven eight nine ten eleven twelve',
'validation message': '',
'words count': 12,
'popup': True
},
]
signin_view.just_fyi("check that seed phrase is required (can't be empty)")
signin_view.enter_seed_phrase_button.click()
signin_view.next_button.click()
if signin_view.reencrypt_your_key_button.is_element_displayed():
self.errors.append("Possible to create account with empty seed phrase")
signin_view = SignInView(self.driver, skip_popups=False)
for validation in validations:
signin_view.just_fyi("Checking %s" % validation.get('case'))
phrase, msg, words_count, popup = validation.get('phrase'), \
validation.get('validation message'), \
validation.get('words count'),\
validation.get('popup')
if signin_view.access_key_button.is_element_displayed():
signin_view.access_key_button.click()
if signin_view.enter_seed_phrase_button.is_element_displayed():
signin_view.enter_seed_phrase_button.click()
signin_view.seedphrase_input.set_value(phrase)
if msg:
if not signin_view.element_by_text(msg).is_element_displayed():
self.errors.append('"{}" message is not shown'.format(msg))
signin_view.just_fyi('check that words count is shown')
if words_count:
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)
signin_view.just_fyi('check that "Next" is disabled unless we use allowed count of words')
if words_count != 12 or 15 or 18 or 21 or 24:
signin_view.next_button.click()
if signin_view.reencrypt_your_key_button.is_element_displayed():
self.errors.append("Possible to create account with wrong count (%s) of words" % words_count)
signin_view.just_fyi('check behavior for popup "Custom seed phrase"')
if popup:
text = 'Invalid seed phrase'
if not signin_view.find_full_text(text):
self.errors.append('"%s" text is not shown' % text)
signin_view.cancel_custom_seed_phrase_button.click()
signin_view.click_system_back_button()
self.errors.verify_no_errors()
@marks.testrail_id(5460)
@marks.medium
def test_create_account_short_and_mismatch_password(self):
@ -112,9 +246,20 @@ class TestCreateAccount(SingleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(5718)
@marks.testrail_id(5455)
@marks.medium
def test_special_characters_in_password_when_creating_new_account(self):
def test_recover_accounts_with_certain_seedphrase(self):
sign_in = SignInView(self.driver)
sign_in.create_user(password=basic_user['special_chars_password'])
sign_in.relogin(password=basic_user['special_chars_password'])
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()
self.errors.verify_no_errors()

View File

@ -211,7 +211,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
dapp_view.just_fyi('check if your name can be added via "ENS usernames" in Profile')
dapp_view.element_by_text('Get started').click()
dapp_view.ens_name_input.set_value(ens_user['ens'])
dapp_view.check_ens_name.click()
dapp_view.check_ens_name.click_until_absense_of_element(dapp_view.check_ens_name)
if not dapp_view.element_by_translation_id('ens-saved-title').is_element_displayed():
self.errors.append('No message "Username added" after resolving own username')
dapp_view.element_by_translation_id("ens-got-it").click()

View File

@ -1,156 +0,0 @@
import pytest
from support.utilities import fill_string_with_char
from tests import marks, unique_password
from tests.base_test_case import SingleDeviceTestCase
from tests.users import basic_user, transaction_senders, recovery_users, ens_user
from views.sign_in_view import SignInView
class TestRecoverAccountSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5394)
@marks.high
def test_account_recovery_with_uppercase_recovery_phrase_logcat(self):
user = transaction_senders['A']
passphrase = user['passphrase']
password = unique_password
capitalized_passphrase = passphrase.upper()
signin_view = SignInView(self.driver)
signin_view.recover_access(capitalized_passphrase, password=password)
profile_view = signin_view.profile_button.click()
username = profile_view.default_username_text.text
public_key = signin_view.get_public_key_and_username()
if username != user['username'] or public_key != user['public_key']:
self.driver.fail('Incorrect user was recovered')
values_in_logcat = signin_view.find_values_in_logcat(passphrase=capitalized_passphrase, password=password)
if values_in_logcat:
self.driver.fail(values_in_logcat)
@marks.testrail_id(6231)
@marks.medium
def test_no_backup_seedphrase_option_for_recovered_account(self):
sign_in = SignInView(self.driver)
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!')
@marks.testrail_id(5363)
@marks.high
def test_pass_phrase_validation(self):
signin_view = SignInView(self.driver)
signin_view.get_started_button.click_until_presence_of_element(signin_view.access_key_button)
signin_view.access_key_button.click()
validations = [
{
'case': 'empty value',
'phrase': ' ',
'validation message': 'Required field',
'words count': 1,
'popup': False
},
{
'case': '1 word seed',
'phrase': 'a',
'validation message': '',
'words count': 1,
'popup' : False
},
{
'case': 'mnemonic but checksum validation fails',
'phrase': 'one two three four five six seven eight nine ten eleven twelve',
'validation message': '',
'words count': 12,
'popup': True
},
]
signin_view.just_fyi("check that seed phrase is required (can't be empty)")
signin_view.enter_seed_phrase_button.click()
signin_view.next_button.click()
if signin_view.reencrypt_your_key_button.is_element_displayed():
self.errors.append("Possible to create account with empty seed phrase")
signin_view = SignInView(self.driver, skip_popups=False)
for validation in validations:
signin_view.just_fyi("Checking %s" % validation.get('case'))
phrase, msg, words_count, popup = validation.get('phrase'), \
validation.get('validation message'), \
validation.get('words count'),\
validation.get('popup')
if signin_view.access_key_button.is_element_displayed():
signin_view.access_key_button.click()
if signin_view.enter_seed_phrase_button.is_element_displayed():
signin_view.enter_seed_phrase_button.click()
signin_view.seedphrase_input.set_value(phrase)
if msg:
if not signin_view.element_by_text(msg).is_element_displayed():
self.errors.append('"{}" message is not shown'.format(msg))
signin_view.just_fyi('check that words count is shown')
if words_count:
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)
signin_view.just_fyi('check that "Next" is disabled unless we use allowed count of words')
if words_count != 12 or 15 or 18 or 21 or 24:
signin_view.next_button.click()
if signin_view.reencrypt_your_key_button.is_element_displayed():
self.errors.append("Possible to create account with wrong count (%s) of words" % words_count)
signin_view.just_fyi('check behavior for popup "Custom seed phrase"')
if popup:
text = 'Invalid seed phrase'
if not signin_view.find_full_text(text):
self.errors.append('"%s" text is not shown' % text)
signin_view.cancel_custom_seed_phrase_button.click()
signin_view.click_system_back_button()
self.errors.verify_no_errors()
@marks.testrail_id(5499)
@marks.medium
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)
if not home_view.profile_button.is_element_displayed():
self.driver.fail('Something went wrong. Probably, could not reach the home screen out.')
@marks.testrail_id(5719)
@marks.medium
def test_special_characters_in_password_when_recover_account(self):
sign_in = SignInView(self.driver)
sign_in.recover_access(passphrase=ens_user['passphrase'], password=basic_user['special_chars_password'])
sign_in.relogin(password=basic_user['special_chars_password'])
@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()
self.errors.verify_no_errors()

View File

@ -1,39 +0,0 @@
import pytest
from tests import marks, common_password, unique_password
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from views.sign_in_view import SignInView
class TestSignIn(SingleDeviceTestCase):
@marks.testrail_id(5312)
@marks.critical
def test_login_with_new_account_logcat(self):
sign_in = SignInView(self.driver)
password = unique_password
sign_in.create_user(password=password)
profile = sign_in.profile_button.click()
default_username = profile.default_username_text.text
profile.logout()
sign_in.just_fyi('Check that cannot login with incorrect password')
if sign_in.ok_button.is_element_displayed():
sign_in.ok_button.click()
sign_in.multi_account_on_login_button.click()
sign_in.password_input.set_value(common_password + '1')
sign_in.sign_in_button.click()
sign_in.find_full_text("Wrong password")
sign_in.just_fyi('Checking username and login')
if not sign_in.element_by_text(default_username).is_element_displayed():
self.driver.fail('Username is not shown while login')
sign_in.password_input.set_value(password)
sign_in.sign_in_button.click()
sign_in.just_fyi('Checking logcat that no password during creating new user and login')
if not sign_in.home_button.is_element_displayed(10):
self.driver.fail('User is not logged in')
values_in_logcat = sign_in.find_values_in_logcat(password=password)
if values_in_logcat:
self.driver.fail(values_in_logcat)

View File

@ -1,11 +1,10 @@
import random
import string
from tests import marks, camera_access_error_text, common_password
from tests import marks, common_password
from tests.base_test_case import SingleDeviceTestCase
from tests.users import wallet_users, transaction_senders, basic_user, ens_user
from views.sign_in_view import SignInView
import time
class TestWalletManagement(SingleDeviceTestCase):

View File

@ -536,7 +536,8 @@ class BaseView(object):
items_in_logcat = list()
for key, value in kwargs.items():
self.driver.info("**Checking in logcat for:** `%s`" % value)
if re.findall(r'\W%s$|\W%s\W' % (value, value), logcat):
escaped_value = re.escape(value)
if re.findall(r'\W%s$|\W%s\W' % (escaped_value, escaped_value), logcat):
items_in_logcat.append('%s in logcat!!!' % key.capitalize())
return items_in_logcat