2023-10-06 11:32:08 +00:00
|
|
|
import allure
|
|
|
|
import pytest
|
|
|
|
from allure_commons._allure import step
|
2024-05-27 07:27:24 +00:00
|
|
|
|
|
|
|
from constants.onboarding import KeysExistText
|
|
|
|
from driver.aut import AUT
|
2023-12-07 16:47:34 +00:00
|
|
|
from . import marks
|
2023-10-06 11:32:08 +00:00
|
|
|
|
|
|
|
import configs.system
|
|
|
|
import constants
|
|
|
|
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
|
|
|
|
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
|
|
|
|
from gui.components.splash_screen import SplashScreen
|
2023-11-17 05:53:17 +00:00
|
|
|
from gui.main_window import LeftPanel
|
2024-04-24 13:29:14 +00:00
|
|
|
from gui.screens.onboarding import BiometricsView, WelcomeToStatusView, KeysView, \
|
2024-05-27 07:27:24 +00:00
|
|
|
YourEmojihashAndIdenticonRingView, LoginView
|
2023-10-06 11:32:08 +00:00
|
|
|
|
2023-12-07 16:47:34 +00:00
|
|
|
pytestmark = marks
|
2023-10-06 11:32:08 +00:00
|
|
|
|
2024-02-15 10:37:40 +00:00
|
|
|
|
2023-10-06 11:32:08 +00:00
|
|
|
@pytest.fixture
|
|
|
|
def keys_screen(main_window) -> KeysView:
|
|
|
|
with step('Open Generate new keys view'):
|
|
|
|
BeforeStartedPopUp().get_started()
|
2024-04-24 13:29:14 +00:00
|
|
|
welcome_screen = WelcomeToStatusView().wait_until_appears()
|
|
|
|
return welcome_screen.get_keys()
|
2023-10-06 11:32:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703040', 'Import: 12 word seed phrase')
|
2024-05-28 05:39:33 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/736372', 'Re-importing seed-phrase')
|
|
|
|
@pytest.mark.case(703040, 736372)
|
2023-10-11 11:28:34 +00:00
|
|
|
@pytest.mark.parametrize('user_account', [constants.user.user_account_one])
|
2024-02-29 12:55:33 +00:00
|
|
|
@pytest.mark.parametrize('autocomplete, default_name', [
|
|
|
|
pytest.param(False, 'Account 1'),
|
2024-03-20 07:51:29 +00:00
|
|
|
pytest.param(True, 'Account 1', marks=pytest.mark.critical)
|
2023-10-11 11:28:34 +00:00
|
|
|
])
|
2024-05-27 07:27:24 +00:00
|
|
|
def test_import_seed_phrase(keys_screen, main_window, aut: AUT, user_account, default_name: str, autocomplete: bool):
|
2023-10-06 11:32:08 +00:00
|
|
|
with step('Open import seed phrase view and enter seed phrase'):
|
|
|
|
input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view()
|
2023-10-17 14:57:39 +00:00
|
|
|
input_view.input_seed_phrase(user_account.seed_phrase, autocomplete)
|
|
|
|
profile_view = input_view.import_seed_phrase()
|
2023-10-06 11:32:08 +00:00
|
|
|
profile_view.set_display_name(user_account.name)
|
|
|
|
|
|
|
|
with step('Finalize onboarding and open main screen'):
|
2024-04-24 13:29:14 +00:00
|
|
|
create_password_view = profile_view.next()
|
2023-10-06 11:32:08 +00:00
|
|
|
confirm_password_view = create_password_view.create_password(user_account.password)
|
|
|
|
confirm_password_view.confirm_password(user_account.password)
|
2024-06-18 06:53:37 +00:00
|
|
|
if configs.system.get_platform() == "Darwin":
|
2023-10-06 11:32:08 +00:00
|
|
|
BiometricsView().wait_until_appears().prefer_password()
|
|
|
|
SplashScreen().wait_until_appears().wait_until_hidden()
|
2024-04-24 13:29:14 +00:00
|
|
|
next_view = YourEmojihashAndIdenticonRingView().verify_emojihash_view_present().next()
|
2024-06-18 06:53:37 +00:00
|
|
|
if configs.system.get_platform() == "Darwin":
|
2024-04-24 13:29:14 +00:00
|
|
|
next_view.start_using_status()
|
|
|
|
SplashScreen().wait_until_appears().wait_until_hidden()
|
2024-08-08 15:25:10 +00:00
|
|
|
if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
|
2023-10-06 11:32:08 +00:00
|
|
|
BetaConsentPopup().confirm()
|
|
|
|
|
2023-10-23 15:43:17 +00:00
|
|
|
with (step('Verify that restored account reveals correct status wallet address')):
|
2024-03-04 10:45:06 +00:00
|
|
|
status_account_index = 0
|
2023-10-23 15:43:17 +00:00
|
|
|
status_acc_view = (
|
2024-03-04 10:45:06 +00:00
|
|
|
LeftPanel().open_settings().left_panel.open_wallet_settings().open_account_in_settings(default_name,
|
|
|
|
status_account_index))
|
2023-10-23 15:43:17 +00:00
|
|
|
address = status_acc_view.get_account_address_value()
|
|
|
|
assert address == user_account.status_address, \
|
|
|
|
f"Recovered account should have address {user_account.status_address}, but has {address}"
|
|
|
|
|
2023-10-06 11:32:08 +00:00
|
|
|
with step('Verify that the user logged in via seed phrase correctly'):
|
2023-12-13 08:20:56 +00:00
|
|
|
user_canvas = main_window.left_panel.open_online_identifier()
|
2023-12-12 15:43:22 +00:00
|
|
|
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
|
2023-10-06 11:32:08 +00:00
|
|
|
assert profile_popup.user_name == user_account.name
|
2024-05-27 07:27:24 +00:00
|
|
|
|
2024-06-11 14:02:30 +00:00
|
|
|
with step('Restart application and try re-importing seed phrase again'):
|
|
|
|
aut.restart()
|
|
|
|
enter_seed_view = LoginView().add_existing_status_user().open_keys_view().open_enter_seed_phrase_view()
|
|
|
|
enter_seed_view.input_seed_phrase(user_account.seed_phrase, autocomplete)
|
|
|
|
confirm_import = enter_seed_view.click_import_seed_phrase_button()
|
2024-05-27 07:27:24 +00:00
|
|
|
|
2024-06-11 14:02:30 +00:00
|
|
|
with step('Verify that keys already exist popup appears and text is correct'):
|
|
|
|
assert confirm_import.get_key_exist_title() == KeysExistText.KEYS_EXIST_TITLE.value
|
|
|
|
assert KeysExistText.KEYS_EXIST_TEXT.value in confirm_import.get_text_labels()
|