Chore/onboarding tests (#331)

* chore: added clicking on back button and checking correct views appear during onboarding

* chore: click clear button on profile view and checking field is empty added

* chore: show and hide password verifications added to test_check_password_strength_and_login
This commit is contained in:
Valentina1133 2023-11-27 13:44:08 +03:00 committed by GitHub
parent b74ba4f7eb
commit 50ada60385
5 changed files with 92 additions and 4 deletions

View File

@ -70,6 +70,7 @@ mainWindow_inputLayout_ColumnLayout = {"container": statusDesktop_mainWindow, "i
mainWindow_statusBaseInput_StatusBaseInput = {"container": mainWindow_inputLayout_ColumnLayout, "objectName": "onboardingDisplayNameInput", "type": "TextEdit", "visible": True}
mainWindow_errorMessage_StatusBaseText = {"container": mainWindow_inputLayout_ColumnLayout, "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_nameInput_StatusInput = {"container": statusDesktop_mainWindow, "id": "nameInput", "type": "StatusInput", "unnamed": 1, "visible": True}
mainWindow_clear_icon_StatusIcon = {"container": mainWindow_StatusWindow, "objectName": "clear-icon", "type": "StatusIcon"}
# Your emojihash and identicon ring
mainWindow_welcomeScreenUserProfileImage_StatusSmartIdenticon = {"container": mainWindow_InsertDetailsView, "objectName": "welcomeScreenUserProfileImage", "type": "StatusSmartIdenticon", "visible": True}
@ -86,6 +87,8 @@ mainWindow_Create_password_StatusButton = {"checkable": False, "container": main
mainWindow_view_PasswordView = {"container": statusDesktop_mainWindow, "id": "view", "type": "PasswordView", "unnamed": 1, "visible": True}
mainWindow_RowLayout = {"container": mainWindow_StatusWindow, "type": "RowLayout", "unnamed": 1, "visible": True}
mainWindow_strengthInditactor_StatusPasswordStrengthIndicator = {"container": mainWindow_StatusWindow, "id": "strengthInditactor", "type": "StatusPasswordStrengthIndicator", "unnamed": 1, "visible": True}
mainWindow_show_icon_StatusIcon = {"container": mainWindow_StatusWindow, "objectName": "show-icon", "type": "StatusIcon", "visible": True}
mainWindow_hide_icon_StatusIcon = {"container": mainWindow_StatusWindow, "objectName": "hide-icon", "type": "StatusIcon", "visible": True}
# Confirm Password View
mainWindow_ConfirmPasswordView = {"container": statusDesktop_mainWindow, "type": "ConfirmPasswordView", "unnamed": 1,"visible": True}

View File

@ -263,6 +263,7 @@ class YourProfileView(OnboardingView):
self._erros_text_label = TextLabel('mainWindow_errorMessage_StatusBaseText')
self._next_button = Button('mainWindow_Next_StatusButton')
self._login_input_object = QObject('mainWindow_nameInput_StatusInput')
self._clear_icon = QObject('mainWindow_clear_icon_StatusIcon')
@property
@allure.step('Get next button enabled state')
@ -284,6 +285,15 @@ class YourProfileView(OnboardingView):
self._display_name_text_field.clear().text = value
return self
@allure.step('Get user display name')
def get_display_name(self) -> str:
return str(self._display_name_text_field.object.text)
@allure.step('Click clear button')
def clear_field(self):
self._clear_icon.click()
return self
@allure.step('Set user image')
def set_user_image(self, fp: SystemPath) -> PictureEditPopup:
allure.attach(name='User image', body=fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
@ -390,6 +400,18 @@ class CreatePasswordView(OnboardingView):
self._password_view_object = QObject('mainWindow_view_PasswordView')
self._strength_indicator = QObject('mainWindow_strengthInditactor_StatusPasswordStrengthIndicator')
self._indicator_panel_object = QObject('mainWindow_RowLayout')
self._show_icon = QObject('mainWindow_show_icon_StatusIcon')
self._hide_icon = QObject('mainWindow_hide_icon_StatusIcon')
@allure.step('Get password content from first field')
def get_password_from_first_field(self, echo_mode) -> str:
self._new_password_text_field.real_name['echoMode'] = echo_mode
return str(self._new_password_text_field.object.displayText)
@allure.step('Get password content from confirmation field')
def get_password_from_confirmation_field(self, echo_mode) -> str:
self._confirm_password_text_field.real_name['echoMode'] = echo_mode
return str(self._confirm_password_text_field.object.displayText)
@property
@allure.step('Verify: Create password button enabled')
@ -428,6 +450,16 @@ class CreatePasswordView(OnboardingView):
def password_error_message(self) -> str:
return self._password_view_object.object.errorMsgText
@allure.step('Click show icon by index')
def click_show_icon(self, index):
show_icons = driver.findAllObjects(self._show_icon.real_name)
driver.mouseClick(show_icons[index])
@allure.step('Click hide icon by index')
def click_hide_icon(self, index):
hide_icons = driver.findAllObjects(self._hide_icon.real_name)
driver.mouseClick(hide_icons[index])
@allure.step('Set password in first field')
def set_password_in_first_field(self, value: str):
self._new_password_text_field.clear().text = value
@ -440,6 +472,10 @@ class CreatePasswordView(OnboardingView):
def create_password(self, value: str) -> 'ConfirmPasswordView':
self.set_password_in_first_field(value)
self.set_password_in_confirmation_field(value)
self.click_create_password()
return ConfirmPasswordView().wait_until_appears()
def click_create_password(self):
self._create_button.click()
time.sleep(1)
return ConfirmPasswordView().wait_until_appears()
@ -475,6 +511,10 @@ class ConfirmPasswordView(OnboardingView):
def set_password(self, value: str):
self._confirm_password_text_field.text = value
@allure.step('Click confirm password')
def click_confirm_password(self):
self._confirm_button.click()
@allure.step('Confirm password')
def confirm_password(self, value: str):
self.set_password(value)
@ -485,6 +525,11 @@ class ConfirmPasswordView(OnboardingView):
self._back_button.click()
return CreatePasswordView().wait_until_appears()
@allure.step('Get password content from confirmation again field')
def get_password_from_confirmation_again_field(self, echo_mode) -> str:
self._confirm_password_text_field.real_name['echoMode'] = echo_mode
return str(self._confirm_password_text_field.object.displayText)
class BiometricsView(OnboardingView):

View File

@ -37,7 +37,9 @@ def keys_screen(main_window) -> KeysView:
def test_generate_new_keys(main_window, keys_screen, user_name: str, password, user_image: str, zoom: int, shift):
with step(f'Setup profile with name: {user_name} and image: {user_image}'):
keys_screen.generate_new_keys().back()
profile_view = keys_screen.generate_new_keys()
assert profile_view.is_next_button_enabled is False
profile_view.set_display_name(user_name)
if user_image is not None:
profile_picture_popup = profile_view.set_user_image(configs.testpath.TEST_FILES / user_image)
@ -63,12 +65,15 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
chat_key = details_view.chat_key
emoji_hash = details_view.emoji_hash
assert details_view.is_identicon_ring_visible
details_view.back().next()
with step('Finalize onboarding and open main screen'):
create_password_view = details_view.next()
create_password_view.back().next()
assert not create_password_view.is_create_password_button_enabled
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"

View File

@ -80,6 +80,10 @@ def test_sign_up_with_wrong_name(keys_screen, user_name: str, error: str):
assert profile_view.is_next_button_enabled is False
assert profile_view.error_message == error
with step('Clear content of disply name field and verify it is empty'):
profile_view.clear_field()
assert profile_view.get_display_name() == ''
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702993',
'Sign up with wrong password format in both new password and confirmation input')

View File

@ -38,7 +38,8 @@ def keys_screen(main_window) -> KeysView:
pytest.param('+1_3!48aT1', good_elements),
pytest.param('+1_3!48aTq', great_elements)
])
def test_check_password_strength_and_login(keys_screen, main_window, user_account, password: str, password_strength_elements):
def test_check_password_strength_and_login(keys_screen, main_window, user_account, password: str,
password_strength_elements):
with step('Input correct user name'):
profile_view = keys_screen.generate_new_keys()
profile_view.set_display_name(user_account.name)
@ -48,14 +49,44 @@ def test_check_password_strength_and_login(keys_screen, main_window, user_accoun
create_password_view = details_view.next()
create_password_view.set_password_in_first_field(password)
with step('Click show icon to show password and check that shown password is correct'):
create_password_view.click_show_icon(0)
assert create_password_view.get_password_from_first_field(0) == password
with step('Click show icon to hide password and check that there are dots instead'):
create_password_view.click_hide_icon(0)
assert create_password_view.get_password_from_first_field(2) == '●●●●●●●●●●'
with step('Verify that correct strength indicator color, text and green messages appear'):
assert create_password_view.strength_indicator_color == password_strength_elements[1]
assert create_password_view.strength_indicator_text == password_strength_elements[0]
assert sorted(create_password_view.green_indicator_messages) == sorted(password_strength_elements[2])
with step('Verify that user can login afterwards'):
confirm_password_view = create_password_view.create_password(password)
confirm_password_view.confirm_password(password)
with step('Enter password to confirmation field'):
create_password_view.set_password_in_confirmation_field(password)
with step('Click show icon to show password and check that shown password is correct'):
create_password_view.click_show_icon(1)
assert create_password_view.get_password_from_confirmation_field(0) == password
with step('Click show icon to hide password and check that there are dots instead'):
create_password_view.click_hide_icon(0)
assert create_password_view.get_password_from_confirmation_field(2) == '●●●●●●●●●●'
with step('Confirm creation of password and set password in confirmation again field'):
confirm_password_view = create_password_view.click_create_password()
confirm_password_view.set_password(password)
with step('Click show icon to show password and check that shown password is correct'):
create_password_view.click_show_icon(0)
assert confirm_password_view.get_password_from_confirmation_again_field(0) == password
with step('Click show icon to hide password and check that there are dots instead'):
create_password_view.click_hide_icon(0)
assert confirm_password_view.get_password_from_confirmation_again_field(2) == '●●●●●●●●●●'
with step('Verify that the user can login afterwards'):
confirm_password_view.click_confirm_password()
if configs.system.IS_MAC:
BiometricsView().wait_until_appears().prefer_password()
SplashScreen().wait_until_appears().wait_until_hidden()