1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-27 02:12:35 +00:00

test(core): deflake passphrase-related tests

Currently, `PassphraseKeyboard` is shown after `request_passphrase_on_host()`
layout, so in in order to avoid a race condition[^1][^2], an explicit
synchronization was added.

[no changelog]

[^1]: https://github.com/trezor/trezor-firmware/actions/runs/14999904818/job/42144246518?pr=5037
[^2]: https://github.com/trezor/trezor-firmware/actions/runs/15067093253/job/42354594590?pr=5041
This commit is contained in:
Roman Zeyde 2025-05-18 10:02:01 +03:00 committed by Roman Zeyde
parent 6879d5afb4
commit e8653c5009
3 changed files with 4 additions and 5 deletions

View File

@ -218,7 +218,7 @@ def test_autolock_passphrase_keyboard(device_handler: "BackgroundDeviceHandler")
# get address
device_handler.run(common.get_test_address) # type: ignore
assert "PassphraseKeyboard" in debug.read_layout().all_components()
debug.synchronize_at("PassphraseKeyboard")
if debug.layout_type is LayoutType.Caesar:
# Going into the selected character category
@ -255,7 +255,7 @@ def test_autolock_interrupts_passphrase(device_handler: "BackgroundDeviceHandler
# get address
device_handler.run(common.get_test_address) # type: ignore
assert "PassphraseKeyboard" in debug.read_layout().all_components()
debug.synchronize_at("PassphraseKeyboard")
if debug.layout_type is LayoutType.Caesar:
# Going into the selected character category

View File

@ -74,7 +74,7 @@ def prepare_passphrase_dialogue(
) -> Generator["DebugLink", None, None]:
debug = device_handler.debuglink()
device_handler.run(get_test_address) # type: ignore
assert debug.read_layout().main_component() == "PassphraseKeyboard"
debug.synchronize_at("PassphraseKeyboard")
# Resetting the category as it could have been changed by previous tests
global KEYBOARD_CATEGORY

View File

@ -92,8 +92,7 @@ def prepare_passphrase_dialogue(
) -> Generator["DebugLink", None, None]:
debug = device_handler.debuglink()
device_handler.run(get_test_address) # type: ignore
layout = debug.read_layout()
assert "PassphraseKeyboard" in layout.all_components()
layout = debug.synchronize_at("PassphraseKeyboard")
assert layout.passphrase() == ""
assert _current_category(debug) == PassphraseCategory.MENU