Improve 'ROOT_SNAPSHOT_PATH' with latest ragger version

This commit is contained in:
Charles-Edouard de la Vergne
2024-04-11 17:50:02 +02:00
parent 8fcaf9f103
commit c9436ab668
9 changed files with 117 additions and 77 deletions

View File

@@ -1,3 +1,4 @@
from pathlib import Path
import pytest
from client.client import EthAppClient, StatusWord
@@ -9,8 +10,6 @@ from ragger.backend import BackendInterface
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 @@ BIP32_PATH = "m/44'/60'/0'/0/0"
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: