feat: add more screenshot test

This commit is contained in:
Anthony Laibe 2022-09-02 13:49:01 +02:00
parent 4026d3c60d
commit 4fdede8cb6
21 changed files with 163232 additions and 44142 deletions

View File

@ -3,6 +3,7 @@ import squish
from remotesystem import RemoteSystem
import time
import platform
from scripts.global_names import mainWindow_RighPanel
from typing import Dict, Any
# The default maximum timeout to find ui object
@ -106,14 +107,15 @@ def log(text: str):
test.log(text)
def verify_or_create_screenshot(vp: str, obj: Dict[str, Any]):
def verify_or_create_screenshot(vp: str, obj_name: Dict[str, Any] = mainWindow_RighPanel):
try:
test.vpWithObject(vp, obj)
test.vpWithObject(vp, obj_name)
except RuntimeError:
squish.createVisualVP(obj, vp)
squish.createVisualVP(obj_name, vp)
except squish.SquishVerificationFailedException:
raise
def verify_screenshot(vp: str):
test.vp(vp)

View File

@ -217,7 +217,7 @@ class SettingsScreen:
accountName = get_obj(WalletSettingsScreen.ACCOUNT_VIEW_ACCOUNT_NAME.value)
iconSettings = get_obj(WalletSettingsScreen.ACCOUNT_VIEW_ICON_SETTINGS.value)
verify_values_equal(str(accountName.text), str(new_name), "Edited account name not updated")
verify_values_equal(str(iconSettings.icon.color.name), str(new_color.lower()), "Edited account color not updated")
verify_values_equal(str(iconSettings.asset.color.name), str(new_color.lower()), "Edited account color not updated")
def open_communities_section(self):
click_obj_by_name(SidebarComponents.COMMUNITIES_OPTION.value)

View File

@ -76,7 +76,7 @@ class StatusWalletScreen:
def accept_signing_phrase(self):
click_obj_by_name(SigningPhrasePopUp.OK_GOT_IT_BUTTON.value)
def add_watch_only_account(self, account_name: str, address: str):
def add_watch_only_account(self, context, account_name: str, address: str):
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
type(AddAccountPopup.ACCOUNT_NAME_INPUT.value, account_name)
@ -87,6 +87,7 @@ class StatusWalletScreen:
click_obj_by_name(AddAccountPopup.TYPE_WATCH_ONLY.value)
type(AddAccountPopup.ADDRESS_INPUT.value, address)
verify_or_create_screenshot(context.userData["vp_base_path"] + "_popup")
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
def import_private_key(self, account_name: str, password: str, private_key: str):

View File

@ -42,6 +42,6 @@ def hook(context):
snooze(_app_closure_timeout)
@OnStepEnd
@OnStepStart
def hook(context):
context.userData["step_name"] = context._data["text"]

View File

@ -7,12 +7,13 @@ from .global_names import mainWindow_RighPanel
def verify_screenshot(func, obj: Dict[str, Any] = mainWindow_RighPanel):
def inner(*args, **kwargs):
context = args[0]
func(*args, **kwargs)
scenario = context.userData["scenario_name"].lower().replace(" ", "_")
step = context.userData["step_name"].lower().replace(" ", "_")
filename = f"{step}_{'_'.join(args[1:])}"
path = os.path.join(scenario, filename)
context.userData["vp_base_path"] = path
func(*args, **kwargs)
verifier.verify_or_create_screenshot(path, obj)
return inner

View File

@ -15,7 +15,7 @@ def step(context):
@When("the user adds watch only account with |any| and |any|")
@verify_screenshot
def step(context, account_name, address):
_walletScreen.add_watch_only_account(account_name, address)
_walletScreen.add_watch_only_account(context, account_name, address)
@When("the user generates a new account with |any| and |any|")
def step(context, account_name, password):
@ -34,6 +34,7 @@ def step(context, account_name, amount, token, chain_name, password):
_walletScreen.send_transaction(account_name, amount, token, chain_name, password)
@When("the user adds a saved address named |any| and address |any|")
@verify_screenshot
def step(context, name, address):
_walletScreen.add_saved_address(name, address)
@ -46,6 +47,7 @@ def step(context, name):
_walletScreen.delete_saved_address(name)
@When("the user toggles the network |any|")
@verify_screenshot
def step(context, network_name):
_walletScreen.toggle_network(network_name)

View File

@ -17,8 +17,7 @@ Feature: Status Desktop Wallet
Examples:
| account_name | address |
| one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
| two | 0xf51ba8631618b9b3521ff4eb9adfd8a837455226 |
| two | 0xf51ba8631618b9b3521ff4eb9adfd8a837455226 |
Scenario Outline: User generates a new account from wallet
When the user generates a new account with <account_name> and TesTEr16843/!@00