2023-08-04 18:27:03 +00:00
|
|
|
|
import logging
|
2023-12-21 07:59:41 +00:00
|
|
|
|
import random
|
|
|
|
|
import string
|
2023-08-10 06:58:50 +00:00
|
|
|
|
|
2023-08-04 18:27:03 +00:00
|
|
|
|
import allure
|
|
|
|
|
import pytest
|
|
|
|
|
from allure import step
|
2024-07-10 10:00:25 +00:00
|
|
|
|
|
2023-12-07 16:47:34 +00:00
|
|
|
|
from . import marks
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
|
|
import configs.timeouts
|
2023-08-29 14:43:00 +00:00
|
|
|
|
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
|
2023-09-22 03:58:45 +00:00
|
|
|
|
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
|
2024-02-15 10:37:40 +00:00
|
|
|
|
from gui.components.picture_edit_popup import shift_image, PictureEditPopup
|
2023-08-04 18:27:03 +00:00
|
|
|
|
from gui.components.splash_screen import SplashScreen
|
2024-04-24 13:29:14 +00:00
|
|
|
|
from gui.screens.onboarding import WelcomeToStatusView, BiometricsView, KeysView, \
|
|
|
|
|
YourEmojihashAndIdenticonRingView
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
2023-12-07 16:47:34 +00:00
|
|
|
|
pytestmark = marks
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
|
|
|
2023-08-10 11:43:17 +00:00
|
|
|
|
@pytest.fixture
|
|
|
|
|
def keys_screen(main_window) -> KeysView:
|
|
|
|
|
with step('Open Generate new keys view'):
|
|
|
|
|
BeforeStartedPopUp().get_started()
|
2023-10-26 11:19:32 +00:00
|
|
|
|
welcome_screen = WelcomeToStatusView().wait_until_appears()
|
|
|
|
|
return welcome_screen.get_keys()
|
2023-08-10 11:43:17 +00:00
|
|
|
|
|
|
|
|
|
|
2023-08-04 18:27:03 +00:00
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703421', 'Generate new keys')
|
2024-02-16 14:44:53 +00:00
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703010', 'Settings - Sign out & Quit')
|
|
|
|
|
@pytest.mark.case(703421, 703010)
|
2024-02-15 10:37:40 +00:00
|
|
|
|
@pytest.mark.critical
|
2024-02-16 14:44:53 +00:00
|
|
|
|
# reason='https://github.com/status-im/status-desktop/issues/13013'
|
2023-08-10 06:58:50 +00:00
|
|
|
|
@pytest.mark.parametrize('user_name, password, user_image, zoom, shift', [
|
2023-12-20 15:19:13 +00:00
|
|
|
|
pytest.param(
|
2023-12-21 07:59:41 +00:00
|
|
|
|
''.join((random.choice(
|
2023-12-21 09:02:43 +00:00
|
|
|
|
string.ascii_letters + string.digits + random.choice('_- '))
|
2024-03-28 09:58:37 +00:00
|
|
|
|
for i in range(5, 25))
|
2023-12-21 09:02:43 +00:00
|
|
|
|
).strip(' '),
|
|
|
|
|
''.join((random.choice(
|
|
|
|
|
string.ascii_letters + string.digits + string.punctuation)
|
|
|
|
|
for _ in range(10, 28))
|
2023-12-21 07:59:41 +00:00
|
|
|
|
),
|
2023-12-21 10:21:57 +00:00
|
|
|
|
random.choice(['sample_JPEG_1920×1280.jpeg', 'file_example_PNG_3MB.png', 'file_example_JPG_2500kB.jpg']),
|
2023-12-20 15:19:13 +00:00
|
|
|
|
5,
|
|
|
|
|
shift_image(0, 1000, 1000, 0))
|
2023-08-04 18:27:03 +00:00
|
|
|
|
])
|
2024-04-24 13:29:14 +00:00
|
|
|
|
def test_generate_new_keys_sign_out_from_settings(aut, main_window, keys_screen, user_name: str, password,
|
|
|
|
|
user_image: str, zoom: int, shift):
|
2023-12-20 15:19:13 +00:00
|
|
|
|
with step('Click generate new keys and open profile view'):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
profile_view = keys_screen.generate_new_keys()
|
2023-12-20 15:19:13 +00:00
|
|
|
|
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'):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
profile_view.set_display_name(user_name)
|
2023-12-20 15:19:13 +00:00
|
|
|
|
assert profile_view.get_display_name() == user_name, \
|
|
|
|
|
f'Display name is empty or was not filled in'
|
2023-12-21 16:10:48 +00:00
|
|
|
|
assert not profile_view.get_error_message, \
|
|
|
|
|
f'Error message {profile_view.get_error_message} is present when it should not'
|
2023-12-20 15:19:13 +00:00
|
|
|
|
|
|
|
|
|
with step('Click plus button and add user picture'):
|
2024-02-15 10:37:40 +00:00
|
|
|
|
profile_view.set_profile_picture(configs.testpath.TEST_IMAGES / user_image)
|
|
|
|
|
PictureEditPopup().set_zoom_shift_for_picture(zoom=zoom, shift=shift)
|
2023-12-21 16:10:48 +00:00
|
|
|
|
# TODO: find a way to verify the picture is there (changed to the custom one)
|
|
|
|
|
assert profile_view.get_profile_image is not None, f'Profile picture was not set / applied'
|
2023-12-29 10:29:42 +00:00
|
|
|
|
assert profile_view.is_next_button_enabled is True, \
|
|
|
|
|
f'Next button is not enabled on profile screen'
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
2023-12-21 17:44:15 +00:00
|
|
|
|
with step('Open password set up view, fill in the form and click back'):
|
2024-04-24 13:29:14 +00:00
|
|
|
|
create_password_view = profile_view.next()
|
2023-12-20 15:19:13 +00:00
|
|
|
|
assert not create_password_view.is_create_password_button_enabled, \
|
|
|
|
|
f'Create password button is enabled when it should not'
|
2023-08-04 18:27:03 +00:00
|
|
|
|
confirm_password_view = create_password_view.create_password(password)
|
2023-12-21 17:44:15 +00:00
|
|
|
|
confirm_password_view.back()
|
|
|
|
|
assert create_password_view.get_password_from_first_field is not None, \
|
|
|
|
|
f'Password field lost its value when clicking back button'
|
|
|
|
|
assert create_password_view.get_password_from_confirmation_field is not None, \
|
|
|
|
|
f'Password confirmation field lost its value when clicking back button'
|
|
|
|
|
|
|
|
|
|
with step('Click create password and open password confirmation screen'):
|
|
|
|
|
confirm_password_view = create_password_view.click_create_password()
|
|
|
|
|
assert not confirm_password_view.is_confirm_password_button_enabled, \
|
|
|
|
|
f'Finalise Status password creation button is enabled when it should not'
|
|
|
|
|
|
|
|
|
|
with step('Confirm password and login'):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
confirm_password_view.confirm_password(password)
|
2024-06-18 06:53:37 +00:00
|
|
|
|
if configs.system.get_platform() == "Darwin":
|
2023-09-22 03:58:45 +00:00
|
|
|
|
assert BiometricsView().is_touch_id_button_visible(), f"TouchID button is not found"
|
|
|
|
|
BiometricsView().wait_until_appears().prefer_password()
|
2023-08-04 18:27:03 +00:00
|
|
|
|
SplashScreen().wait_until_appears().wait_until_hidden()
|
2024-04-24 13:29:14 +00:00
|
|
|
|
|
|
|
|
|
with step('Verify emojihash and identicon ring profile screen appeared and capture the details'):
|
|
|
|
|
emoji_hash_identicon_view = YourEmojihashAndIdenticonRingView().verify_emojihash_view_present()
|
|
|
|
|
chat_key = emoji_hash_identicon_view.get_chat_key
|
|
|
|
|
emoji_hash_public_key = emoji_hash_identicon_view.get_emoji_hash
|
|
|
|
|
assert emoji_hash_identicon_view.is_identicon_ring_visible, f'Identicon ring is not present when it should'
|
|
|
|
|
|
|
|
|
|
with step('Click Start using Status'):
|
|
|
|
|
next_view = emoji_hash_identicon_view.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()
|
2023-12-21 18:14:17 +00:00
|
|
|
|
if not configs.system.TEST_MODE:
|
|
|
|
|
BetaConsentPopup().confirm()
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
2023-12-20 15:19:13 +00:00
|
|
|
|
with step('Open online identifier and check the data'):
|
|
|
|
|
online_identifier = main_window.left_panel.open_online_identifier()
|
2023-12-21 17:44:15 +00:00
|
|
|
|
assert online_identifier.get_user_name == user_name, \
|
|
|
|
|
f'Display name in online identifier is wrong, current: {online_identifier.get_user_name}, expected: {user_name}'
|
|
|
|
|
assert online_identifier.is_identicon_ring_visible, \
|
|
|
|
|
f'Identicon ring is not present when it should'
|
2024-04-04 14:37:39 +00:00
|
|
|
|
assert str(online_identifier.object.pubkey) is not None, \
|
2023-12-21 17:44:15 +00:00
|
|
|
|
f'Public key is not present'
|
2024-04-04 14:37:39 +00:00
|
|
|
|
assert str(online_identifier.object.pubkey) == emoji_hash_public_key, f'Public keys should match when they dont'
|
2023-12-20 15:19:13 +00:00
|
|
|
|
|
|
|
|
|
with step('Open user profile from online identifier and check the data'):
|
|
|
|
|
profile_popup = online_identifier.open_profile_popup_from_online_identifier()
|
2024-02-12 06:48:10 +00:00
|
|
|
|
profile_popup_user_name = profile_popup.user_name
|
|
|
|
|
profile_popup_chat_key = profile_popup.copy_chat_key
|
|
|
|
|
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_chat_key == chat_key, \
|
|
|
|
|
f'Chat key in user profile is wrong, current: {profile_popup_chat_key}, expected: {chat_key}'
|
2023-12-21 18:14:17 +00:00
|
|
|
|
assert profile_popup.get_emoji_hash == emoji_hash_public_key, \
|
|
|
|
|
f'Public keys should match when they dont'
|
2024-02-16 14:44:53 +00:00
|
|
|
|
|
2024-07-11 06:16:55 +00:00
|
|
|
|
with step('Open share profile popup and check the data'):
|
|
|
|
|
share_profile_popup = profile_popup.share_profile()
|
|
|
|
|
profile_link = share_profile_popup.get_profile_link()
|
|
|
|
|
emoji_hash = share_profile_popup.get_emoji_hash()
|
|
|
|
|
assert share_profile_popup.is_profile_qr_code_visibile
|
|
|
|
|
assert chat_key in profile_link, f'Profile link is wrong {profile_link}, it does not contain correct chat key'
|
|
|
|
|
assert emoji_hash == emoji_hash_public_key, f'Public keys do not match'
|
|
|
|
|
share_profile_popup. close()
|
|
|
|
|
|
2024-02-16 14:44:53 +00:00
|
|
|
|
with step('Click left panel and open settings'):
|
|
|
|
|
main_window.left_panel.click()
|
|
|
|
|
settings = main_window.left_panel.open_settings()
|
|
|
|
|
|
|
|
|
|
with step('Click sign out and quit in settings'):
|
|
|
|
|
sign_out_screen = settings.left_panel.open_sign_out_and_quit()
|
|
|
|
|
sign_out_screen.sign_out_and_quit()
|