Skip to content

Commit 15aefec

Browse files
committed
tests(@e2e): test for changing language on onboarding screen
1 parent ae9c705 commit 15aefec

File tree

8 files changed

+86
-35
lines changed

8 files changed

+86
-35
lines changed

test/e2e/constants/onboarding.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ class KeysExistText(Enum):
2020
KEYS_EXIST_TEXT = (
2121
"Keys for this account already exist and can't be added again. If you've lost your password, passcode or Keycard, uninstall the app, reinstall and access your keys by entering your recovery phrase. In case of Keycard try recovering using PUK or reinstall the app and try login with the Keycard option.")
2222

23+
class LanguageCodes(Enum):
24+
CZECH = 'CS'
25+
ENGLISH = 'EN'
26+
KOREAN = 'KO'
2327

2428
password_strength_elements = namedtuple('Password_Strength_Elements',
2529
['strength_indicator', 'strength_color', 'strength_messages'])
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import allure
2+
3+
from gui.elements.object import QObject
4+
from gui.objects_map import names, onboarding_names
5+
6+
7+
class LanguageSelector(QObject):
8+
def __init__(self):
9+
super().__init__(onboarding_names.statusDropdown)
10+
11+
self.language_item = QObject(onboarding_names.startupLanguageSelector_item)
12+
13+
@allure.step('Select random language')
14+
def select_language(self, language_code):
15+
self.language_item.real_name['objectName'] = 'itemDelegate_' + language_code
16+
self.language_item.click()
17+
self.wait_until_hidden()

test/e2e/gui/objects_map/names.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from objectmaphelper import *
22

3+
34
# MAIN NAMES
45

56
statusDesktop_mainWindow = {"name": "mainWindow", "type": "QQuickWindow"}

test/e2e/gui/objects_map/onboarding_names.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from objectmaphelper import RegularExpression
2+
13
from gui.objects_map.names import statusDesktop_mainWindow, statusDesktop_mainWindow_overlay
24

35
# Welcome to status view
@@ -7,6 +9,7 @@
79
startupCreateProfileButton = {"container": startupOnboardingLayout, "objectName": "btnCreateProfile", "type": "StatusButton", "visible": True}
810
startupLoginButton = {"container": startupOnboardingLayout, "objectName": "btnLogin", "type": "StatusButton", "visible": True}
911
startupApprovalLinks = {"container": startupOnboardingLayout, "objectName": "approvalLinks", "type": "StatusBaseText", "visible": True}
12+
startupLanguageSelector = {"container": statusDesktop_mainWindow, "type": "StatusLanguageSelector", "unnamed": 1, "visible": True}
1013

1114
# Sign in view
1215
enterRecoveryPhraseButton = {"container": startupOnboardingLayout, "objectName": "btnWithSeedphrase", "type": "StatusButton", "visible": True}
@@ -185,6 +188,8 @@
185188
createProfileButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createProfileDelegate", "type": "LoginUserSelectorDelegate", "visible": True}
186189
returningLoginButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "logInDelegate", "type": "LoginUserSelectorDelegate", "visible": True}
187190
statusDropdown = {"container": statusDesktop_mainWindow_overlay, "objectName": "StatusDropdown", "type": "PopupItem", "visible": True}
191+
startupLanguageSelector_item = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("itemDelegate_*"), "type": "ItemDelegate", "visible": True}
192+
188193

189194
# Touch ID Auth View
190195
mainWindow_TouchIDAuthView = {"container": statusDesktop_mainWindow, "type": "TouchIDAuthView", "unnamed": 1, "visible": True}

