chore(@e2e_tests): fix imports and split the tests to feature files

This commit is contained in:
Anastasiya Semiankevich 2023-06-07 15:19:04 +03:00 committed by Anastasiya Semenkevich
parent bf84d2503f
commit e2b3376f66
19 changed files with 108 additions and 30 deletions

View File

@ -104,11 +104,11 @@ def step(context: any, account_name: str, password: str):
_statusMain.open_settings() _statusMain.open_settings()
_settingsScreen.delete_account(account_name, password) _settingsScreen.delete_account(account_name, password)
@When("the user selects the default account") @When("the user selects the default Status account")
def step(context: any): def step(context: any):
_settingsScreen.select_default_account() _settingsScreen.select_default_account()
@When("the user edits default account to \"|any|\" name and \"|any|\" color") @When("the user edits default Status account to \"|any|\" name and \"|any|\" color")
def step(context: any, account_name: str, account_color: str): def step(context: any, account_name: str, account_color: str):
_settingsScreen.edit_account(account_name, account_color) _settingsScreen.edit_account(account_name, account_color)

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.commonInitSteps as init_steps
# This file contains hook functions to run as the .feature file is executed.
#
# A common use-case is to use the OnScenarioStart/OnScenarioEnd hooks to
# start and stop an AUT, e.g.
#
# @OnScenarioStart
# def hook(context):
# startApplication("addressbook")
#
# @OnScenarioEnd
# def hook(context):
# currentApplicationContext().detach()
#
# For the complete reference to this and similar available APIs
# (OnFeatureStart/OnFeatureEnd, OnStepStart/OnStepEnd) see the section
# 'Performing Actions During Test Execution Via Hooks' in the Squish manual:
#
# https://doc.qt.io/squish/behavior-driven-testing.html#performing-actions-during-test-execution-via-hooks
# Detach (i.e. potentially terminate) all AUTs at the end of a scenario
@OnScenarioEnd
def hook(context):
init_steps.driver.detach()

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# A quick introduction to implementing scripts for BDD tests:
#
# This file contains snippets of script code to be executed as the .feature
# file is processed. See the section 'Behaviour Driven Testing' in the 'API
# Reference Manual' chapter of the Squish manual for a comprehensive reference.
#
# 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. Optional
# table/multi-line string arguments of the step are passed via a mandatory
# 'context' parameter:
#
# @When("I enter the text")
# def whenTextEntered(context):
# <code here>
#
# The pattern is a plain string without the leading keyword, but a couple of
# placeholders including |any|, |word| and |integer| are supported which can be
# used to extract arbitrary, alphanumeric and integer values resp. from the
# pattern; the extracted values are passed as additional arguments:
#
# @Then("I get |integer| different names")
# def namesReceived(context, numNames):
# <code here>
#
# Instead of using a string with placeholders, a regular expression can be
# specified. In that case, make sure to set the (optional) 'regexp' argument
# to True.
import names

View File

@ -4,6 +4,6 @@ HOOK_SUB_PROCESSES=true
IMPLICITAUTSTART=0 IMPLICITAUTSTART=0
LANGUAGE=Python LANGUAGE=Python
OBJECTMAPSTYLE=script OBJECTMAPSTYLE=script
TEST_CASES=tst_wallet tst_transaction tst_wallet_section_accounts_management TEST_CASES=tst_wallet_savedAddresses tst_wallet_transactions tst_wallet_accountsManagement tst_wallet_settingsManagement
VERSION=3 VERSION=3
WRAPPERS=Qt WRAPPERS=Qt

View File

@ -1,7 +1,8 @@
source(findFile('scripts', 'python/bdd.py')) source(findFile('scripts', 'python/bdd.py'))
setupHooks('bdd_hooks.py') setupHooks('../../global_shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/') collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/',
'../../suite_onboarding/shared/steps/', '../../suite_wallet/steps/')
import configs import configs

View File

