Port 'send_etc.test' from 'zemu' to 'ragger'
- Port test config from 'zemu' - Copy snapshots from 'zemu' - Adapt conftest.py to support library mode - Add a new test step in the workflow
@@ -1,4 +1,49 @@
|
||||
#from ragger.conftest import configuration
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import warnings
|
||||
import glob
|
||||
|
||||
from ragger.conftest import configuration
|
||||
|
||||
#######################
|
||||
# CONFIGURATION START #
|
||||
#######################
|
||||
|
||||
# You can configure optional parameters by overriding the value of
|
||||
# ragger.configuration.OPTIONAL_CONFIGURATION
|
||||
# Please refer to ragger/conftest/configuration.py for their descriptions and accepted values
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption("--with_lib_mode", action="store_true", help="Run the test with Library Mode")
|
||||
|
||||
|
||||
parent: Path = Path(__file__).parent
|
||||
testFiles = glob.glob("test_*.py", root_dir=f"{parent}")
|
||||
collect_ignore = []
|
||||
if "--with_lib_mode" in sys.argv:
|
||||
|
||||
# ==============================================================================
|
||||
# /!\ Tests are started in Library mode: unselect (ignore) unrelated modules /!\
|
||||
# ==============================================================================
|
||||
|
||||
warnings.warn("Main app is started in library mode")
|
||||
|
||||
configuration.OPTIONAL.MAIN_APP_DIR = "tests/ragger/.test_dependencies/"
|
||||
|
||||
collect_ignore += [f for f in testFiles if "test_clone" not in f]
|
||||
|
||||
else:
|
||||
|
||||
# ===========================================================================
|
||||
# /!\ Standards tests without Library mode: unselect (ignore) clone tests /!\
|
||||
# ===========================================================================
|
||||
|
||||
collect_ignore += [f for f in testFiles if "test_clone" in f]
|
||||
|
||||
|
||||
#####################
|
||||
# CONFIGURATION END #
|
||||
#####################
|
||||
|
||||
# Pull all features from the base ragger conftest using the overridden configuration
|
||||
pytest_plugins = ("ragger.conftest.base_conftest", )
|
||||
|
||||
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00000.png
Normal file
|
After Width: | Height: | Size: 374 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00001.png
Normal file
|
After Width: | Height: | Size: 343 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00002.png
Normal file
|
After Width: | Height: | Size: 497 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00003.png
Normal file
|
After Width: | Height: | Size: 504 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00004.png
Normal file
|
After Width: | Height: | Size: 373 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00005.png
Normal file
|
After Width: | Height: | Size: 355 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00006.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00007.png
Normal file
|
After Width: | Height: | Size: 349 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00008.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00009.png
Normal file
|
After Width: | Height: | Size: 349 B |
BIN
tests/ragger/snapshots/nanos/test_clone_thundercore/00010.png
Normal file
|
After Width: | Height: | Size: 349 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00000.png
Normal file
|
After Width: | Height: | Size: 374 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00001.png
Normal file
|
After Width: | Height: | Size: 336 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00002.png
Normal file
|
After Width: | Height: | Size: 451 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00003.png
Normal file
|
After Width: | Height: | Size: 320 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00004.png
Normal file
|
After Width: | Height: | Size: 497 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00005.png
Normal file
|
After Width: | Height: | Size: 504 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00006.png
Normal file
|
After Width: | Height: | Size: 373 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00007.png
Normal file
|
After Width: | Height: | Size: 380 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00008.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00009.png
Normal file
|
After Width: | Height: | Size: 340 B |
1
tests/ragger/snapshots/nanos/test_legacy_etc/00010.png
Symbolic link
@@ -0,0 +1 @@
|
||||
00008.png
|
||||
BIN
tests/ragger/snapshots/nanos/test_legacy_etc/00011.png
Normal file
|
After Width: | Height: | Size: 349 B |
1
tests/ragger/snapshots/nanosp/test_clone_thundercore
Symbolic link
@@ -0,0 +1 @@
|
||||
../nanox/test_clone_thundercore
|
||||
BIN
tests/ragger/snapshots/nanox/test_clone_thundercore/00000.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
tests/ragger/snapshots/nanox/test_clone_thundercore/00001.png
Normal file
|
After Width: | Height: | Size: 410 B |
BIN
tests/ragger/snapshots/nanox/test_clone_thundercore/00002.png
Normal file
|
After Width: | Height: | Size: 773 B |
BIN
tests/ragger/snapshots/nanox/test_clone_thundercore/00003.png
Normal file
|
After Width: | Height: | Size: 410 B |
BIN
tests/ragger/snapshots/nanox/test_clone_thundercore/00004.png
Normal file
|
After Width: | Height: | Size: 472 B |
BIN
tests/ragger/snapshots/nanox/test_clone_thundercore/00005.png
Normal file
|
After Width: | Height: | Size: 381 B |
BIN
tests/ragger/snapshots/nanox/test_clone_thundercore/00006.png
Normal file
|
After Width: | Height: | Size: 381 B |
BIN
tests/ragger/snapshots/nanox/test_clone_thundercore/00007.png
Normal file
|
After Width: | Height: | Size: 382 B |
BIN
tests/ragger/snapshots/nanox/test_legacy_etc/00000.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
tests/ragger/snapshots/nanox/test_legacy_etc/00001.png
Normal file
|
After Width: | Height: | Size: 572 B |
BIN
tests/ragger/snapshots/nanox/test_legacy_etc/00002.png
Normal file
|
After Width: | Height: | Size: 773 B |
BIN
tests/ragger/snapshots/nanox/test_legacy_etc/00003.png
Normal file
|
After Width: | Height: | Size: 441 B |
BIN
tests/ragger/snapshots/nanox/test_legacy_etc/00004.png
Normal file
|
After Width: | Height: | Size: 472 B |
BIN
tests/ragger/snapshots/nanox/test_legacy_etc/00005.png
Normal file
|
After Width: | Height: | Size: 365 B |
1
tests/ragger/snapshots/nanox/test_legacy_etc/00006.png
Symbolic link
@@ -0,0 +1 @@
|
||||
00004.png
|
||||
BIN
tests/ragger/snapshots/nanox/test_legacy_etc/00007.png
Normal file
|
After Width: | Height: | Size: 382 B |
BIN
tests/ragger/snapshots/stax/test_clone_thundercore/00000.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
tests/ragger/snapshots/stax/test_clone_thundercore/00001.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
tests/ragger/snapshots/stax/test_clone_thundercore/00002.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
tests/ragger/snapshots/stax/test_clone_thundercore/00003.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
tests/ragger/snapshots/stax/test_clone_thundercore/00004.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
32
tests/ragger/test_clone.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from web3 import Web3
|
||||
|
||||
from ragger.backend import BackendInterface
|
||||
from ragger.firmware import Firmware
|
||||
from ragger.navigator import Navigator
|
||||
|
||||
from test_sign import common
|
||||
|
||||
|
||||
# Values used across all tests
|
||||
ADDR = bytes.fromhex("5a321744667052affa8386ed49e00ef223cbffc3")
|
||||
BIP32_PATH = "m/44'/1001'/0'/0/0"
|
||||
NONCE = 68
|
||||
GAS_PRICE = 13
|
||||
GAS_LIMIT = 21000
|
||||
VALUE = 0.31415
|
||||
|
||||
|
||||
# Transfer on Clone app
|
||||
def test_clone_thundercore(firmware: Firmware,
|
||||
backend: BackendInterface,
|
||||
navigator: Navigator,
|
||||
test_name: str):
|
||||
tx_params: dict = {
|
||||
"nonce": NONCE,
|
||||
"gasPrice": Web3.to_wei(GAS_PRICE, 'gwei'),
|
||||
"gas": GAS_LIMIT,
|
||||
"to": ADDR,
|
||||
"value": Web3.to_wei(VALUE, "ether"),
|
||||
"chainId": 108
|
||||
}
|
||||
common(firmware, backend, navigator, tx_params, test_name, BIP32_PATH)
|
||||