status-desktop/test/e2e/tests/onboarding/test_onboarding_generate_ne...

95 lines
4.4 KiB
Python
Raw Normal View History

import logging
import os
import allure
import pytest
from allure import step
from . import marks
import configs.timeouts
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
from gui.components.picture_edit_popup import shift_image
from gui.components.splash_screen import SplashScreen
from gui.screens.onboarding import AllowNotificationsView, WelcomeToStatusView, BiometricsView, KeysView
pytestmark = marks
@pytest.fixture
def keys_screen(main_window) -> KeysView:
with step('Open Generate new keys view'):
if configs.system.IS_MAC:
AllowNotificationsView().wait_until_appears().allow()
BeforeStartedPopUp().get_started()
welcome_screen = WelcomeToStatusView().wait_until_appears()
return welcome_screen.get_keys()
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703421', 'Generate new keys')
@pytest.mark.case(703421)
@pytest.mark.critical
@pytest.mark.parametrize('user_name, password, user_image, zoom, shift', [
pytest.param(
'_1Test-User',
'*P@ssw0rd*',
'tv_signal.jpeg',
5,
shift_image(0, 1000, 1000, 0))
])
def test_generate_new_keys(main_window, keys_screen, user_name: str, password, user_image: str, zoom: int, shift):
with step('Click generate new keys and click back button'):
keys_screen.generate_new_keys().back()
with step('Click generate new keys and open profile view'):
profile_view = keys_screen.generate_new_keys()
assert profile_view.is_next_button_enabled is False, \
f'Next button is enabled on profile screen when it should not'
with step('Type in the display name on the profile view'):
profile_view.set_display_name(user_name)
assert profile_view.get_display_name() == user_name, \
f'Display name is empty or was not filled in'
with step('Click plus button and add user picture'):
if user_image is not None:
profile_picture_popup = profile_view.set_user_image(configs.testpath.TEST_FILES / user_image)
profile_picture_popup.make_picture(zoom=zoom, shift=shift)
assert not profile_view.get_error_message, \
f'Error message {profile_view.get_error_message} is present when it should not'
with step('Open emojihash and identicon ring profile screen and capture the details'):
details_view = profile_view.next()
chat_key = details_view.get_chat_key
# TODO: replace with the public key value verification
# emoji_hash = details_view.get_emoji_hash
assert details_view.is_identicon_ring_visible, f'Identicon ring is not present when it should'
details_view.back().next()
with step('Proceed with password set up and login'):
create_password_view = details_view.next()
create_password_view.back().next()
assert not create_password_view.is_create_password_button_enabled, \
f'Create password button is enabled when it should not'
confirm_password_view = create_password_view.create_password(password)
confirm_password_view.back().click_create_password()
confirm_password_view.confirm_password(password)
if configs.system.IS_MAC:
assert BiometricsView().is_touch_id_button_visible(), f"TouchID button is not found"
BiometricsView().wait_until_appears().prefer_password()
SplashScreen().wait_until_appears().wait_until_hidden()
2023-12-12 12:43:47 +00:00
if not configs.system.TEST_MODE:
BetaConsentPopup().confirm()
with step('Open online identifier and check the data'):
online_identifier = main_window.left_panel.open_online_identifier()
assert online_identifier.user_name == user_name, \
f'Display name in online identifier is wrong, current: {online_identifier.user_name}, expected: {user_name}'
with step('Open user profile from online identifier and check the data'):
profile_popup = online_identifier.open_profile_popup_from_online_identifier()
assert profile_popup.user_name == user_name, \
f'Display name in user profile is wrong, current: {profile_popup.user_name}, expected: {user_name}'
assert profile_popup.get_chat_key_from_profile_link == chat_key, \
f'Chat key in user profile is wrong, current: {profile_popup.get_chat_key_from_profile_link}, expected: {chat_key}'