test/e2e/gui/screens/onboarding.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import driver
1212
from constants import ColorCodes
1313
from driver.objects_access import walk_children
14+
from gui.components.onboarding.language_selector import LanguageSelector
1415
from gui.components.onboarding.login_by_syncing_checklist import LogInBySyncingChecklist
1516
from gui.components.onboarding.login_users_list_popup import OnboardingLoginUsersPopup
1617
from gui.components.onboarding.share_usage_data_popup import HelpUsImproveStatusView
@@ -35,6 +36,12 @@ def __init__(self):
3536
self.create_profile_button = Button(onboarding_names.startupCreateProfileButton)
3637
self.log_in_button = Button(onboarding_names.startupLoginButton)
3738
self.approval_links = QObject(onboarding_names.startupApprovalLinks)
39+
self.language_selector = QObject(onboarding_names.startupLanguageSelector)
40+
41+
@allure.step('Open language selector')
42+
def open_language_selector(self):
43+
self.language_selector.click()
44+
return LanguageSelector().wait_until_appears()
3845

3946
@allure.step('Open Create your profile view')
4047
def open_create_your_profile_view(self) -> 'CreateYourProfileViewOnboarding':

test/e2e/tests/crtitical_tests_prs/test_messaging_1x1_chat.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
import driver
1010
from configs import get_platform
11-
from constants.images_paths import HEART_EMOJI_PATH, ANGRY_EMOJI_PATH, THUMBSUP_EMOJI_PATH, THUMBSDOWN_EMOJI_PATH, \
12-
LAUGHING_EMOJI_PATH, SAD_EMOJI_PATH
1311
from constants.messaging import Messaging
1412
from constants.wallet import WalletAddress
1513
from ext.test_files.base64_images import BASE_64_IMAGE_JPEG
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import random
2+
3+
import allure
4+
import pytest
5+
from allure_commons._allure import step
6+
7+
from gui.screens.onboarding import OnboardingWelcomeToStatusView
8+
from . import marks
9+
10+
from constants.onboarding import very_weak_lower_elements, very_weak_upper_elements, \
11+
very_weak_numbers_elements, very_weak_symbols_elements, weak_elements, okay_elements, good_elements, \
12+
strong_elements, LanguageCodes
13+
14+
pytestmark = marks
15+
16+
17+
@pytest.mark.case(702989)
18+
def test_check_language_selector_password_strength_and_login(main_window, user_account):
19+
20+
with step('Verify user can change language on onboarding screen'):
21+
welcome_screen = OnboardingWelcomeToStatusView().wait_until_appears()
22+
assert welcome_screen.language_selector.object.text == LanguageCodes.ENGLISH.value, f'English should be default'
23+
24+
selector = welcome_screen.open_language_selector()
25+
new_language = random.choice([LanguageCodes.KOREAN.value, LanguageCodes.CZECH.value])
26+
selector.select_language(new_language.lower())
27+
28+
assert welcome_screen.create_profile_button.object.text != 'Create profile', f'Language was not changed'
29+
30+
welcome_screen.open_language_selector().select_language(LanguageCodes.ENGLISH.value.lower())
31+
32+
assert welcome_screen.language_selector.object.text == LanguageCodes.ENGLISH.value, f'Language was not changed'
33+
34+
with step('Verify password strength'):
35+
values = [('abcdefghij', very_weak_lower_elements),
36+
('ABCDEFGHIJ', very_weak_upper_elements),
37+
('1234567890', very_weak_numbers_elements),
38+
('+_!!!!!!!!', very_weak_symbols_elements),
39+
('+1_3!48888', weak_elements),
40+
('+1_3!48a11', okay_elements),
41+
('+1_3!48aT1', good_elements),
42+
('+1_3!48aTq', strong_elements)]
43+
44+
profile_view = welcome_screen.open_create_your_profile_view()
45+
create_password_view = profile_view.open_password_view()
46+
47+
for (input_text, expected_indicator) in values:
48+
create_password_view.set_password_in_first_field(input_text)
49+
assert create_password_view.strength_indicator_color == expected_indicator[1]
50+
assert str(create_password_view.strength_indicator_text) == expected_indicator[0]
51+
assert sorted(create_password_view.green_indicator_messages) == sorted(expected_indicator[2])
52+
assert not create_password_view.confirm_password_button.is_visible

test/e2e/tests/onboarding/test_password_strength.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)