Skip to content

Commit

Permalink
fixup! test(core): don't fetch DebugLinkState by default
Browse files Browse the repository at this point in the history
  • Loading branch information
romanz committed Feb 6, 2025
1 parent a59d598 commit 26ab041
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
12 changes: 0 additions & 12 deletions tests/click_tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,6 @@ def go_next(debug: "DebugLink") -> LayoutContent:
return debug.read_layout()


def tap_to_confirm(debug: "DebugLink") -> LayoutContent:
if debug.layout_type is LayoutType.Bolt:
return debug.read_layout()
elif debug.layout_type is LayoutType.Caesar:
return debug.read_layout()
elif debug.layout_type is LayoutType.Delizia:
debug.click(buttons.TAP_TO_CONFIRM)
return debug.read_layout()
else:
raise RuntimeError("Unknown model")


def go_back(debug: "DebugLink", r_middle: bool = False) -> LayoutContent:
if debug.layout_type in (LayoutType.Bolt, LayoutType.Delizia):
debug.click(buttons.CANCEL)
Expand Down
5 changes: 3 additions & 2 deletions tests/click_tests/test_autolock.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from ..device_tests.bitcoin.payment_req import make_coinjoin_request
from ..tx_cache import TxCache
from . import recovery
from .common import go_next, tap_to_confirm, unlock_gesture
from .common import go_next, unlock_gesture

if TYPE_CHECKING:
from trezorlib.debuglink import DebugLink, LayoutContent
Expand Down Expand Up @@ -71,7 +71,8 @@ def set_autolock_delay(device_handler: "BackgroundDeviceHandler", delay_ms: int)

layout = go_next(debug)
if debug.layout_type is LayoutType.Delizia:
layout = tap_to_confirm(debug)
debug.click(buttons.TAP_TO_CONFIRM)
layout = debug.read_layout()
assert layout.main_component() == "Homescreen"
device_handler.result()

Expand Down
4 changes: 4 additions & 0 deletions tests/click_tests/test_pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ def _cancel_pin(debug: "DebugLink") -> None:
# It is the same button as DELETE
# TODO: implement cancel PIN for TR?
_delete_pin(debug, 1, check=False)

# Note: `prepare()` context manager will send a tap after PIN cancellation,
# so we make sure the lockscreen is already up to receive it -- otherwise
# the input event may get lost in the loop restart.
assert debug.read_layout().main_component() != "PinKeyboard"


Expand Down

0 comments on commit 26ab041

Please sign in to comment.