diff --git a/test/ui-test/src/drivers/SquishDriver.py b/test/ui-test/src/drivers/SquishDriver.py index f6737e6d88..91a3c4ea57 100755 --- a/test/ui-test/src/drivers/SquishDriver.py +++ b/test/ui-test/src/drivers/SquishDriver.py @@ -17,10 +17,15 @@ import names import test +# The default maximum timeout to find ui object _MAX_WAIT_OBJ_TIMEOUT = 5000 + +# The default minimum timeout to find ui object _MIN_WAIT_OBJ_TIMEOUT = 500 +# Waits for the given object is loaded, visible and enabled. +# It returns a tuple: True in case it is found. Otherwise, false. And the object itself. def is_loaded_visible_and_enabled(objName, timeout=_MAX_WAIT_OBJ_TIMEOUT): obj = None try: @@ -39,7 +44,8 @@ def verify_object_not_enabled(objName, timeout=_MIN_WAIT_OBJ_TIMEOUT): result = is_loaded_visible_and_enabled(objName, timeout) test.verify(result, False) - +# Waits for the given object is loaded and might be not visible and/or not enabled: +# It returns a tuple: True in case it is found. Otherwise, false. And the object itself. def is_loaded(objName): obj = None try: @@ -48,18 +54,18 @@ def is_loaded(objName): except LookupError: return False, obj - +# It checks if the given object is visible and enabled. def is_visible_and_enabled(obj): return obj.visible and obj.enabled - +# Given a specific object, get a specific child. def get_child(obj, child_index=None): if None == child_index: return object.children(obj) else: return object.children(obj)[child_index] - +# It executes the click action into the given object: def click_obj(obj): try: squish.mouseClick(obj, squish.Qt.LeftButton) @@ -67,7 +73,7 @@ def click_obj(obj): except LookupError: return False - +# It executes the click action into object with given object name: def click_obj_by_name(objName): try: obj = squish.waitForObject(getattr(names, objName)) @@ -94,7 +100,7 @@ def verify_text(objName, text): except LookupError: return False - +# It types the specified text into the given object (as if the user had used the keyboard): def type(objName, text): try: obj = squish.findObject(getattr(names, objName)) diff --git a/test/ui-test/src/screens/StatusWelcomeScreen.py b/test/ui-test/src/screens/StatusWelcomeScreen.py index 0d4b81066f..8548bcfdd3 100644 --- a/test/ui-test/src/screens/StatusWelcomeScreen.py +++ b/test/ui-test/src/screens/StatusWelcomeScreen.py @@ -1,6 +1,6 @@ -#****************************************************************************** +# ****************************************************************************** # Status.im -#*****************************************************************************/ +# *****************************************************************************/ # /** # * \file StatusWelcomeScreen.py # * @@ -33,32 +33,41 @@ class SignUpComponents(Enum): PASSWORD_PREFERENCE = "mainWindow_I_prefer_to_use_my_password_StatusBaseText" -class StatusWelcomeScreen(): - +class StatusWelcomeScreen: + def __init__(self): verify_screen_is_loaded(AgreementPopUp.ACKNOWLEDGE_CHECKBOX.value) - - def agree_terms_conditions_and_generate_new_key(self): + + def agree_terms_conditions_and_generate_new_key(self): click_obj_by_name(AgreementPopUp.ACKNOWLEDGE_CHECKBOX.value) check_obj_by_name(AgreementPopUp.TERMS_OF_USE_CHECK_BOX.value) click_obj_by_name(AgreementPopUp.GET_STARTED_BUTTON.value) click_obj_by_name(SignUpComponents.NEW_TO_STATUS.value) click_obj_by_name(SignUpComponents.GENERATE_NEW_KEYS.value) - + def input_username_and_password_and_finalize_sign_up(self, username, password): + self.input_username(username) + + self.input_password(password) + + self.input_confirmation_password(password) + + self.input_password_again(password) + + click_obj_by_name(SignUpComponents.PASSWORD_PREFERENCE.value) + + def input_username(self, username): type(SignUpComponents.USERNAME_INPUT.value, username) click_obj_by_name(SignUpComponents.NEXT_BUTTON.value) click_obj_by_name(SignUpComponents.NEXT_STATUS_BUTTON.value) - - click_obj_by_name(SignUpComponents.NEW_PASSWORD_BUTTON.value) + + def input_password(self, password): type(SignUpComponents.PASSWORD_INPUT.value, password) - click_obj_by_name(SignUpComponents.CONFIRM_PASSWORD.value) + + def input_confirmation_password(self, password): type(SignUpComponents.PASSWORD_CONFIRM_INPUT.value, password) click_obj_by_name(SignUpComponents.CREATE_PASSWORD.value) - - click_obj_by_name(SignUpComponents.CONFIRM_PASSWORD_AGAIN.value) + + def input_password_again(self, password): type(SignUpComponents.PASSWORD_INPUT.value, password) - click_obj_by_name(SignUpComponents.FINALIZE_PASSWORD_STEP.value) - click_obj_by_name(SignUpComponents.PASSWORD_PREFERENCE.value) - diff --git a/test/ui-test/testSuites/suite_status/shared/steps/signUpSteps.py b/test/ui-test/testSuites/suite_status/shared/steps/signUpSteps.py index b55bcb0ee9..c3302829e5 100644 --- a/test/ui-test/testSuites/suite_status/shared/steps/signUpSteps.py +++ b/test/ui-test/testSuites/suite_status/shared/steps/signUpSteps.py @@ -2,16 +2,22 @@ from screens.StatusWelcomeScreen import StatusWelcomeScreen from screens.StatusChatScreen import StatusChatScreen -welcomeScreen = StatusWelcomeScreen() +_welcomeScreen = StatusWelcomeScreen() @Given("A first time user lands on the status desktop and generates new key") def step(context): - welcomeScreen.agree_terms_conditions_and_generate_new_key() + _welcomeScreen.agree_terms_conditions_and_generate_new_key() @When("user inputs username |any| and password |any|") def step(context, username, password): - welcomeScreen.input_username_and_password_and_finalize_sign_up(username, password) + _welcomeScreen.input_username_and_password_and_finalize_sign_up(username, password) + + +@When("the user inputs username |any|") +def step(context, username): + _welcomeScreen.input_username(username) + @Then("the user lands on the signed in app") diff --git a/test/ui-test/testSuites/suite_status/shared/steps/steps.py b/test/ui-test/testSuites/suite_status/shared/steps/steps.py index ef29d6883f..7872bf8cf4 100644 --- a/test/ui-test/testSuites/suite_status/shared/steps/steps.py +++ b/test/ui-test/testSuites/suite_status/shared/steps/steps.py @@ -22,11 +22,16 @@ def step(context): startApplication("nim_status_client") -@When("user inputs the following |any| with object locator |any|") +@When("user inputs the following |any| with ui-component |any|") def step(context, text, obj): input_text(text, obj) + + +@When("user clicks on the following ui-component |any|") +def step(context, obj): + click_on_an_object(obj) -@Then("the following object locator |any| is not enabled") +@Then("the following ui-component |any| is not enabled") def step(context, obj): object_not_enabled(obj) diff --git a/test/ui-test/testSuites/suite_status/tst_statusLoginPassword/test.feature b/test/ui-test/testSuites/suite_status/tst_statusLoginPassword/test.feature index 8dbb218139..ee158b58ee 100644 --- a/test/ui-test/testSuites/suite_status/tst_statusLoginPassword/test.feature +++ b/test/ui-test/testSuites/suite_status/tst_statusLoginPassword/test.feature @@ -30,13 +30,16 @@ Feature: Status Desktop login | Granular_Diligent| TesTEr16843/!@22 | - #Scenario Outline: User tries to login with an invalid password + Scenario Outline: User tries to login with an invalid password - #Given A Status Desktop and - # When the user tries to login with invalid credentials - # Then the user is NOT able to login to Status Desktop application - #Examples: - # | account | password | - #| Athletic_Prime | Invalid34 | - #| Granular_Diligent | Testpwd | - #| Nervous_Pesky | WrongPSW | + Given A first time user lands on the status desktop and generates new key + When user inputs username and password + Given the application is restarted + Given A Status Desktop and + When the user tries to login with invalid credentials + Then the user is NOT able to login to Status Desktop application + Examples: + | account | password | wrongpassword | + | Athletic_Prime | TesTEr16843/!@00 | Invalid34 | + | Granular_Diligent | TesTEr16843/!@11 | Testpwd | + | Nervous_Pesky | TesTEr16843/!@22 | WrongPSW | diff --git a/test/ui-test/testSuites/suite_status/tst_statusSignUp/test.feature b/test/ui-test/testSuites/suite_status/tst_statusSignUp/test.feature index 4993f8b438..592f3ed2aa 100644 --- a/test/ui-test/testSuites/suite_status/tst_statusSignUp/test.feature +++ b/test/ui-test/testSuites/suite_status/tst_statusSignUp/test.feature @@ -11,28 +11,65 @@ Feature: Status Desktop Sign Up - As a user I want to Sign-up into the Status Desktop application. + As a user I want to Sign-up into the Status Desktop application. + The following scenarios cover Sign up process. - The following scenarios cover Sign up process. - - Scenario: User signs up and signs in with password - - Given A first time user lands on the status desktop and generates new key - When user inputs username tester123 and password TesTEr16843/!@00 - Then the user lands on the signed in app + Scenario: User signs up and signs in with password + Given A first time user lands on the status desktop and generates new key + When user inputs username tester123 and password TesTEr16843/!@00 + Then the user lands on the signed in app - Scenario Outline: User cannot sign up with wrong username format + Scenario Outline: User cannot sign up with wrong username format + Given A first time user lands on the status desktop and generates new key + When user inputs the following with ui-component mainWindow_edit_TextEdit + Then the following ui-component mainWindow_Next_StatusBaseText is not enabled - Given A first time user lands on the status desktop and generates new key - When user inputs the following with object locator mainWindow_edit_TextEdit - Then the following object locator mainWindow_Next_StatusBaseText is not enabled - - Examples: - | username | - | Athl | - | Nervo | - | Gra | - |tester3@ | + Examples: + | username | + | Athl | + | Nervo | + | Gra | + | tester3@ | + Scenario Outline: User cannot sign up with wrong password format + Given A first time user lands on the status desktop and generates new key + When the user inputs username + + # Input wrong password format in both new password and confirmation input and verify create password button is not enabled + When user inputs the following with ui-component loginView_passwordInput + And user inputs the following with ui-component mainWindow_inputValue_StyledTextField + Then the following ui-component mainWindow_Create_password_StatusBaseText is not enabled + + + # Input right password format in new password input but incorrect in confirmation password input and verify create password button is not enabled + When user inputs the following with ui-component loginView_passwordInput + And user inputs the following with ui-component mainWindow_inputValue_StyledTextField + Then the following ui-component mainWindow_Create_password_StatusBaseText is not enabled + + Examples: + | username | wrongpassword | password | + | tester123 | Invalid34 | TesTEr16843/!@00 | + | tester124 | badP | TesTEr16843/!@01 | + | tester124 | bad2!s | TesTEr16843/!@01 | + + + Scenario Outline: User cannot finish Sign Up and Sign In process with wrong password + Given A first time user lands on the status desktop and generates new key + When the user inputs username + + # Input correct password format in both new password and confirmation input + When user inputs the following with ui-component loginView_passwordInput + And user inputs the following with ui-component mainWindow_inputValue_StyledTextField + And user clicks on the following ui-component mainWindow_Create_password_StatusBaseText + + # Input wrong password in final password input and verify password creation button is not enabled + When user inputs the following with ui-component loginView_passwordInput + Then the following ui-component mainWindow_Finalise_Status_Password_Creation_StatusBaseText is not enabled + + Examples: + | username | wrongpassword | password | + | tester123 | Invalid34 | TesTEr16843/!@00 | + | tester123 | TesTEr16843/!@) | TesTEr16843/!@01 | +