From c9436ab668c313287f1873f226b9210cbf03bacd Mon Sep 17 00:00:00 2001 From: Charles-Edouard de la Vergne Date: Thu, 11 Apr 2024 17:50:02 +0200 Subject: [PATCH] Improve 'ROOT_SNAPSHOT_PATH' with latest ragger version --- tests/ragger/constants.py | 2 - tests/ragger/test_blind_sign.py | 8 ++-- tests/ragger/test_clone.py | 4 +- tests/ragger/test_domain_name.py | 21 +++++---- tests/ragger/test_eip191.py | 32 ++++++------- tests/ragger/test_eip712.py | 15 ++++--- tests/ragger/test_get_address.py | 14 +++--- tests/ragger/test_nft.py | 21 ++++++--- tests/ragger/test_sign.py | 77 +++++++++++++++++++------------- 9 files changed, 117 insertions(+), 77 deletions(-) diff --git a/tests/ragger/constants.py b/tests/ragger/constants.py index 5a89b08d0..8a434dfc0 100644 --- a/tests/ragger/constants.py +++ b/tests/ragger/constants.py @@ -1,5 +1,3 @@ -from pathlib import Path import os -ROOT_SNAPSHOT_PATH = Path(__file__).parent ABIS_FOLDER = f"{os.path.dirname(__file__)}/abis" diff --git a/tests/ragger/test_blind_sign.py b/tests/ragger/test_blind_sign.py index 09d8b56d0..29bbd0c9c 100644 --- a/tests/ragger/test_blind_sign.py +++ b/tests/ragger/test_blind_sign.py @@ -1,3 +1,4 @@ +from pathlib import Path import json import pytest from web3 import Web3 @@ -9,14 +10,15 @@ from ragger.navigator import Navigator, NavInsID from ragger.error import ExceptionRAPDU -from constants import ROOT_SNAPSHOT_PATH, ABIS_FOLDER +from constants import ABIS_FOLDER # Token approval, would require loading the "internal plugin" & # providing the token metadata from the CAL def test_blind_sign(firmware: Firmware, backend: BackendInterface, - navigator: Navigator): + navigator: Navigator, + default_screenshot_path: Path): app_client = EthAppClient(backend) with open(f"{ABIS_FOLDER}/erc20.json", encoding="utf-8") as file: @@ -51,6 +53,6 @@ def test_blind_sign(firmware: Firmware, moves += [NavInsID.BOTH_CLICK] else: moves += [NavInsID.USE_CASE_CHOICE_CONFIRM] - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, "blind-signed_approval", moves) diff --git a/tests/ragger/test_clone.py b/tests/ragger/test_clone.py index b06bf841e..be1e4cbe8 100644 --- a/tests/ragger/test_clone.py +++ b/tests/ragger/test_clone.py @@ -1,3 +1,4 @@ +from pathlib import Path from web3 import Web3 from ragger.backend import BackendInterface @@ -20,6 +21,7 @@ def test_clone_thundercore(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, test_name: str): tx_params: dict = { "nonce": NONCE, @@ -29,4 +31,4 @@ def test_clone_thundercore(firmware: Firmware, "value": Web3.to_wei(VALUE, "ether"), "chainId": 108 } - common(firmware, backend, navigator, tx_params, test_name, BIP32_PATH) + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, BIP32_PATH) diff --git a/tests/ragger/test_domain_name.py b/tests/ragger/test_domain_name.py index 5c074f53c..0e0a90888 100644 --- a/tests/ragger/test_domain_name.py +++ b/tests/ragger/test_domain_name.py @@ -1,3 +1,4 @@ +from pathlib import Path import pytest from web3 import Web3 @@ -10,8 +11,6 @@ from ragger.error import ExceptionRAPDU from ragger.navigator import Navigator, NavInsID -from constants import ROOT_SNAPSHOT_PATH - # Values used across all tests CHAIN_ID = 1 @@ -42,6 +41,7 @@ def common(firmware: Firmware, app_client: EthAppClient) -> int: def test_send_fund(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, verbose: bool): app_client = EthAppClient(backend) challenge = common(firmware, app_client) @@ -71,7 +71,7 @@ def test_send_fund(firmware: Firmware, if verbose: moves += [NavInsID.USE_CASE_REVIEW_TAP] moves += [NavInsID.USE_CASE_REVIEW_CONFIRM] - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, "domain_name_verbose_" + str(verbose), moves) @@ -87,7 +87,8 @@ def test_send_fund_wrong_challenge(firmware: Firmware, backend: BackendInterface def test_send_fund_wrong_addr(firmware: Firmware, backend: BackendInterface, - navigator: Navigator): + navigator: Navigator, + default_screenshot_path: Path): app_client = EthAppClient(backend) challenge = common(firmware, app_client) @@ -112,14 +113,15 @@ def test_send_fund_wrong_addr(firmware: Firmware, else: moves += [NavInsID.USE_CASE_REVIEW_TAP] * 2 moves += [NavInsID.USE_CASE_REVIEW_CONFIRM] - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, "domain_name_wrong_addr", moves) def test_send_fund_non_mainnet(firmware: Firmware, backend: BackendInterface, - navigator: Navigator): + navigator: Navigator, + default_screenshot_path: Path): app_client = EthAppClient(backend) challenge = common(firmware, app_client) @@ -141,14 +143,15 @@ def test_send_fund_non_mainnet(firmware: Firmware, else: moves += [NavInsID.USE_CASE_REVIEW_TAP] * 2 moves += [NavInsID.USE_CASE_REVIEW_CONFIRM] - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, "domain_name_non_mainnet", moves) def test_send_fund_unknown_chain(firmware: Firmware, backend: BackendInterface, - navigator: Navigator): + navigator: Navigator, + default_screenshot_path: Path): app_client = EthAppClient(backend) challenge = common(firmware, app_client) @@ -170,7 +173,7 @@ def test_send_fund_unknown_chain(firmware: Firmware, else: moves += [NavInsID.USE_CASE_REVIEW_TAP] * 3 moves += [NavInsID.USE_CASE_REVIEW_CONFIRM] - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, "domain_name_unknown_chain", moves) diff --git a/tests/ragger/test_eip191.py b/tests/ragger/test_eip191.py index a9de665d2..3fc9cbf82 100644 --- a/tests/ragger/test_eip191.py +++ b/tests/ragger/test_eip191.py @@ -1,3 +1,4 @@ +from pathlib import Path import pytest from client.client import EthAppClient, StatusWord @@ -9,8 +10,6 @@ from ragger.firmware import Firmware from ragger.navigator import Navigator, NavInsID -from constants import ROOT_SNAPSHOT_PATH - BIP32_PATH = "m/44'/60'/0'/0/0" @@ -18,7 +17,8 @@ def test_personal_sign_metamask(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): msg = "Example `personal_sign` message" @@ -43,7 +43,7 @@ def test_personal_sign_metamask(firmware: Firmware, navigator.navigate_until_text_and_compare(next_action, [confirm_action], "Sign", - ROOT_SNAPSHOT_PATH, + default_screenshot_path, test_name) # verify signature @@ -55,7 +55,8 @@ def test_personal_sign_metamask(firmware: Firmware, def test_personal_sign_non_ascii(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): msg = "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658" @@ -81,7 +82,7 @@ def test_personal_sign_non_ascii(firmware: Firmware, navigator.navigate_until_text_and_compare(next_action, [confirm_action], "Sign", - ROOT_SNAPSHOT_PATH, + default_screenshot_path, test_name) # verify signature @@ -93,7 +94,8 @@ def test_personal_sign_non_ascii(firmware: Firmware, def test_personal_sign_opensea(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): msg = "Welcome to OpenSea!\n\nClick to sign in and accept the OpenSea Terms of Service: https://opensea.io/tos\n\nThis request will not trigger a blockchain transaction or cost any gas fees.\n\nYour authentication status will reset after 24 hours.\n\nWallet address:\n0x9858effd232b4033e47d90003d41ec34ecaeda94\n\nNonce:\n2b02c8a0-f74f-4554-9821-a28054dc9121" @@ -121,7 +123,7 @@ def test_personal_sign_opensea(firmware: Firmware, navigator.navigate_until_text_and_compare(next_action, [confirm_action], "Sign", - ROOT_SNAPSHOT_PATH, + default_screenshot_path, test_name) # verify signature @@ -133,7 +135,8 @@ def test_personal_sign_opensea(firmware: Firmware, def test_personal_sign_reject(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): msg = "This is an reject sign" @@ -145,20 +148,19 @@ def test_personal_sign_reject(firmware: Firmware, next_action = NavInsID.RIGHT_CLICK confirm_action = NavInsID.BOTH_CLICK navigator.navigate_until_text_and_compare(next_action, - [confirm_action], - "Cancel", - ROOT_SNAPSHOT_PATH, - test_name) + [confirm_action], + "Cancel", + default_screenshot_path, + test_name) else: # instructions = [NavInsID.USE_CASE_REVIEW_TAP] instructions = [NavInsID.USE_CASE_CHOICE_REJECT, NavInsID.USE_CASE_CHOICE_CONFIRM, NavInsID.USE_CASE_STATUS_DISMISS] - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, test_name, instructions) - except ExceptionRAPDU as e: assert e.status == StatusWord.CONDITION_NOT_SATISFIED else: diff --git a/tests/ragger/test_eip712.py b/tests/ragger/test_eip712.py index 1d9a78224..99865ef52 100644 --- a/tests/ragger/test_eip712.py +++ b/tests/ragger/test_eip712.py @@ -18,8 +18,6 @@ from ragger.firmware import Firmware from ragger.navigator import Navigator, NavInsID -from constants import ROOT_SNAPSHOT_PATH - class SnapshotsConfig: test_name: str @@ -90,14 +88,14 @@ def test_eip712_legacy(firmware: Firmware, assert s == bytes.fromhex("52d8ba9153de9255da220ffd36762c0b027701a3b5110f0a765f94b16a9dfb55") -def autonext(firmware: Firmware, navigator: Navigator): +def autonext(firmware: Firmware, navigator: Navigator, default_screenshot_path: Path): moves = [] if firmware.device.startswith("nano"): moves = [NavInsID.RIGHT_CLICK] else: moves = [NavInsID.USE_CASE_REVIEW_TAP] if snaps_config is not None: - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, snaps_config.test_name, moves, screen_change_before_first_instruction=False, @@ -112,6 +110,7 @@ def autonext(firmware: Firmware, navigator: Navigator): def eip712_new_common(firmware: Firmware, navigator: Navigator, + default_screenshot_path: Path, app_client: EthAppClient, json_data: dict, filters: Optional[dict], @@ -119,7 +118,7 @@ def eip712_new_common(firmware: Firmware, assert InputData.process_data(app_client, json_data, filters, - partial(autonext, firmware, navigator)) + partial(autonext, firmware, navigator, default_screenshot_path)) with app_client.eip712_sign_new(BIP32_PATH): moves = [] if firmware.device.startswith("nano"): @@ -134,7 +133,7 @@ def eip712_new_common(firmware: Firmware, moves += [NavInsID.USE_CASE_REVIEW_TAP] moves += [NavInsID.USE_CASE_REVIEW_CONFIRM] if snaps_config is not None: - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, snaps_config.test_name, moves, snap_start_idx=snaps_config.idx) @@ -147,6 +146,7 @@ def eip712_new_common(firmware: Firmware, def test_eip712_new(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, input_file: Path, verbose: bool, filtering: bool): @@ -181,6 +181,7 @@ def test_eip712_new(firmware: Firmware, with open(input_file, encoding="utf-8") as file: v, r, s = eip712_new_common(firmware, navigator, + default_screenshot_path, app_client, json.load(file), filters, @@ -194,6 +195,7 @@ def test_eip712_new(firmware: Firmware, def test_eip712_address_substitution(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, verbose: bool): global snaps_config @@ -237,6 +239,7 @@ def test_eip712_address_substitution(firmware: Firmware, vrs = eip712_new_common(firmware, navigator, + default_screenshot_path, app_client, data, filters, diff --git a/tests/ragger/test_get_address.py b/tests/ragger/test_get_address.py index 0d102aa5c..fd7b682ff 100644 --- a/tests/ragger/test_get_address.py +++ b/tests/ragger/test_get_address.py @@ -1,3 +1,4 @@ +from pathlib import Path from typing import Optional import pytest @@ -12,8 +13,6 @@ from ragger.navigator import Navigator, NavInsID from ragger.bip import calculate_public_key_and_chaincode, CurveChoice -from constants import ROOT_SNAPSHOT_PATH - from client.client import EthAppClient, StatusWord import client.response_parser as ResponseParser @@ -70,13 +69,14 @@ def get_moves(firmware: Firmware, def test_get_pk_rejected(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, path, suffix): app_client = EthAppClient(backend) with pytest.raises(ExceptionRAPDU) as e: with app_client.get_public_addr(bip32_path=path): - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, f"get_pk_rejected_{suffix}", get_moves(firmware, reject=True)) assert e.value.status == StatusWord.CONDITION_NOT_SATISFIED @@ -85,12 +85,13 @@ def test_get_pk_rejected(firmware: Firmware, def test_get_pk(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, with_chaincode: bool, chain: Optional[int]): app_client = EthAppClient(backend) with app_client.get_public_addr(chaincode=with_chaincode, chain_id=chain): - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, f"get_pk_{chain}", get_moves(firmware, chain=chain)) pk, _, chaincode = ResponseParser.pk_addr(app_client.response().data, with_chaincode) @@ -104,12 +105,13 @@ def test_get_pk(firmware: Firmware, def test_get_eth2_pk(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): app_client = EthAppClient(backend) path="m/12381/3600/0/0" with app_client.get_eth2_public_addr(bip32_path=path): - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, test_name, get_moves(firmware, pk_eth2=True)) diff --git a/tests/ragger/test_nft.py b/tests/ragger/test_nft.py index ef60205e7..7dc611617 100644 --- a/tests/ragger/test_nft.py +++ b/tests/ragger/test_nft.py @@ -1,3 +1,4 @@ +from pathlib import Path from typing import Callable, Optional, Any import json import pytest @@ -12,7 +13,7 @@ from ragger.backend import BackendInterface from ragger.navigator import Navigator, NavInsID -from constants import ROOT_SNAPSHOT_PATH, ABIS_FOLDER +from constants import ABIS_FOLDER BIP32_PATH = "m/44'/60'/0'/0/0" @@ -81,6 +82,7 @@ def snapshot_test_name(nft_type: str, fn: str, chain_id: int, reject: bool) -> s def common_test_nft(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, collec: NFTCollection, action: Action, reject: bool, @@ -112,7 +114,7 @@ def common_test_nft(firmware: Firmware, "data": data, } with app_client.sign(BIP32_PATH, tx_params): - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, snapshot_test_name(plugin_name.lower(), action.fn_name, collec.chain_id, @@ -130,10 +132,11 @@ def common_test_nft_reject(test_fn: Callable, firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, collec: NFTCollection, action: Action): with pytest.raises(ExceptionRAPDU) as e: - test_fn(firmware, backend, navigator, collec, action, True) + test_fn(firmware, backend, navigator, default_screenshot_path, collec, action, True) assert e.value.status == StatusWord.CONDITION_NOT_SATISFIED # ERC-721 @@ -226,12 +229,14 @@ def action_721_fixture(request) -> Action: def test_erc721(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, collec_721: NFTCollection, action_721: Action, reject: bool = False): common_test_nft(firmware, backend, navigator, + default_screenshot_path, collec_721, action_721, reject, @@ -240,11 +245,13 @@ def test_erc721(firmware: Firmware, def test_erc721_reject(firmware: Firmware, backend: BackendInterface, - navigator: Navigator): + navigator: Navigator, + default_screenshot_path: Path): common_test_nft_reject(test_erc721, firmware, backend, navigator, + default_screenshot_path, collecs_721[0], actions_721[0]) @@ -337,12 +344,14 @@ def action_1155_fixture(request) -> Action: def test_erc1155(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, collec_1155: NFTCollection, action_1155: Action, reject: bool = False): common_test_nft(firmware, backend, navigator, + default_screenshot_path, collec_1155, action_1155, reject, @@ -351,10 +360,12 @@ def test_erc1155(firmware: Firmware, def test_erc1155_reject(firmware: Firmware, backend: BackendInterface, - navigator: Navigator): + navigator: Navigator, + default_screenshot_path: Path): common_test_nft_reject(test_erc1155, firmware, backend, navigator, + default_screenshot_path, collecs_1155[0], actions_1155[0]) diff --git a/tests/ragger/test_sign.py b/tests/ragger/test_sign.py index ca251baae..48a0fbe53 100644 --- a/tests/ragger/test_sign.py +++ b/tests/ragger/test_sign.py @@ -1,3 +1,4 @@ +from pathlib import Path from web3 import Web3 from client.client import EthAppClient, StatusWord @@ -8,9 +9,7 @@ from ragger.error import ExceptionRAPDU from ragger.backend import BackendInterface from ragger.firmware import Firmware -from ragger.navigator import Navigator, NavInsID, NavIns - -from constants import ROOT_SNAPSHOT_PATH +from ragger.navigator import Navigator, NavInsID # Values used across all tests @@ -33,6 +32,7 @@ def common(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, tx_params: dict, test_name: str = "", path: str = BIP32_PATH): @@ -56,7 +56,7 @@ def common(firmware: Firmware, navigator.navigate_until_text_and_compare(next_action, [confirm_action], end_text, - ROOT_SNAPSHOT_PATH, + default_screenshot_path, test_name) else: navigator.navigate_until_text(next_action, [confirm_action], end_text) @@ -70,6 +70,7 @@ def common(firmware: Firmware, def common_reject(firmware: Firmware, backend: BackendInterface, navigator: Navigator, + default_screenshot_path: Path, tx_params: dict, test_name: str, path: str = BIP32_PATH): @@ -83,14 +84,14 @@ def common_reject(firmware: Firmware, navigator.navigate_until_text_and_compare(next_action, [confirm_action], "Reject", - ROOT_SNAPSHOT_PATH, + default_screenshot_path, test_name) else: instructions = [NavInsID.USE_CASE_REVIEW_TAP] * 2 instructions += [NavInsID.USE_CASE_CHOICE_REJECT, NavInsID.USE_CASE_CHOICE_CONFIRM, NavInsID.USE_CASE_STATUS_DISMISS] - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, test_name, instructions) @@ -116,7 +117,10 @@ def common_fail(backend: BackendInterface, assert False # An exception should have been raised -def test_legacy(firmware: Firmware, backend: BackendInterface, navigator: Navigator): +def test_legacy(firmware: Firmware, + backend: BackendInterface, + navigator: Navigator, + default_screenshot_path: Path): tx_params: dict = { "nonce": NONCE, "gasPrice": Web3.to_wei(GAS_PRICE, "gwei"), @@ -125,7 +129,7 @@ def test_legacy(firmware: Firmware, backend: BackendInterface, navigator: Naviga "value": Web3.to_wei(AMOUNT, "ether"), "chainId": CHAIN_ID } - common(firmware, backend, navigator, tx_params) + common(firmware, backend, navigator, default_screenshot_path, tx_params) # Transfer amount >= 2^87 Eth on Ethereum app should fail @@ -145,7 +149,8 @@ def test_legacy_send_error(backend: BackendInterface): def test_legacy_send_bsc(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): tx_params: dict = { "nonce": 1, "gasPrice": Web3.to_wei(GAS_PRICE2, 'gwei'), @@ -154,14 +159,15 @@ def test_legacy_send_bsc(firmware: Firmware, "value": Web3.to_wei(AMOUNT2, "ether"), "chainId": 56 } - common(firmware, backend, navigator, tx_params, test_name, BIP32_PATH2) + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, BIP32_PATH2) # Transfer on network 112233445566 on Ethereum def test_legacy_chainid(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): tx_params: dict = { "nonce": NONCE2, "gasPrice": Web3.to_wei(GAS_PRICE, 'gwei'), @@ -170,14 +176,15 @@ def test_legacy_chainid(firmware: Firmware, "value": Web3.to_wei(AMOUNT2, "ether"), "chainId": 112233445566 } - common(firmware, backend, navigator, tx_params, test_name, BIP32_PATH2) + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, BIP32_PATH2) # Try to blind sign with setting disabled def test_legacy_contract(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): buffer = bytes.fromhex("058000002c8000003c800000010000000000000000f849208506fc23ac008303dc3194f650c3d88d12db855b8bf7d11be6c55a4e07dcc980a4a1712d6800000000000000000000000000000000000000000000000000000000000acbc7018080") app_client = EthAppClient(backend) @@ -190,7 +197,7 @@ def test_legacy_contract(firmware: Firmware, NavInsID.RIGHT_CLICK, NavInsID.BOTH_CLICK ] - navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH, + navigator.navigate_and_compare(default_screenshot_path, test_name, moves) @@ -198,7 +205,10 @@ def test_legacy_contract(firmware: Firmware, assert e.status == StatusWord.INVALID_DATA -def test_1559(firmware: Firmware, backend: BackendInterface, navigator: Navigator): +def test_1559(firmware: Firmware, + backend: BackendInterface, + navigator: Navigator, + default_screenshot_path: Path): tx_params: dict = { "nonce": NONCE, "maxFeePerGas": Web3.to_wei(145, "gwei"), @@ -208,13 +218,14 @@ def test_1559(firmware: Firmware, backend: BackendInterface, navigator: Navigato "value": Web3.to_wei(AMOUNT, "ether"), "chainId": CHAIN_ID } - common(firmware, backend, navigator, tx_params) + common(firmware, backend, navigator, default_screenshot_path, tx_params) def test_sign_simple(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): tx_params: dict = { "nonce": NONCE2, "gasPrice": Web3.to_wei(GAS_PRICE, 'gwei'), @@ -223,13 +234,14 @@ def test_sign_simple(firmware: Firmware, "value": Web3.to_wei(AMOUNT2, "ether"), "chainId": CHAIN_ID } - common(firmware, backend, navigator, tx_params, test_name, "m/44'/60'/1'/0/0") + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, "m/44'/60'/1'/0/0") def test_sign_limit_nonce(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): tx_params: dict = { "nonce": 2**64-1, "gasPrice": 10, @@ -238,13 +250,14 @@ def test_sign_limit_nonce(firmware: Firmware, "value": 0x08762, "chainId": CHAIN_ID } - common(firmware, backend, navigator, tx_params, test_name, "m/44'/60'/1'/0/0") + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, "m/44'/60'/1'/0/0") def test_sign_nonce_display(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): settings_toggle(firmware, navigator, [SettingID.NONCE]) @@ -256,13 +269,14 @@ def test_sign_nonce_display(firmware: Firmware, "value": Web3.to_wei(AMOUNT2, "ether"), "chainId": CHAIN_ID } - common(firmware, backend, navigator, tx_params, test_name, "m/44'/60'/1'/0/0") + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, "m/44'/60'/1'/0/0") def test_sign_blind_simple(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): settings_toggle(firmware, navigator, [SettingID.BLIND_SIGNING]) data = "ok" @@ -275,13 +289,14 @@ def test_sign_blind_simple(firmware: Firmware, "chainId": CHAIN_ID, "data": data.encode('utf-8').hex() } - common(firmware, backend, navigator, tx_params, test_name, "m/44'/60'/1'/0/0") + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, "m/44'/60'/1'/0/0") def test_sign_blind_and_nonce_display(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): settings_toggle(firmware, navigator, [SettingID.NONCE, SettingID.BLIND_SIGNING]) data = "That's a little message :)" @@ -294,13 +309,14 @@ def test_sign_blind_and_nonce_display(firmware: Firmware, "chainId": CHAIN_ID, "data": data.encode('utf-8').hex() } - common(firmware, backend, navigator, tx_params, test_name, "m/44'/60'/1'/0/0") + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, "m/44'/60'/1'/0/0") def test_sign_reject(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): tx_params: dict = { "nonce": NONCE2, "gasPrice": Web3.to_wei(GAS_PRICE, 'gwei'), @@ -309,7 +325,7 @@ def test_sign_reject(firmware: Firmware, "value": Web3.to_wei(AMOUNT2, "ether"), "chainId": CHAIN_ID } - common_reject(firmware, backend, navigator, tx_params, test_name, "m/44'/60'/1'/0/0") + common_reject(firmware, backend, navigator, default_screenshot_path, tx_params, test_name, "m/44'/60'/1'/0/0") def test_sign_error_transaction_type(backend: BackendInterface): @@ -352,7 +368,8 @@ def test_sign_blind_error_disabled(backend: BackendInterface): def test_sign_eip_2930(firmware: Firmware, backend: BackendInterface, navigator: Navigator, - test_name: str): + test_name: str, + default_screenshot_path: Path): tx_params = { "nonce": NONCE, @@ -370,4 +387,4 @@ def test_sign_eip_2930(firmware: Firmware, } ], } - common(firmware, backend, navigator, tx_params, test_name) + common(firmware, backend, navigator, default_screenshot_path, tx_params, test_name)