|
|
|
@ -1,5 +1,9 @@
|
|
|
|
|
from typing import Sequence
|
|
|
|
|
import pytest
|
|
|
|
|
from ragger.navigator import NavInsID, NavIns
|
|
|
|
|
from ragger.backend import BackendInterface
|
|
|
|
|
from ragger.firmware import Firmware
|
|
|
|
|
from ragger.navigator import Navigator, NavInsID, NavIns
|
|
|
|
|
from ragger.navigator.navigator import InstructionType
|
|
|
|
|
|
|
|
|
|
from application_client.command_sender import CommandSender
|
|
|
|
|
from application_client.app_def import PassWord
|
|
|
|
@ -11,7 +15,7 @@ from utils import ROOT_SCREENSHOT_PATH
|
|
|
|
|
# In this test we check the behavior of the Slot menu
|
|
|
|
|
# The Navigations go and check:
|
|
|
|
|
# - Select slot / Slot 2 / (next page) / Set default
|
|
|
|
|
def test_menu_slot(firmware, backend, navigator, test_name):
|
|
|
|
|
def test_menu_slot(firmware: Firmware, backend: BackendInterface, navigator: Navigator, test_name: str) -> None:
|
|
|
|
|
|
|
|
|
|
# Use the app interface instead of raw interface
|
|
|
|
|
client = CommandSender(backend)
|
|
|
|
@ -24,7 +28,8 @@ def test_menu_slot(firmware, backend, navigator, test_name):
|
|
|
|
|
pytest.skip("single slot configuration")
|
|
|
|
|
|
|
|
|
|
# Navigate in the main menu
|
|
|
|
|
if firmware.device.startswith("nano"):
|
|
|
|
|
instructions: Sequence[InstructionType]
|
|
|
|
|
if firmware.is_nano:
|
|
|
|
|
initial_instructions = [
|
|
|
|
|
NavInsID.RIGHT_CLICK,
|
|
|
|
|
NavInsID.BOTH_CLICK, # Select slot
|
|
|
|
@ -40,6 +45,7 @@ def test_menu_slot(firmware, backend, navigator, test_name):
|
|
|
|
|
NavInsID.RIGHT_CLICK,
|
|
|
|
|
NavInsID.BOTH_CLICK, # (Back)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
initial_instructions = [
|
|
|
|
|
NavInsID.USE_CASE_CHOICE_CONFIRM, # Slots
|
|
|
|
@ -68,9 +74,10 @@ def test_menu_slot(firmware, backend, navigator, test_name):
|
|
|
|
|
# UIF / Enable UIF for Signature
|
|
|
|
|
# (back)
|
|
|
|
|
# Reset / Long press 'Yes'
|
|
|
|
|
def test_menu_settings(firmware, backend, navigator, test_name):
|
|
|
|
|
def test_menu_settings(firmware: Firmware, backend: BackendInterface, navigator: Navigator, test_name: str) -> None:
|
|
|
|
|
# Navigate in the main menu
|
|
|
|
|
if firmware.device == "nanos":
|
|
|
|
|
instructions: Sequence[InstructionType]
|
|
|
|
|
if firmware == Firmware.NANOS:
|
|
|
|
|
# Use the app interface instead of raw interface
|
|
|
|
|
client = CommandSender(backend)
|
|
|
|
|
|
|
|
|
@ -144,7 +151,7 @@ def test_menu_settings(firmware, backend, navigator, test_name):
|
|
|
|
|
NavInsID.BOTH_CLICK, # Validate
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
elif firmware.device.startswith("nano"):
|
|
|
|
|
elif firmware.is_nano:
|
|
|
|
|
initial_instructions = [
|
|
|
|
|
NavInsID.RIGHT_CLICK,
|
|
|
|
|
NavInsID.RIGHT_CLICK,
|
|
|
|
@ -198,27 +205,49 @@ def test_menu_settings(firmware, backend, navigator, test_name):
|
|
|
|
|
NavInsID.RIGHT_CLICK,
|
|
|
|
|
NavInsID.BOTH_CLICK, # Validate
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
initial_instructions = [
|
|
|
|
|
NavInsID.USE_CASE_HOME_SETTINGS, # Settings
|
|
|
|
|
]
|
|
|
|
|
instructions = [
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 130)), # Key Template
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 300)), # Decryption
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 390)), # SECP 256K1
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 220)), # Seed mode
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 300)), # PIN mode
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 130)), # On Screen
|
|
|
|
|
NavInsID.CENTERED_FOOTER_TAP, # Set default
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 390)), # UIF
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 130)), # UIF for Signature
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 480)), # Reset
|
|
|
|
|
NavInsID.USE_CASE_REVIEW_CONFIRM, # Long press 'Yes'
|
|
|
|
|
]
|
|
|
|
|
if firmware == Firmware.STAX:
|
|
|
|
|
instructions = [
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 130)), # Key Template
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 300)), # Decryption
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 390)), # SECP 256K1
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 220)), # Seed mode
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 300)), # PIN mode
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 130)), # On Screen
|
|
|
|
|
NavInsID.CENTERED_FOOTER_TAP, # Set default
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 390)), # UIF
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 130)), # UIF for Signature
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (350, 480)), # Reset
|
|
|
|
|
NavInsID.USE_CASE_CHOICE_CONFIRM, # Press 'Reset'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
instructions = [
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 130)), # Key Template
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 280)), # Decryption
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 320)), # SECP 256K1
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 230)), # Seed mode
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 325)), # PIN mode
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 140)), # On Screen
|
|
|
|
|
NavInsID.EXIT_FOOTER_TAP, # Set default
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 420)), # UIF
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 130)), # UIF for Signature
|
|
|
|
|
NavInsID.NAVIGATION_HEADER_TAP, # (Back)
|
|
|
|
|
NavInsID.USE_CASE_SETTINGS_NEXT, # Next page
|
|
|
|
|
NavIns(NavInsID.TOUCH, (430, 130)), # Reset
|
|
|
|
|
NavInsID.USE_CASE_CHOICE_CONFIRM, # Press 'Reset'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# Use the app interface instead of raw interface
|
|
|
|
|
client = CommandSender(backend)
|
|
|
|
|