@ -1,8 +1,6 @@
Feature: Status Desktop Wallet Feature: Wallet -> Saved addresses Management
As a user I want to use the wallet
The feature start sequence is the following (setup on its own `bdd_hooks`):
Background: Background:
Given A first time user lands on the status desktop and generates new key Given A first time user lands on the status desktop and generates new key
And the user signs up with username "tester123" and password "TesTEr16843/!@00" And the user signs up with username "tester123" and password "TesTEr16843/!@00"
@ -10,21 +8,14 @@ Background:
And the user opens the wallet section And the user opens the wallet section
And the user accepts the signing phrase And the user accepts the signing phrase
#############################################
# WALLET SECTION PART
#############################################
Scenario Outline: The user can manage a saved address Scenario Outline: The user can manage a saved address
When the user adds a saved address named "<name>" and address "<address>" When the user adds a saved address named "<name>" and address "<address>"
And the user edits a saved address with name "<name>" to "<new_name>" And the user edits a saved address with name "<name>" to "<new_name>"
Then the name "<new_name>" is in the list of saved addresses Then the name "<new_name>" is in the list of saved addresses
When the user deletes the saved address with name "<new_name>" When the user deletes the saved address with name "<new_name>"
Then the name "<new_name>" is not in the list of saved addresses Then the name "<new_name>" is not in the list of saved addresses
When the user adds a saved address named "<name>" and ENS name "<ens_name>" When the user adds a saved address named "<name>" and ENS name "<ens_name>"
Then the name "<name>" is in the list of saved addresses Then the name "<name>" is in the list of saved addresses
# Test for toggling favourite button is disabled until favourite functionality is enabled # Test for toggling favourite button is disabled until favourite functionality is enabled
# When the user adds a saved address named "<name>" and address "<address>" # When the user adds a saved address named "<name>" and address "<address>"
# And the user toggles favourite for the saved address with name "<name>" # And the user toggles favourite for the saved address with name "<name>"
@ -32,15 +23,8 @@ Background:
Examples: Examples:
| name | address | new_name | ens_name | | name | address | new_name | ens_name |
| bar | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | foo | status.eth | | bar | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | foo | status.eth |
# TODO: add saved address with all the networks
# TODO: actions from burger menu
############################################# # TODO: split the scenario above to several (exlude delete i think)
# WALLET SETTINGS PART # TODO: enhance edit actions to change networks
############################################# # TODO: test for Share button
Scenario: The user edits the default account
Given the user opens app settings screen
And the user opens the wallet settings
When the user selects the default account
And the user edits default account to "Default" name and "#f6af3c" color
Then the default account is updated to be named "DefaultStatus account" with color "#f6af3c"

View File

@ -0,0 +1,16 @@
Feature: Settings -> Wallet
Background:
Given A first time user lands on the status desktop and generates new key
And the user signs up with username "tester123" and password "TesTEr16843/!@00"
And the user lands on the signed in app
And the user opens the wallet section
And the user accepts the signing phrase
Scenario: The user edits the default account
Given the user opens app settings screen
And the user opens the wallet settings
When the user selects the default Status account
And the user edits default Status account to "Default" name and "#f6af3c" color
Then the default account is updated to be named "DefaultStatus account" with color "#f6af3c"

View File

@ -1,7 +1,8 @@
source(findFile('scripts', 'python/bdd.py')) source(findFile('scripts', 'python/bdd.py'))
setupHooks('bdd_hooks.py') setupHooks('../../global_shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/', '../../suite_onboarding/shared/steps/') collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/',
'../../suite_onboarding/shared/steps/', '../../suite_wallet/steps/')
import configs import configs
@ -10,4 +11,4 @@ def main():
testSettings.throwOnFailure = True testSettings.throwOnFailure = True
configs.path.TMP.mkdir(parents=True, exist_ok=True) configs.path.TMP.mkdir(parents=True, exist_ok=True)
runFeatureFile('test.feature') runFeatureFile('test.feature')
configs.path.TMP.rmtree(ignore_errors=True) configs.path.TMP.rmtree(ignore_errors=True)

View File

@ -0,0 +1,14 @@
source(findFile('scripts', 'python/bdd.py'))
setupHooks('../../global_shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/',
'../../suite_onboarding/shared/steps/', '../../suite_wallet/steps/')
import configs
def main():
testSettings.throwOnFailure = True
configs.path.TMP.mkdir(parents=True, exist_ok=True)
runFeatureFile('test.feature')
configs.path.TMP.rmtree(ignore_errors=True)