From 7b0d2a7095dcb0f754eb77bdfd292cdf97d22e40 Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 27 Jan 2023 15:36:48 +0100 Subject: [PATCH] feat(tests): re-enable passphrase autolock test --- tests/click_tests/test_autolock.py | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/tests/click_tests/test_autolock.py b/tests/click_tests/test_autolock.py index 4a9ce1412..456e5b298 100644 --- a/tests/click_tests/test_autolock.py +++ b/tests/click_tests/test_autolock.py @@ -97,7 +97,6 @@ def test_autolock_interrupts_signing(device_handler: "BackgroundDeviceHandler"): device_handler.result() -@pytest.mark.xfail(reason="depends on #922") @pytest.mark.setup_client(pin=PIN4, passphrase=True) def test_autolock_passphrase_keyboard(device_handler: "BackgroundDeviceHandler"): set_autolock_delay(device_handler, 10_000) @@ -108,14 +107,42 @@ def test_autolock_passphrase_keyboard(device_handler: "BackgroundDeviceHandler") # enter passphrase - slowly layout = debug.wait_layout() - assert layout.text == "PassphraseKeyboard" + assert layout.text == "< PassphraseKeyboard >" CENTER_BUTTON = buttons.grid35(1, 2) + # total sleep time: 11 * 1.1 = 12.1 seconds for _ in range(11): debug.click(CENTER_BUTTON) time.sleep(1.1) - assert device_handler.result() == "TODO when #922 fixed" + debug.click(buttons.OK, wait=True) + assert device_handler.result() == "mzAZ4BgqmFHYxhPgdFH2pR2h1X7jJrNFSs" + + +@pytest.mark.setup_client(pin=PIN4, passphrase=True) +def test_autolock_interrupts_passphrase(device_handler: "BackgroundDeviceHandler"): + set_autolock_delay(device_handler, 10_000) + debug = device_handler.debuglink() + + # get address + device_handler.run(common.get_test_address) + + # enter passphrase - slowly + layout = debug.wait_layout() + assert layout.text == "< PassphraseKeyboard >" + + CENTER_BUTTON = buttons.grid35(1, 2) + # total sleep time: 5 * 1.1 = 5.5 seconds + for _ in range(5): + debug.click(CENTER_BUTTON) + time.sleep(1.1) + + # wait for autolock to kick in + time.sleep(10.1) + layout = debug.wait_layout() + assert layout.text.startswith("< Lockscreen") + with pytest.raises(exceptions.Cancelled): + device_handler.result() @pytest.mark.setup_client(pin=PIN4)