2024-03-28 09:58:37 +00:00
|
|
|
import random
|
|
|
|
import string
|
2023-10-13 13:26:39 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
import allure
|
|
|
|
import pytest
|
|
|
|
from allure_commons._allure import step
|
2024-09-08 07:33:42 +00:00
|
|
|
|
2024-11-20 16:34:34 +00:00
|
|
|
from gui.components.signing_phrase_popup import SigningPhrasePopup
|
2024-09-08 07:33:42 +00:00
|
|
|
from helpers.OnboardingHelper import open_generate_new_keys_view
|
2023-12-07 16:47:34 +00:00
|
|
|
from . import marks
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
import configs.system
|
2024-08-19 17:41:54 +00:00
|
|
|
from constants import UserAccount, RandomUser
|
2024-10-15 15:31:37 +00:00
|
|
|
from scripts.utils.generators import random_password_string
|
2023-10-13 13:26:39 +00:00
|
|
|
from constants.onboarding import OnboardingMessages
|
|
|
|
from driver.aut import AUT
|
|
|
|
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
|
|
|
|
from gui.components.splash_screen import SplashScreen
|
2024-10-15 15:31:37 +00:00
|
|
|
from gui.screens.onboarding import BiometricsView, LoginView, \
|
2024-04-24 13:29:14 +00:00
|
|
|
YourEmojihashAndIdenticonRingView
|
2023-10-13 13:26:39 +00:00
|
|
|
|
2023-12-07 16:47:34 +00:00
|
|
|
pytestmark = marks
|
2023-10-13 13:26:39 +00:00
|
|
|
|
2024-03-05 12:44:37 +00:00
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702991', 'Login with an invalid password')
|
|
|
|
@pytest.mark.case(702991)
|
|
|
|
@pytest.mark.parametrize('error', [OnboardingMessages.PASSWORD_INCORRECT.value
|
|
|
|
])
|
2024-09-07 12:03:07 +00:00
|
|
|
def test_login_with_wrong_password(aut: AUT, main_window, error: str):
|
2024-08-19 17:41:54 +00:00
|
|
|
user_one: UserAccount = RandomUser()
|
2023-10-13 13:26:39 +00:00
|
|
|
|
2024-09-08 07:33:42 +00:00
|
|
|
keys_screen = open_generate_new_keys_view()
|
2024-09-07 12:03:07 +00:00
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
with step('Open generate keys view and set user name'):
|
|
|
|
profile_view = keys_screen.generate_new_keys()
|
|
|
|
profile_view.set_display_name(user_one.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-13 13:26:39 +00:00
|
|
|
confirm_password_view = create_password_view.create_password(user_one.password)
|
|
|
|
confirm_password_view.confirm_password(user_one.password)
|
2024-06-18 06:53:37 +00:00
|
|
|
if configs.system.get_platform() == "Darwin":
|
2023-10-13 13:26:39 +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-07 16:19:18 +00:00
|
|
|
if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
|
2023-10-13 13:26:39 +00:00
|
|
|
BetaConsentPopup().confirm()
|
2024-11-20 16:34:34 +00:00
|
|
|
if SigningPhrasePopup().is_visible:
|
|
|
|
SigningPhrasePopup().confirm_phrase()
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
with step('Verify that the user logged in correctly'):
|
2024-04-24 13:29:14 +00:00
|
|
|
user_image = main_window.left_panel.open_online_identifier()
|
|
|
|
profile_popup = user_image.open_profile_popup_from_online_identifier()
|
2023-10-13 13:26:39 +00:00
|
|
|
assert profile_popup.user_name == user_one.name
|
|
|
|
|
|
|
|
with step('Restart application and input wrong password'):
|
|
|
|
aut.restart()
|
|
|
|
login_view = LoginView()
|
2024-08-19 17:41:54 +00:00
|
|
|
login_view.log_in(UserAccount(
|
|
|
|
name=user_one.name,
|
|
|
|
password=random_password_string()
|
|
|
|
))
|
2023-10-13 13:26:39 +00:00
|
|
|
time.sleep(2)
|
|
|
|
|
2024-03-05 12:44:37 +00:00
|
|
|
with step('Verify that user cannot log in and the error appears'):
|
2023-10-13 13:26:39 +00:00
|
|
|
assert login_view.login_error_message == error
|
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702992', 'Sign up with wrong username format')
|
|
|
|
@pytest.mark.case(702992)
|
|
|
|
@pytest.mark.parametrize('user_name, error', [
|
|
|
|
pytest.param('Athl', OnboardingMessages.WRONG_LOGIN_LESS_LETTERS.value),
|
|
|
|
pytest.param('Gra', OnboardingMessages.WRONG_LOGIN_LESS_LETTERS.value),
|
2024-03-28 09:58:37 +00:00
|
|
|
pytest.param('tester3@', OnboardingMessages.WRONG_LOGIN_SYMBOLS_NOT_ALLOWED.value),
|
|
|
|
pytest.param(''.join(random.choice(string.punctuation) for i in range(5, 25)),
|
|
|
|
OnboardingMessages.WRONG_LOGIN_SYMBOLS_NOT_ALLOWED.value)
|
2023-10-13 13:26:39 +00:00
|
|
|
])
|
2024-09-07 12:03:07 +00:00
|
|
|
def test_sign_up_with_wrong_name(aut: AUT, main_window, user_name, error):
|
2024-09-08 07:33:42 +00:00
|
|
|
keys_screen = open_generate_new_keys_view()
|
2024-09-07 12:03:07 +00:00
|
|
|
|
|
|
|
with step(f'Input name Athl'):
|
2023-10-13 13:26:39 +00:00
|
|
|
profile_view = keys_screen.generate_new_keys()
|
|
|
|
profile_view.set_display_name(user_name)
|
|
|
|
|
|
|
|
with step('Verify that button Next is disabled and correct error appears'):
|
|
|
|
assert profile_view.is_next_button_enabled is False
|
2023-12-20 15:19:13 +00:00
|
|
|
assert profile_view.get_error_message == error
|
2023-10-13 13:26:39 +00:00
|
|
|
|
2023-11-27 10:44:08 +00:00
|
|
|
with step('Clear content of disply name field and verify it is empty'):
|
|
|
|
profile_view.clear_field()
|
|
|
|
assert profile_view.get_display_name() == ''
|
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702993',
|
2024-08-19 17:41:54 +00:00
|
|
|
'Sign up with password shorter than 10 chars')
|
2023-10-13 13:26:39 +00:00
|
|
|
@pytest.mark.case(702993)
|
2024-08-19 17:41:54 +00:00
|
|
|
@pytest.mark.parametrize('error', [
|
|
|
|
pytest.param(OnboardingMessages.WRONG_PASSWORD.value),
|
2023-10-13 13:26:39 +00:00
|
|
|
])
|
2024-09-07 12:03:07 +00:00
|
|
|
def test_sign_up_with_wrong_password_length(user_account, error: str, aut: AUT, main_window):
|
2024-09-08 07:33:42 +00:00
|
|
|
keys_screen = open_generate_new_keys_view()
|
2024-09-07 12:03:07 +00:00
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
with step('Input correct user name'):
|
|
|
|
profile_view = keys_screen.generate_new_keys()
|
|
|
|
profile_view.set_display_name(user_account.name)
|
|
|
|
|
|
|
|
with step('Input wrong password in both first and confirmation fields'):
|
2024-04-24 13:29:14 +00:00
|
|
|
create_password_view = profile_view.next()
|
2024-08-19 17:41:54 +00:00
|
|
|
create_password_view.set_password_in_first_field(user_account.password[:8])
|
|
|
|
create_password_view.set_password_in_confirmation_field(user_account.password[:8])
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
with step('Verify that button Create password is disabled and correct error appears'):
|
|
|
|
assert create_password_view.is_create_password_button_enabled is False
|
2024-10-16 07:22:28 +00:00
|
|
|
assert str(create_password_view.password_error_message) == error
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702994',
|
|
|
|
'Sign up with right password format in new password input but incorrect in confirmation password input')
|
|
|
|
@pytest.mark.case(702994)
|
2024-09-07 12:03:07 +00:00
|
|
|
def test_sign_up_with_wrong_password_in_confirmation_field(user_account, aut: AUT, main_window):
|
2024-09-08 07:33:42 +00:00
|
|
|
keys_screen = open_generate_new_keys_view()
|
2024-09-07 12:03:07 +00:00
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
with step('Input correct user name'):
|
|
|
|
profile_view = keys_screen.generate_new_keys()
|
|
|
|
profile_view.set_display_name(user_account.name)
|
|
|
|
|
|
|
|
with step('Input correct password in first field and wrong password in confirmation field'):
|
2024-04-24 13:29:14 +00:00
|
|
|
create_password_view = profile_view.next()
|
2024-08-19 17:41:54 +00:00
|
|
|
create_password_view.set_password_in_first_field(user_account.password)
|
|
|
|
create_password_view.set_password_in_confirmation_field(random_password_string())
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
with step('Verify that button Create password is disabled'):
|
|
|
|
assert create_password_view.is_create_password_button_enabled is False
|
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702995',
|
|
|
|
'Sign up with incorrect confirmation-again password')
|
|
|
|
@pytest.mark.case(702995)
|
2024-08-19 17:41:54 +00:00
|
|
|
@pytest.mark.parametrize('error', [
|
|
|
|
pytest.param(OnboardingMessages.PASSWORDS_DONT_MATCH.value),
|
2023-10-13 13:26:39 +00:00
|
|
|
])
|
2024-09-07 12:03:07 +00:00
|
|
|
def test_sign_up_with_wrong_password_in_confirmation_again_field(user_account,
|
|
|
|
error: str, aut: AUT, main_window):
|
2024-09-08 07:33:42 +00:00
|
|
|
keys_screen = open_generate_new_keys_view()
|
2024-09-07 12:03:07 +00:00
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
with step('Input correct user name'):
|
|
|
|
profile_view = keys_screen.generate_new_keys()
|
|
|
|
profile_view.set_display_name(user_account.name)
|
|
|
|
|
|
|
|
with step('Input correct password in both first and confirmation fields'):
|
2024-04-24 13:29:14 +00:00
|
|
|
create_password_view = profile_view.next()
|
2024-08-19 17:41:54 +00:00
|
|
|
confirm_password_view = create_password_view.create_password(user_account.password)
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
with step('Input wrong password in confirmation again field'):
|
2024-08-19 17:41:54 +00:00
|
|
|
confirm_password_view.set_password(random_password_string())
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
with step('Verify that button Finalise Status Password Creation is disabled and correct error appears'):
|
|
|
|
assert confirm_password_view.is_confirm_password_button_enabled is False
|
|
|
|
assert confirm_password_view.confirmation_error_message == error
|
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702999',
|
|
|
|
'Sign up with wrong imported seed phrase')
|
|
|
|
@pytest.mark.case(702999)
|
|
|
|
@pytest.mark.parametrize('seed_phrase', [
|
|
|
|
pytest.param('pelican chief sudden oval media rare swamp elephant lawsuit wheal knife initial'),
|
|
|
|
])
|
2024-09-07 12:03:07 +00:00
|
|
|
def test_sign_up_with_wrong_seed_phrase(seed_phrase: str, aut: AUT, main_window):
|
2024-09-08 07:33:42 +00:00
|
|
|
keys_screen = open_generate_new_keys_view()
|
2024-09-07 12:03:07 +00:00
|
|
|
|
2023-10-13 13:26:39 +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()
|
2024-09-08 07:33:42 +00:00
|
|
|
input_view.input_seed_phrase(seed_phrase.split(), False)
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
with step('Verify that import button is disabled'):
|
|
|
|
assert input_view.is_import_button_enabled is False
|