mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-05 12:21:16 +00:00
tests: fix wait_layout() behavior
This commit is contained in:
parent
01832d5ae9
commit
3c128cde38
@ -12,20 +12,24 @@ class NullUI:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_pin(code=None):
|
def get_pin(code=None):
|
||||||
raise NotImplementedError("Should not be used with T1")
|
raise NotImplementedError("NullUI should not be used with T1")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_passphrase():
|
def get_passphrase():
|
||||||
raise NotImplementedError("Should not be used with T1")
|
raise NotImplementedError("NullUI should not be used with T1")
|
||||||
|
|
||||||
|
|
||||||
class BackgroundDeviceHandler:
|
class BackgroundDeviceHandler:
|
||||||
_pool = ThreadPoolExecutor()
|
_pool = ThreadPoolExecutor()
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
|
self._configure_client(client)
|
||||||
|
self.task = None
|
||||||
|
|
||||||
|
def _configure_client(self, client):
|
||||||
self.client = client
|
self.client = client
|
||||||
self.client.ui = NullUI
|
self.client.ui = NullUI
|
||||||
self.task = None
|
self.client.watch_layout(True)
|
||||||
|
|
||||||
def run(self, function, *args, **kwargs):
|
def run(self, function, *args, **kwargs):
|
||||||
if self.task is not None:
|
if self.task is not None:
|
||||||
@ -49,8 +53,7 @@ class BackgroundDeviceHandler:
|
|||||||
# TODO handle actual restart as well
|
# TODO handle actual restart as well
|
||||||
self.kill_task()
|
self.kill_task()
|
||||||
emulator.restart()
|
emulator.restart()
|
||||||
self.client = emulator.client
|
self._configure_client(emulator.client)
|
||||||
self.client.ui = NullUI
|
|
||||||
|
|
||||||
def result(self):
|
def result(self):
|
||||||
if self.task is None:
|
if self.task is None:
|
||||||
|
@ -118,6 +118,7 @@ def test_show_multisig_xpubs(client):
|
|||||||
assert lines[1:] == xpubs[0]
|
assert lines[1:] == xpubs[0]
|
||||||
# just for UI test
|
# just for UI test
|
||||||
client.debug.swipe_up()
|
client.debug.swipe_up()
|
||||||
|
client.debug.wait_layout()
|
||||||
|
|
||||||
client.debug.press_no()
|
client.debug.press_no()
|
||||||
yield # show XPUB#2
|
yield # show XPUB#2
|
||||||
@ -126,6 +127,7 @@ def test_show_multisig_xpubs(client):
|
|||||||
assert lines[1:] == xpubs[1]
|
assert lines[1:] == xpubs[1]
|
||||||
# just for UI test
|
# just for UI test
|
||||||
client.debug.swipe_up()
|
client.debug.swipe_up()
|
||||||
|
client.debug.wait_layout()
|
||||||
|
|
||||||
client.debug.press_no()
|
client.debug.press_no()
|
||||||
yield # show XPUB#3
|
yield # show XPUB#3
|
||||||
@ -134,6 +136,7 @@ def test_show_multisig_xpubs(client):
|
|||||||
assert lines[1:] == xpubs[2]
|
assert lines[1:] == xpubs[2]
|
||||||
# just for UI test
|
# just for UI test
|
||||||
client.debug.swipe_up()
|
client.debug.swipe_up()
|
||||||
|
client.debug.wait_layout()
|
||||||
|
|
||||||
client.debug.press_yes()
|
client.debug.press_yes()
|
||||||
|
|
||||||
|
@ -136,6 +136,8 @@ def test_invalid_seed_core(client):
|
|||||||
|
|
||||||
yield
|
yield
|
||||||
for _ in range(12):
|
for _ in range(12):
|
||||||
|
layout = client.debug.wait_layout()
|
||||||
|
assert layout.text == "Bip39Keyboard"
|
||||||
client.debug.input("stick")
|
client.debug.input("stick")
|
||||||
|
|
||||||
code = yield
|
code = yield
|
||||||
|
@ -174,6 +174,7 @@ def test_upgrade_shamir_recovery(gen, tag):
|
|||||||
emu.client
|
emu.client
|
||||||
) as device_handler:
|
) as device_handler:
|
||||||
assert emu.client.features.recovery_mode is False
|
assert emu.client.features.recovery_mode is False
|
||||||
|
emu.client.watch_layout(True)
|
||||||
debug = device_handler.debuglink()
|
debug = device_handler.debuglink()
|
||||||
|
|
||||||
device_handler.run(device.recover, pin_protection=False)
|
device_handler.run(device.recover, pin_protection=False)
|
||||||
@ -191,6 +192,7 @@ def test_upgrade_shamir_recovery(gen, tag):
|
|||||||
assert device_id == emu.client.features.device_id
|
assert device_id == emu.client.features.device_id
|
||||||
assert emu.client.features.recovery_mode
|
assert emu.client.features.recovery_mode
|
||||||
debug = emu.client.debug
|
debug = emu.client.debug
|
||||||
|
emu.client.watch_layout(True)
|
||||||
|
|
||||||
# second share
|
# second share
|
||||||
layout = recovery.enter_share(debug, MNEMONIC_SLIP39_BASIC_20_3of6[2])
|
layout = recovery.enter_share(debug, MNEMONIC_SLIP39_BASIC_20_3of6[2])
|
||||||
|
Loading…
Reference in New Issue
Block a user