test(onboarding): Screenshot based testing POC, validating password strength

- Added new test case `tst_passwordStrength` in `suite_onboarding` that uses squish screenshot validation.
- Added verification points (mac OS) for some password strength validations, using pixel comparison and some minor percentage of failure / color precision allowed.

Closes #7003
This commit is contained in:
Noelia 2022-08-22 13:35:58 +02:00 committed by Noelia
parent fcfcafaac0
commit 10f34d0610
16 changed files with 185 additions and 1 deletions

View File

@ -97,3 +97,6 @@ def verify_failure(errorMsg: str):
def log(text: str):
test.log(text)
def verify_screenshot(vp: str):
test.vp(vp)

View File

@ -47,6 +47,16 @@ class SeedPhraseComponents(Enum):
TWENTY_FOUR_BUTTON: str = "switchTabBar_24_words_Button"
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"
NUMBERS_VERY_WEAK = "numbers_very_weak"
SYMBOLS_VERY_WEAK = "symbols_very_weak"
NUMBERS_SYMBOLS_WEAK ="numbers_symbols_weak"
NUMBERS_SYMBOLS_LOWER_SOSO = "numbers_symbols_lower_so-so"
NUMBERS_SYMBOLS_LOWER_UPPER_GOOD = "numbers_symbols_lower_upper_good"
NUMBERS_SYMBOLS_LOWER_UPPER_GREAT = "numbers_symbols_lower_upper_great"
class StatusWelcomeScreen:
@ -114,3 +124,32 @@ class StatusWelcomeScreen:
def seed_phrase_visible(self):
is_loaded_visible_and_enabled(SeedPhraseComponents.INVALID_SEED_TEXT.value)
# The following validation is based in screenshots comparison and is OS dependent:
def validate_password_strength(self, strength: str):
if sys.platform == "darwin":
if strength == PasswordStrengthPossibilities.LOWER_VERY_WEAK.value:
verify_screenshot("VP-PWStrength-lower_very_weak")
elif strength == PasswordStrengthPossibilities.UPPER_VERY_WEAK.value:
verify_screenshot("VP-PWStrength-upper_very_weak")
elif strength == PasswordStrengthPossibilities.NUMBERS_VERY_WEAK.value:
verify_screenshot("VP-PWStrength-numbers_very_weak")
elif strength == PasswordStrengthPossibilities.SYMBOLS_VERY_WEAK.value:
verify_screenshot("VP-PWStrength-symbols_very_weak")
elif strength == PasswordStrengthPossibilities.NUMBERS_SYMBOLS_WEAK.value:
verify_screenshot("VP-PWStrength-numbers_symbols_weak")
elif strength == PasswordStrengthPossibilities.NUMBERS_SYMBOLS_LOWER_SOSO.value:
verify_screenshot("VP-PWStrength-numbers_symbols_lower_so-so")
elif strength == PasswordStrengthPossibilities.NUMBERS_SYMBOLS_LOWER_UPPER_GOOD.value:
verify_screenshot("VP-PWStrength-numbers_symbols_lower_upper_good")
elif strength == PasswordStrengthPossibilities.NUMBERS_SYMBOLS_LOWER_UPPER_GREAT.value:
verify_screenshot("VP-PWStrength-numbers_symbols_lower_upper_great")
# TODO: Get screenshots in Linux

View File

@ -2,6 +2,7 @@ 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, "text": "New password", "type": "PlaceholderText"}
onboarding_confirmPsw_Input = {"container": statusDesktop_mainWindow, "text": "Confirm password", "type": "PlaceholderText"}
onboarding_create_password_button = {"container": statusDesktop_mainWindow, "objectName": "onboardingCreatePasswordButton", "type": "StatusButton"}

View File

@ -0,0 +1,7 @@
from screens.StatusWelcomeScreen import StatusWelcomeScreen
_welcomeScreen = StatusWelcomeScreen()
@Then("the password strength indicator is |any|")
def step(context, strength):
_welcomeScreen.validate_password_strength(strength)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
AUT=nim_status_client
LANGUAGE=Python
OBJECTMAPSTYLE=script
TEST_CASES=tst_statusSignUp
TEST_CASES=tst_statusSignUp tst_passwordStrength
VERSION=3
WRAPPERS=Qt

View File

@ -0,0 +1,29 @@
#******************************************************************************
# Status.im
#*****************************************************************************/
#/**
# * \file test.feature
# *
# * \test Status Sign up
# * \date August 2022
# **
# *****************************************************************************/
Feature: Password strength validation including UI pixel-perfect validation
Scenario Outline: As a user I want to see the strength of the password
Given A first time user lands on the status desktop and generates new key
When the user inputs username <username>
When user inputs the following <password> with ui-component onboarding_newPsw_Input
Then the password strength indicator is <strength>
Examples:
| username | password | strength |
| tester123 | abc | lower_very_weak |
| tester124 | ABC | upper_very_weak |
| tester124 | 123 | numbers_very_weak |
| tester124 | +_! | symbols_very_weak |
| tester124 | +1_3!48 | numbers_symbols_weak |
| tester124 | +1_3!48a | numbers_symbols_lower_so-so |
| tester124 | +1_3!48aT | numbers_symbols_lower_upper_good |
| tester124 | +1_3!48aTq | numbers_symbols_lower_upper_great |

View File

@ -0,0 +1,8 @@
source(findFile('scripts', 'python/bdd.py'))
setupHooks('../../global_shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/')
def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')

View File

@ -289,6 +289,7 @@ StatusWindow {
OnboardingLayout {
id: startupOnboarding
objectName: "startupOnboardingLayout"
anchors.fill: parent
}