From 219eb04da9caefdab3a65082813ea3562969674b Mon Sep 17 00:00:00 2001 From: Vladimir Druzhinin <128374224+StateOf-Vlado@users.noreply.github.com> Date: Thu, 4 May 2023 18:18:19 +0200 Subject: [PATCH] test(suite_onboarding): fix tests (#10260) #9285 --- .../src/drivers/elements/base_element.py | 1 - test/ui-test/src/screens/StatusLoginScreen.py | 3 +- .../src/screens/StatusWelcomeScreen.py | 69 ++++++++- .../global_shared/scripts/onboarding_names.py | 11 +- .../global_shared/scripts/settings_names.py | 3 - .../shared/steps/loginSteps.py | 5 +- .../suite_onboarding/shared/steps/steps.py | 12 +- .../tst_signUpNegativeCases/test.feature | 134 +++++++++--------- .../test.feature | 1 - .../tst_statusLoginPassword/test.feature | 1 - .../tst_statusSignUp/test.feature | 2 +- ui/main.qml | 1 + 12 files changed, 157 insertions(+), 86 deletions(-) diff --git a/test/ui-test/src/drivers/elements/base_element.py b/test/ui-test/src/drivers/elements/base_element.py index 6c285b9c38..1d2caacb4c 100644 --- a/test/ui-test/src/drivers/elements/base_element.py +++ b/test/ui-test/src/drivers/elements/base_element.py @@ -18,7 +18,6 @@ class BaseElement: @property def object(self): return squish.waitForObject(self.object_name) - @property def existent(self): diff --git a/test/ui-test/src/screens/StatusLoginScreen.py b/test/ui-test/src/screens/StatusLoginScreen.py index 15835edab4..c406362947 100755 --- a/test/ui-test/src/screens/StatusLoginScreen.py +++ b/test/ui-test/src/screens/StatusLoginScreen.py @@ -7,9 +7,9 @@ # * \date February 2022 # * \brief It defines the status login screen behavior and properties. # *****************************************************************************/ - from enum import Enum +import configs from drivers.SquishDriver import * from drivers.SquishDriverVerification import * from screens.StatusAccountsScreen import StatusAccountsScreen @@ -62,6 +62,7 @@ class StatusLoginScreen(): click_obj_by_name(SLoginComponents.SUBMIT_BTN.value) def verify_error_message_is_displayed(self): + SplashScreen().wait_until_appears().wait_until_hidden(configs.squish.APP_LOAD_TIMEOUT_MSEC) verify_object_enabled(SLoginComponents.ERR_MSG_LABEL.value) def get_accounts_selector_popup(self): diff --git a/test/ui-test/src/screens/StatusWelcomeScreen.py b/test/ui-test/src/screens/StatusWelcomeScreen.py index 9ed42f0a18..08e6d9b1ee 100644 --- a/test/ui-test/src/screens/StatusWelcomeScreen.py +++ b/test/ui-test/src/screens/StatusWelcomeScreen.py @@ -8,13 +8,68 @@ # * \brief Sign Up and Login for new users to the app. # *****************************************************************************/ -from array import array -from enum import Enum import sys +from abc import abstractmethod +from enum import Enum + +import common.Common as common +from common.SeedUtils import * from drivers.SquishDriver import * from drivers.SquishDriverVerification import * -from common.SeedUtils import * -import common.Common as common + + +class OnboardingBaseScreen(BaseElement): + + def __init__(self, object_name): + super(OnboardingBaseScreen, self).__init__(object_name) + self._back_button = Button('onboarding_back_button') + + @abstractmethod + def back(self): + pass + + +class CreatePasswordView(OnboardingBaseScreen): + + def __init__(self): + super(CreatePasswordView, self).__init__('mainWindow_CreatePasswordView') + self._new_password_text_field = TextEdit('onboarding_newPsw_Input') + self._confirm_password_text_field = TextEdit('onboarding_confirmPsw_Input') + self._create_button = Button('onboarding_create_password_button') + self._password_strength_indicator = BaseElement('onboarding_strengthInditactor') + + @property + def new_password(self) -> str: + return self._new_password_text_field.text + + @new_password.setter + def new_password(self, value: str): + self._new_password_text_field.text = value + + @property + def confirm_password(self) -> str: + return self._new_password_text_field.text + + @confirm_password.setter + def confirm_password(self, value: str): + self._new_password_text_field.text = value + + @property + def password_strength_indicator(self): + return self._password_strength_indicator.image + + def is_password_strength_indicator_equal(self, indicator : str): + verify_text_matching(self._password_strength_indicator.symbolic_name, indicator) + + def create_password(self, value: str): + self.new_password.text = value + self.confirm_password.text = value + self._create_button.click() + # TODO: return Confirm Password View + + def back(self): + self._back_button.click() + # TODO: return Details View class AgreementPopUp(Enum): @@ -23,6 +78,7 @@ class AgreementPopUp(Enum): TERMS_OF_USE_CHECK_BOX: str = "termsOfUseCheckBox_StatusCheckBox" GET_STARTED_BUTTON: str = "getStartedStatusButton_StatusButton" + class SignUpComponents(Enum): NEW_TO_STATUS: str = "mainWindow_I_am_new_to_Status_StatusBaseText" GENERATE_NEW_KEYS: str = "keysMainView_PrimaryAction_Button" @@ -44,6 +100,7 @@ class SignUpComponents(Enum): WELCOME_SCREEN_CHAT_KEY_TEXT: str = "mainWindow_WelcomeScreen_ChatKeyText" BACK_BTN: str = "onboarding_back_button" + class SeedPhraseComponents(Enum): IMPORT_A_SEED_TEXT: str = "import_a_seed_phrase_StatusBaseText" INVALID_SEED_TEXT: str = "onboarding_InvalidSeed_Text" @@ -54,6 +111,7 @@ class SeedPhraseComponents(Enum): SEEDS_WORDS_TEXTFIELD_template: str = "onboarding_SeedPhrase_Input_TextField_" SUBMIT_BUTTON: str = "seedPhraseView_Submit_Button" + class PasswordStrengthPossibilities(Enum): LOWER_VERY_WEAK = "lower_very_weak" UPPER_VERY_WEAK = "upper_very_weak" @@ -64,14 +122,17 @@ class PasswordStrengthPossibilities(Enum): NUMBERS_SYMBOLS_LOWER_UPPER_GOOD = "numbers_symbols_lower_upper_good" NUMBERS_SYMBOLS_LOWER_UPPER_GREAT = "numbers_symbols_lower_upper_great" + class MainScreen(Enum): SETTINGS_BUTTON = "settings_navbar_settings_icon_StatusIcon" + class LoginView(Enum): LOGIN_VIEW_USER_IMAGE: str = "loginView_userImage" PASSWORD_INPUT = "loginView_passwordInput" SUBMIT_BTN = "loginView_submitBtn" + class StatusWelcomeScreen: def __init__(self): diff --git a/test/ui-test/testSuites/global_shared/scripts/onboarding_names.py b/test/ui-test/testSuites/global_shared/scripts/onboarding_names.py index cd881d2f5d..6b79e3cf94 100644 --- a/test/ui-test/testSuites/global_shared/scripts/onboarding_names.py +++ b/test/ui-test/testSuites/global_shared/scripts/onboarding_names.py @@ -3,9 +3,14 @@ from scripts.global_names import * # Main: mainWindow_Welcome_to_Status_StyledText = {"container": statusDesktop_mainWindow, "text": "Welcome to Status", "type": "StyledText", "unnamed": 1, "visible": True} mainWindow_startupOnboarding_OnboardingLayout = {"container": statusDesktop_mainWindow, "objectName": "startupOnboardingLayout", "type": "OnboardingLayout", "visible": True} -onboarding_newPsw_Input = {"container": statusDesktop_mainWindow, "objectName": "passwordViewNewPassword", "type": "StatusPasswordInput", "visible": True} -onboarding_confirmPsw_Input = {"container": statusDesktop_mainWindow, "objectName": "passwordViewNewPasswordConfirm", "type": "StatusPasswordInput", "visible": True} -onboarding_create_password_button = {"container": statusDesktop_mainWindow, "objectName": "onboardingCreatePasswordButton", "type": "StatusButton"} + +# Create Password View +mainWindow_CreatePasswordView = {"container": statusDesktop_mainWindow, "type": "CreatePasswordView", "unnamed": 1, "visible": True} +onboarding_newPsw_Input = {"container": mainWindow_CreatePasswordView, "objectName": "passwordViewNewPassword", "type": "StatusPasswordInput", "visible": True} +onboarding_confirmPsw_Input = {"container": mainWindow_CreatePasswordView, "objectName": "passwordViewNewPasswordConfirm", "type": "StatusPasswordInput", "visible": True} +onboarding_create_password_button = {"container": mainWindow_CreatePasswordView, "objectName": "onboardingCreatePasswordButton", "type": "StatusButton"} +onboarding_strengthInditactor = {"container": mainWindow_CreatePasswordView, "type": "StatusPasswordStrengthIndicator", "unnamed": 1, "visible": True} + onboarding_confirmPswAgain_Input = {"container": statusDesktop_mainWindow, "objectName": "confirmAgainPasswordInput", "type": "StatusPasswordInput", "visible": True} onboarding_finalise_password_button = {"container": statusDesktop_mainWindow, "objectName": "confirmPswSubmitBtn", "type": "StatusButton"} acknowledge_checkbox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "acknowledgeCheckBox", "type": "StatusCheckBox", "visible": True} diff --git a/test/ui-test/testSuites/global_shared/scripts/settings_names.py b/test/ui-test/testSuites/global_shared/scripts/settings_names.py index 5d34e4ea0a..6a468f9fc4 100644 --- a/test/ui-test/testSuites/global_shared/scripts/settings_names.py +++ b/test/ui-test/testSuites/global_shared/scripts/settings_names.py @@ -55,7 +55,6 @@ communities_StatusNavigationListItem = {"container": mainWindow_ScrollView, "obj profile_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": SettingsSubsection.PROFILE.value, "type": "StatusNavigationListItem", "visible": True} messaging_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": SettingsSubsection.MESSAGING.value, "type": "StatusNavigationListItem", "visible": True} - # Profile Settings: mainWindow_MyProfileView = {"container": statusDesktop_mainWindow, "type": "MyProfileView", "unnamed": 1, "visible": True} displayName_StatusInput = {"container": statusDesktop_mainWindow, "objectName": "displayNameInput", "type": "StatusInput", "visible": True} @@ -86,7 +85,6 @@ add_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_ov linksView = {"container": statusDesktop_mainWindow, "id": "linksView", "type": "StatusListView", "unnamed": 1, "visible": True} edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} - # Wallet Settings: settings_Wallet_MainView_GeneratedAccounts = {"container": statusDesktop_mainWindow, "objectName":'generatedAccounts', "type": 'ListView'} settings_Wallet_AccountView_DeleteAccount = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "deleteAccountButton"} @@ -170,4 +168,3 @@ change_password_menu_new_password = {"container": statusDesktop_mainWindow_overl change_password_menu_new_password_confirm = {"container": statusDesktop_mainWindow_overlay, "objectName": "passwordViewNewPasswordConfirm", "type": "StatusPasswordInput", "visible": True} change_password_menu_submit_button = {"container": statusDesktop_mainWindow_overlay, "objectName": "changePasswordModalSubmitButton", "type": "StatusButton", "visible": True} change_password_success_menu_sign_out_quit_button = {"container": statusDesktop_mainWindow_overlay, "objectName": "changePasswordSuccessModalSignOutAndQuitButton", "type": "StatusButton", "visible": True} - diff --git a/test/ui-test/testSuites/suite_onboarding/shared/steps/loginSteps.py b/test/ui-test/testSuites/suite_onboarding/shared/steps/loginSteps.py index 33af0844cd..fad6d23baf 100644 --- a/test/ui-test/testSuites/suite_onboarding/shared/steps/loginSteps.py +++ b/test/ui-test/testSuites/suite_onboarding/shared/steps/loginSteps.py @@ -1,5 +1,8 @@ + +import configs from screens.StatusLoginScreen import StatusLoginScreen + _loginScreen = StatusLoginScreen() ######################### @@ -23,8 +26,6 @@ def step(context, username, password): @Then("the user is NOT able to login to Status Desktop application") def step(context): - _main_screen = StatusMainScreen() - _main_screen.wait_for_splash_animation_ends() _loginScreen.verify_error_message_is_displayed() ########################################################################### diff --git a/test/ui-test/testSuites/suite_onboarding/shared/steps/steps.py b/test/ui-test/testSuites/suite_onboarding/shared/steps/steps.py index 50593927d4..c34727d71a 100644 --- a/test/ui-test/testSuites/suite_onboarding/shared/steps/steps.py +++ b/test/ui-test/testSuites/suite_onboarding/shared/steps/steps.py @@ -1,6 +1,14 @@ -from screens.StatusWelcomeScreen import StatusWelcomeScreen +from pathlib import Path +import sys +from screens.StatusWelcomeScreen import CreatePasswordView + +_welcome_screen = CreatePasswordView() + + +@When('the user inputs the password \"|any|\"') +def step(context, password): + _welcome_screen.new_password = str(password) -_welcomeScreen = StatusWelcomeScreen() @Then("the password strength indicator is \"|any|\"") def step(context, strength): diff --git a/test/ui-test/testSuites/suite_onboarding/tst_signUpNegativeCases/test.feature b/test/ui-test/testSuites/suite_onboarding/tst_signUpNegativeCases/test.feature index 994c0bacca..f09fdf645a 100644 --- a/test/ui-test/testSuites/suite_onboarding/tst_signUpNegativeCases/test.feature +++ b/test/ui-test/testSuites/suite_onboarding/tst_signUpNegativeCases/test.feature @@ -1,86 +1,86 @@ Feature: Status Desktop Sign Up, negative cases - As a user I do not want to Sign-up with incorrect data into the Status Desktop application. + As a user I do not want to Sign-up with incorrect data into the Status Desktop application. - The following scenarios cover negative Sign up process scenarios when trying to do it with wrong data. + The following scenarios cover negative Sign up process scenarios when trying to do it with wrong data. - The feature start sequence is the following (setup on its own `bdd_hooks`): - ** given A first time user lands on the status desktop and generates new key + The feature start sequence is the following (setup on its own `bdd_hooks`): + ** given A first time user lands on the status desktop and generates new key - [Cleanup] - ** the user navigates to first onboarding page + [Cleanup] + ** the user navigates to first onboarding page - Scenario Outline: The user cannot sign up with wrong username format - Given the user clears input "onboarding_DiplayName_Input" - When the user inputs the following "" with ui-component "onboarding_DiplayName_Input" - Then the following ui-component "onboarding_DetailsView_NextButton" is not enabled + Scenario Outline: The user cannot sign up with wrong username format + Given the user clears input "onboarding_DiplayName_Input" + When the user inputs the following "" with ui-component "onboarding_DiplayName_Input" + Then the following ui-component "onboarding_DetailsView_NextButton" is not enabled - Examples: - | username | - | Athl | - | Gra | - | tester3@ | + Examples: + | username | + | Athl | + | Gra | + | tester3@ | - Scenario Outline: The user cannot sign up with wrong password format in both new password and confirmation input - Given the user inputs username "" - When the user inputs the following "" with ui-component "onboarding_newPsw_Input" - And the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" - Then the following ui-component "onboarding_create_password_button" is not enabled + Scenario Outline: The user cannot sign up with wrong password format in both new password and confirmation input + Given the user inputs username "" + When the user inputs the following "" with ui-component "onboarding_newPsw_Input" + And the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" + Then the following ui-component "onboarding_create_password_button" is not enabled - Examples: - | username | wrongpassword | - | tester124 | badP | + Examples: + | username | wrongpassword | + | tester124 | badP | - Scenario Outline: The user cannot sign up with right password format in new password input but incorrect in confirmation password input - Given the user inputs username "" - And the user inputs the following "" with ui-component "onboarding_newPsw_Input" - When the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" - Then the following ui-component "onboarding_create_password_button" is not enabled + Scenario Outline: The user cannot sign up with right password format in new password input but incorrect in confirmation password input + Given the user inputs username "" + And the user inputs the following "" with ui-component "onboarding_newPsw_Input" + When the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" + Then the following ui-component "onboarding_create_password_button" is not enabled - Examples: - | username | wrongpassword | password | - | tester124 | bad2!s | TesTEr16843/!@01 | + Examples: + | username | wrongpassword | password | + | tester124 | bad2!s | TesTEr16843/!@01 | - Scenario Outline: The user cannot sign up with incorrect confirmation-again password - Given the user inputs username "" - And the user inputs the following "" with ui-component "onboarding_newPsw_Input" - And the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" - And the user clicks on the following ui-component "onboarding_create_password_button" - When the user inputs the following "" with ui-component "onboarding_confirmPswAgain_Input" - Then the following ui-component "onboarding_finalise_password_button" is not enabled + Scenario Outline: The user cannot sign up with incorrect confirmation-again password + Given the user inputs username "" + And the user inputs the following "" with ui-component "onboarding_newPsw_Input" + And the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" + And the user clicks on the following ui-component "onboarding_create_password_button" + When the user inputs the following "" with ui-component "onboarding_confirmPswAgain_Input" + Then the following ui-component "onboarding_finalise_password_button" is not enabled - Examples: - | username | wrongpassword | password | - | tester123 | TesTEr16843/!@) | TesTEr16843/!@01 | + Examples: + | username | wrongpassword | password | + | tester123 | TesTEr16843/!@) | TesTEr16843/!@01 | - Scenario Outline: The user cannot finish Sign Up and Sign In process with wrong password format in both new password and confirmation input - Given the user inputs username "" - When the user inputs the following "" with ui-component "onboarding_newPsw_Input" - And the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" - Then the following ui-component "onboarding_create_password_button" is not enabled + Scenario Outline: The user cannot finish Sign Up and Sign In process with wrong password format in both new password and confirmation input + Given the user inputs username "" + When the user inputs the following "" with ui-component "onboarding_newPsw_Input" + And the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" + Then the following ui-component "onboarding_create_password_button" is not enabled - Examples: - | username | wrongpassword | - | tester123 | Invalid34 | + Examples: + | username | wrongpassword | + | tester123 | Invalid34 | - Scenario Outline: The user cannot finish Sign Up and Sign In process with right password format in new password input but incorrect in confirmation password input - Given the user inputs username "" - And the user inputs the following "" with ui-component "onboarding_newPsw_Input" - When the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" - Then the following ui-component "onboarding_create_password_button" is not enabled + Scenario Outline: The user cannot finish Sign Up and Sign In process with right password format in new password input but incorrect in confirmation password input + Given the user inputs username "" + And the user inputs the following "" with ui-component "onboarding_newPsw_Input" + When the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" + Then the following ui-component "onboarding_create_password_button" is not enabled - Examples: - | username | wrongpassword | password | - | tester123 | Invalid34 | TesTEr16843/!@00 | + Examples: + | username | wrongpassword | password | + | tester123 | Invalid34 | TesTEr16843/!@00 | - Scenario Outline: The user cannot finish Sign Up and Sign In process with incorrect confirmation-again password - Given the user inputs username "" - And the user inputs the following "" with ui-component "onboarding_newPsw_Input" - And the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" - And the user clicks on the following ui-component "onboarding_create_password_button" - When the user inputs the following "" with ui-component "onboarding_confirmPswAgain_Input" - Then the following ui-component "onboarding_finalise_password_button" is not enabled + Scenario Outline: The user cannot finish Sign Up and Sign In process with incorrect confirmation-again password + Given the user inputs username "" + And the user inputs the following "" with ui-component "onboarding_newPsw_Input" + And the user inputs the following "" with ui-component "onboarding_confirmPsw_Input" + And the user clicks on the following ui-component "onboarding_create_password_button" + When the user inputs the following "" with ui-component "onboarding_confirmPswAgain_Input" + Then the following ui-component "onboarding_finalise_password_button" is not enabled - Examples: - | username | wrongpassword | password | - | tester123 | Invalid34 | TesTEr16843/!@00 | + Examples: + | username | wrongpassword | password | + | tester123 | Invalid34 | TesTEr16843/!@00 | diff --git a/test/ui-test/testSuites/suite_onboarding/tst_signUpSeedPhraseNegativeCases/test.feature b/test/ui-test/testSuites/suite_onboarding/tst_signUpSeedPhraseNegativeCases/test.feature index 5296bd5e60..3bc2e9a901 100644 --- a/test/ui-test/testSuites/suite_onboarding/tst_signUpSeedPhraseNegativeCases/test.feature +++ b/test/ui-test/testSuites/suite_onboarding/tst_signUpSeedPhraseNegativeCases/test.feature @@ -6,7 +6,6 @@ Feature: Status Desktop Sign Up with seed phrase, negative cases The feature start sequence follows the global one (setup on global `bdd_hooks`): No additional steps - @mayfail Scenario: User signs up with wrong imported seed phrase Given A first time user lands on the status desktop and navigates to import seed phrase diff --git a/test/ui-test/testSuites/suite_onboarding/tst_statusLoginPassword/test.feature b/test/ui-test/testSuites/suite_onboarding/tst_statusLoginPassword/test.feature index ce260e0669..15edb34405 100644 --- a/test/ui-test/testSuites/suite_onboarding/tst_statusLoginPassword/test.feature +++ b/test/ui-test/testSuites/suite_onboarding/tst_statusLoginPassword/test.feature @@ -29,7 +29,6 @@ Feature: Status Desktop login | username | password | | Athletic_Prime | TesTEr16843/!@00 | - @mayfail Scenario Outline: User tries to login with an invalid password Given A first time user lands on the status desktop and generates new key And the user signs up with username "" and password "" diff --git a/test/ui-test/testSuites/suite_onboarding/tst_statusSignUp/test.feature b/test/ui-test/testSuites/suite_onboarding/tst_statusSignUp/test.feature index 6197b21d44..36630f0924 100644 --- a/test/ui-test/testSuites/suite_onboarding/tst_statusSignUp/test.feature +++ b/test/ui-test/testSuites/suite_onboarding/tst_statusSignUp/test.feature @@ -23,7 +23,6 @@ Feature: Status Desktop Sign Up Then the user lands on the signed in app And the user is online - @mayfail Scenario Outline: The user signs up with imported seed phrase and and its state is online Given A first time user lands on the status desktop and navigates to import seed phrase When the user inputs the seed phrase "" @@ -39,6 +38,7 @@ Feature: Status Desktop Sign Up | provide between target maze travel enroll edge churn random sight grass lion diet sugar cable fiction reflect reason gaze camp tone maximum task unlock | 0xCb59031d11D233112CB57DFd667fE1FF6Cd7b6Da | @mayfail + # https://github.com/status-im/status-desktop/issues/10069 Scenario: The user signs up with a profile image Given A first time user lands on the status desktop and generates new key And the user signs up with profileImage "doggo.jpeg", username "tester123" and password "TesTEr16843/!@00" diff --git a/ui/main.qml b/ui/main.qml index ab1e67875b..8ec78b52bf 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -153,6 +153,7 @@ StatusWindow { if(state === Constants.appState.startup) { // we're here only in case of error when we're returning from the app loading state loader.sourceComponent = undefined + appLoadingAnimation.active = false startupOnboarding.visible = true } else if(state === Constants.appState.appLoading) {