kk login and restore e2e

This commit is contained in:
Churikova Tetiana 2020-04-28 16:40:41 +02:00 committed by Roman Volosovskyi
parent 7ebd9dc899
commit b265034695
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
3 changed files with 74 additions and 25 deletions

View File

@ -1,6 +1,8 @@
from tests import marks
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
from views.keycard_view import KeycardView
from tests.users import basic_user
@marks.all
@ -9,7 +11,7 @@ class TestCreateAccount(SingleDeviceTestCase):
@marks.testrail_id(5689)
@marks.critical
def test_add_new_keycard_account(self):
def test_add_new_keycard_account_and_login(self):
sign_in = SignInView(self.driver)
sign_in.create_user(keycard=True)
@ -18,25 +20,58 @@ class TestCreateAccount(SingleDeviceTestCase):
wallet_view.set_up_wallet()
if wallet_view.status_account_total_usd_value.text != '0':
self.errors.append("Account USD value is not 0, it is %s" % wallet_view.status_account_total_usd_value.text)
public_key = sign_in.get_public_key_and_username()
public_key, default_username = sign_in.get_public_key_and_username(return_username=True)
profile = sign_in.get_profile_view()
default_username = profile.default_username_text.text
profile.logout()
sign_in.just_fyi('Check that can login with keycard account')
sign_in.multi_account_on_login_button.wait_for_visibility_of_element(5)
sign_in.multi_account_on_login_button.click()
from views.keycard_view import KeycardView
keycard_view = KeycardView(self.driver)
# TODO: disabled due to 10272
# for text in (public_key[-5:],default_username):
if not keycard_view.element_by_text_part(default_username).is_element_displayed():
self.errors.append("%s is not found on keycard login screen!" % default_username)
keycard_view.connect_selected_card_button.click()
keycard_view.enter_default_pin()
keycard_view.connect_card_button.click()
# TODO: disabled as login is not made in e2e builds
# if not sign_in.home_button.is_element_displayed():
# self.driver.fail('Keycard user is not logged in')
if not sign_in.home_button.is_element_displayed(10):
self.driver.fail('Keycard user is not logged in')
self.errors.verify_no_errors()
@marks.testrail_id(6240)
@marks.critical
def test_restore_account_from_mnemonic_to_keycard(self):
sign_in = SignInView(self.driver)
sign_in.recover_access(passphrase=basic_user['passphrase'], keycard=True)
sign_in.just_fyi('Check that after restring account with assets is restored')
wallet_view = sign_in.wallet_button.click()
wallet_view.set_up_wallet()
for asset in ['ETHro', 'ADI', 'STT']:
if wallet_view.get_asset_amount_by_name(asset) == 0:
self.errors.append('Asset %s was not restored')
sign_in.just_fyi('Check that wallet address matches expected')
address = wallet_view.get_wallet_address()
if address != '0x%s' % basic_user['address']:
self.errors.append('Restored address %s does not match expected' % address)
sign_in.just_fyi('Check that username and public key match expected')
public_key, default_username = sign_in.get_public_key_and_username(return_username=True)
profile_view = sign_in.get_profile_view()
if public_key != basic_user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
if default_username != basic_user['username']:
self.errors.append('Default username %s does not match expected' % default_username)
profile_view.logout()
sign_in.just_fyi('Check that can login with restored from mnemonic keycard account')
sign_in.multi_account_on_login_button.wait_for_visibility_of_element(5)
sign_in.multi_account_on_login_button.click()
keycard_view = KeycardView(self.driver)
keycard_view.connect_selected_card_button.click()
keycard_view.enter_default_pin()
if not sign_in.home_button.is_element_displayed(10):
self.driver.fail('Keycard user is not logged in')
self.errors.verify_no_errors()

View File

@ -24,6 +24,11 @@ class ConnectCardButton(BaseButton):
super(ConnectCardButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("connect-card")
class ConnectSelectedCardButton(BaseButton):
def __init__(self, driver):
super(ConnectSelectedCardButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("connect-selected-card")
class DisconnectCardButton(BaseButton):
def __init__(self, driver):
@ -61,6 +66,7 @@ class KeycardView(BaseView):
self.connect_card_button = ConnectCardButton(self.driver)
self.disconnect_card_button = DisconnectCardButton(self.driver)
self.reset_card_state_button = ResetCardButton(self.driver)
self.connect_selected_card_button = ConnectSelectedCardButton(self.driver)
#keyboard
self.one_button = OnePinKeyboardButton(self.driver)
@ -95,3 +101,14 @@ class KeycardView(BaseView):
number = self.get_required_word_number()
self.confirm_seed_phrase_edit_box.set_value(recovery_phrase[number])
self.next_button.click()
def confirm_pin_and_proceed(self):
self.next_button.click()
self.begin_setup_button.click()
self.connect_card_button.click()
self.enter_default_pin()
self.enter_default_pin()
self.next_button.scroll_to_element()
self.next_button.wait_for_visibility_of_element(20)
self.next_button.click()
self.yes_button.click()

View File

@ -222,15 +222,7 @@ class SignInView(BaseView):
self.next_button.click()
if keycard:
keycard_flow = self.keycard_storage_button.click()
self.next_button.click()
keycard_flow.begin_setup_button.click()
keycard_flow.connect_card_button.click()
keycard_flow.enter_default_pin()
keycard_flow.enter_default_pin()
self.next_button.scroll_to_element()
self.next_button.wait_for_visibility_of_element(20)
self.next_button.click()
self.yes_button.click()
keycard_flow.confirm_pin_and_proceed()
keycard_flow.backup_seed_phrase()
else:
self.next_button.click()
@ -243,18 +235,23 @@ class SignInView(BaseView):
self.profile_button.wait_for_visibility_of_element(30)
return self.get_home_view()
def recover_access(self, passphrase: str, password: str = common_password):
def recover_access(self, passphrase: str, password: str = common_password, keycard=False):
recover_access_view = self.access_key_button.click()
recover_access_view.enter_seed_phrase_button.click()
recover_access_view.seedphrase_input.click()
recover_access_view.seedphrase_input.set_value(passphrase)
recover_access_view.next_button.click()
recover_access_view.reencrypt_your_key_button.click()
recover_access_view.next_button.click()
recover_access_view.create_password_input.set_value(password)
recover_access_view.next_button.click()
recover_access_view.confirm_your_password_input.set_value(password)
recover_access_view.next_button.click_until_presence_of_element(self.lets_go_button)
if keycard:
keycard_flow = self.keycard_storage_button.click()
keycard_flow.confirm_pin_and_proceed()
self.lets_go_button.wait_for_visibility_of_element(30)
else:
recover_access_view.next_button.click()
recover_access_view.create_password_input.set_value(password)
recover_access_view.next_button.click()
recover_access_view.confirm_your_password_input.set_value(password)
recover_access_view.next_button.click_until_presence_of_element(self.lets_go_button)
self.lets_go_button.click()
self.profile_button.wait_for_visibility_of_element(30)
return self.get_home_view()