feat(@DesktopApp): SignUp Scenario (Squish Test)
Ticket: https://github.com/status-im/status-desktop/issues/5718 Include script to erase data file before each test
This commit is contained in:
parent
314327f479
commit
edc48d2168
|
@ -1,12 +1,15 @@
|
|||
|
||||
from drivers.SquishDriver import *
|
||||
|
||||
|
||||
class Common:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
def click_on_an_object(obj):
|
||||
click_obj_by_name(obj)
|
||||
|
||||
def click_on_an_object(self, obj):
|
||||
click_obj_by_name(obj)
|
||||
|
||||
def input_text(self, obj, text):
|
||||
type(obj, text)
|
||||
def input_text(text, obj):
|
||||
type(obj, text)
|
||||
|
||||
|
||||
def object_not_enabled(obj):
|
||||
verify_object_not_enabled(obj)
|
||||
|
|
|
@ -18,6 +18,7 @@ import test
|
|||
|
||||
|
||||
_MAX_WAIT_OBJ_TIMEOUT = 5000
|
||||
_MIN_WAIT_OBJ_TIMEOUT = 500
|
||||
|
||||
|
||||
def is_loaded_visible_and_enabled(objName, timeout=_MAX_WAIT_OBJ_TIMEOUT):
|
||||
|
@ -32,6 +33,11 @@ def is_loaded_visible_and_enabled(objName, timeout=_MAX_WAIT_OBJ_TIMEOUT):
|
|||
def verify_screen_is_loaded(objName, timeout=_MAX_WAIT_OBJ_TIMEOUT):
|
||||
result = is_loaded_visible_and_enabled(objName, timeout)
|
||||
test.verify(result, True)
|
||||
|
||||
|
||||
def verify_object_not_enabled(objName, timeout=_MIN_WAIT_OBJ_TIMEOUT):
|
||||
result = is_loaded_visible_and_enabled(objName, timeout)
|
||||
test.verify(result, False)
|
||||
|
||||
|
||||
def is_loaded(objName):
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
from data.StatusAccount import StatusAccount
|
||||
from processes.StatusLoginProcess import StatusLoginProcess
|
||||
|
||||
|
||||
|
||||
@Given("A Status Desktop |any| and |any|")
|
||||
def step(context, account, password):
|
||||
|
||||
# Create new data domain:
|
||||
accountObj = StatusAccount(account, password)
|
||||
|
||||
# Create new process:
|
||||
process = StatusLoginProcess(accountObj)
|
||||
|
||||
# Set needed context properties:
|
||||
context.userData['process'] = process
|
||||
context.userData['account'] = accountObj
|
||||
|
||||
# Verify process can be executed:
|
||||
test.verify(process.can_execute_process(), "Not possible to start login process. Check if expected Login Screen is available.")
|
||||
|
||||
|
||||
@When("the user tries to login with valid credentials")
|
||||
def step(context):
|
||||
loginProcess = context.userData['process']
|
||||
|
||||
# Check valid process behavior:
|
||||
loginProcess.execute_process(True)
|
||||
|
||||
|
||||
@When("the user tries to login with invalid credentials")
|
||||
def step(context):
|
||||
loginProcess = context.userData['process']
|
||||
|
||||
# Check invalid process behavior:
|
||||
loginProcess.execute_process(False)
|
||||
|
||||
|
||||
@Then("the user is able to login to Status Desktop application")
|
||||
def step(context):
|
||||
get_process_result(context)
|
||||
|
||||
|
||||
@Then("the user is NOT able to login to Status Desktop application")
|
||||
def step(context):
|
||||
get_process_result(context)
|
||||
|
||||
|
||||
# Common:
|
||||
def get_process_result(context):
|
||||
loginProcess = context.userData['process']
|
||||
result, description = loginProcess.get_process_result()
|
||||
test.verify(result, description)
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
from screens.StatusWelcomeScreen import StatusWelcomeScreen
|
||||
from screens.StatusChatScreen import StatusChatScreen
|
||||
|
||||
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()
|
||||
|
||||
|
||||
@When("user inputs username |any| and password |any|")
|
||||
def step(context, username, password):
|
||||
welcomeScreen.input_username_and_password_and_finalize_sign_up(username, password)
|
||||
|
||||
|
||||
@Then("the user lands on the signed in app")
|
||||
def step(context):
|
||||
StatusChatScreen()
|
|
@ -0,0 +1,32 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
#******************************************************************************
|
||||
# Status.im
|
||||
#*****************************************************************************/
|
||||
# /**
|
||||
# * \file steps.py
|
||||
# *
|
||||
# * \test Status Desktop - Login
|
||||
# * \date February 2022
|
||||
# * \brief This file contains snippets of script code to be executed as the .feature
|
||||
# * file is processed.
|
||||
# * The decorators Given/When/Then/Step can be used to associate a script snippet
|
||||
# * with a pattern which is matched against the steps being executed.
|
||||
# *****************************************************************************
|
||||
from common.Common import *
|
||||
|
||||
|
||||
@Given("the application is restarted")
|
||||
def step(context):
|
||||
currentApplicationContext().detach()
|
||||
startApplication("nim_status_client")
|
||||
|
||||
|
||||
@When("user inputs the following |any| with object locator |any|")
|
||||
def step(context, text, obj):
|
||||
input_text(text, obj)
|
||||
|
||||
|
||||
@Then("the following object locator |any| is not enabled")
|
||||
def step(context, obj):
|
||||
object_not_enabled(obj)
|
|
@ -0,0 +1,42 @@
|
|||
#******************************************************************************
|
||||
# Status.im
|
||||
#*****************************************************************************/
|
||||
#/**
|
||||
# * \file test.feature
|
||||
# *
|
||||
# * \test Status Desktop - Login
|
||||
# * \date February 2022
|
||||
# **
|
||||
# *****************************************************************************/
|
||||
|
||||
Feature: Status Desktop login
|
||||
|
||||
As a user I want to login into the Status Desktop application.
|
||||
|
||||
The following scenarios cover login by using a password.
|
||||
|
||||
Scenario Outline: User tries to login with a valid password
|
||||
|
||||
Given A first time user lands on the status desktop and generates new key
|
||||
When user inputs username <account> and password <password>
|
||||
Given the application is restarted
|
||||
Given A Status Desktop <account> and <password>
|
||||
When the user tries to login with valid credentials
|
||||
Then the user is able to login to Status Desktop application
|
||||
Examples:
|
||||
| account | password |
|
||||
| Athletic_Prime | TesTEr16843/!@00 |
|
||||
| Nervous_Pesky | TesTEr16843/!@11 |
|
||||
| Granular_Diligent| TesTEr16843/!@22 |
|
||||
|
||||
|
||||
#Scenario Outline: User tries to login with an invalid password
|
||||
|
||||
#Given A Status Desktop <account> and <password>
|
||||
# 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 |
|
|
@ -1,7 +1,7 @@
|
|||
source(findFile('scripts', 'python/bdd.py'))
|
||||
|
||||
setupHooks('../shared/scripts/bdd_hooks.py')
|
||||
collectStepDefinitions('./steps', '../shared/steps')
|
||||
collectStepDefinitions('./steps', '../shared/steps', '../shared/loginSteps', '../shared/signUpSteps')
|
||||
|
||||
def main():
|
||||
testSettings.throwOnFailure = True
|
|
@ -15,9 +15,24 @@ Feature: Status Desktop Sign Up
|
|||
|
||||
The following scenarios cover Sign up process.
|
||||
|
||||
Scenario: User signs up with password
|
||||
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
|
||||
|
||||
Given A first time user lands on the status desktop and generates new key
|
||||
When user inputs the following <username> with object locator mainWindow_edit_TextEdit
|
||||
Then the following object locator mainWindow_Next_StatusBaseText is not enabled
|
||||
|
||||
Examples:
|
||||
| username |
|
||||
| Athl |
|
||||
| Nervo |
|
||||
| Gra |
|
||||
|tester3@ |
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
source(findFile('scripts', 'python/bdd.py'))
|
||||
|
||||
setupHooks('../shared/scripts/bdd_hooks.py')
|
||||
collectStepDefinitions('./steps', '../shared/steps')
|
||||
collectStepDefinitions('./steps', '../shared/steps', '../shared/signUpSteps')
|
||||
|
||||
def main():
|
||||
testSettings.throwOnFailure = True
|
|
@ -1,87 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
#******************************************************************************
|
||||
# Status.im
|
||||
#*****************************************************************************/
|
||||
# /**
|
||||
# * \file steps.py
|
||||
# *
|
||||
# * \test Status Desktop - Login
|
||||
# * \date February 2022
|
||||
# * \brief This file contains snippets of script code to be executed as the .feature
|
||||
# * file is processed.
|
||||
# * The decorators Given/When/Then/Step can be used to associate a script snippet
|
||||
# * with a pattern which is matched against the steps being executed.
|
||||
# *****************************************************************************
|
||||
from data.StatusAccount import StatusAccount
|
||||
from processes.StatusLoginProcess import StatusLoginProcess
|
||||
from screens.StatusWelcomeScreen import StatusWelcomeScreen
|
||||
from screens.StatusChatScreen import StatusChatScreen
|
||||
|
||||
welcomeScreen = StatusWelcomeScreen()
|
||||
|
||||
|
||||
@Given("A Status Desktop |any| and |word|")
|
||||
def step(context, account, password):
|
||||
|
||||
# Create new data domain:
|
||||
accountObj = StatusAccount(account, password)
|
||||
|
||||
# Create new process:
|
||||
process = StatusLoginProcess(accountObj)
|
||||
|
||||
# Set needed context properties:
|
||||
context.userData['process'] = process
|
||||
context.userData['account'] = accountObj
|
||||
|
||||
# Verify process can be executed:
|
||||
test.verify(process.can_execute_process(), "Not possible to start login process. Check if expected Login Screen is available.")
|
||||
|
||||
|
||||
@When("the user tries to login with valid credentials")
|
||||
def step(context):
|
||||
loginProcess = context.userData['process']
|
||||
|
||||
# Check valid process behavior:
|
||||
loginProcess.execute_process(True)
|
||||
|
||||
|
||||
@When("the user tries to login with invalid credentials")
|
||||
def step(context):
|
||||
loginProcess = context.userData['process']
|
||||
|
||||
# Check invalid process behavior:
|
||||
loginProcess.execute_process(False)
|
||||
|
||||
|
||||
@Then("the user is able to login to Status Desktop application")
|
||||
def step(context):
|
||||
get_process_result(context)
|
||||
|
||||
|
||||
@Then("the user is NOT able to login to Status Desktop application")
|
||||
def step(context):
|
||||
get_process_result(context)
|
||||
|
||||
|
||||
@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()
|
||||
|
||||
|
||||
@When("user inputs username |any| and password |any|")
|
||||
def step(context, username, password):
|
||||
welcomeScreen.input_username_and_password_and_finalize_sign_up(username, password)
|
||||
|
||||
|
||||
@Then("the user lands on the signed in app")
|
||||
def step(context):
|
||||
StatusChatScreen()
|
||||
|
||||
|
||||
# Common:
|
||||
def get_process_result(context):
|
||||
loginProcess = context.userData['process']
|
||||
result, description = loginProcess.get_process_result()
|
||||
test.verify(result, description)
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
#******************************************************************************
|
||||
# Status.im
|
||||
#*****************************************************************************/
|
||||
#/**
|
||||
# * \file test.feature
|
||||
# *
|
||||
# * \test Status Desktop - Login
|
||||
# * \date February 2022
|
||||
# **
|
||||
# *****************************************************************************/
|
||||
|
||||
Feature: Status Desktop login
|
||||
|
||||
As a user I want to login into the Status Desktop application.
|
||||
|
||||
The following scenarios cover login by using a password.
|
||||
|
||||
Scenario Outline: User tries to login with a valid password
|
||||
|
||||
Given A Status Desktop <account> and <password>
|
||||
When the user tries to login with valid credentials
|
||||
Then the user is able to login to Status Desktop application
|
||||
Examples:
|
||||
| account | password |
|
||||
| Athletic_Prime | Test_1234 |
|
||||
| Nervous_Pesky | Test_1234 |
|
||||
| Granular_Diligent| Test_1234 |
|
||||
|
||||
|
||||
Scenario Outline: User tries to login with an invalid password
|
||||
|
||||
Given A Status Desktop <account> and <password>
|
||||
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 |
|
Loading…
Reference in New Issue