From 034947985a0b347db77d111cadb50defd169f04d Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Tue, 7 Feb 2023 15:54:48 +0100 Subject: [PATCH] fix(tests): increase delay between click test button presses [no changelog] --- tests/click_tests/test_autolock.py | 15 ++++++++------- tests/ui_tests/fixtures.json | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/click_tests/test_autolock.py b/tests/click_tests/test_autolock.py index 456e5b298..49a77c47b 100644 --- a/tests/click_tests/test_autolock.py +++ b/tests/click_tests/test_autolock.py @@ -14,6 +14,7 @@ # You should have received a copy of the License along with this library. # If not, see . +import math import time from typing import TYPE_CHECKING @@ -110,13 +111,13 @@ def test_autolock_passphrase_keyboard(device_handler: "BackgroundDeviceHandler") assert layout.text == "< PassphraseKeyboard >" CENTER_BUTTON = buttons.grid35(1, 2) - # total sleep time: 11 * 1.1 = 12.1 seconds - for _ in range(11): + # keep clicking for long enough to trigger the autolock if it incorrectly ignored key presses + for _ in range(math.ceil(11 / 1.5)): debug.click(CENTER_BUTTON) - time.sleep(1.1) + time.sleep(1.5) debug.click(buttons.OK, wait=True) - assert device_handler.result() == "mzAZ4BgqmFHYxhPgdFH2pR2h1X7jJrNFSs" + assert device_handler.result() == "mnF4yRWJXmzRB6EuBzuVigqeqTqirQupxJ" @pytest.mark.setup_client(pin=PIN4, passphrase=True) @@ -132,10 +133,10 @@ def test_autolock_interrupts_passphrase(device_handler: "BackgroundDeviceHandler assert layout.text == "< PassphraseKeyboard >" CENTER_BUTTON = buttons.grid35(1, 2) - # total sleep time: 5 * 1.1 = 5.5 seconds - for _ in range(5): + # autolock must activate even if we pressed some buttons + for _ in range(math.ceil(6 / 1.5)): debug.click(CENTER_BUTTON) - time.sleep(1.1) + time.sleep(1.5) # wait for autolock to kick in time.sleep(10.1) diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index 269643f6e..7ed9c0601 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -633,9 +633,9 @@ }, "TT": { "click_tests": { -"TT_test_autolock.py::test_autolock_interrupts_passphrase": "ecfc5031f2842460510451aa5345b3dd946f8041ebf24afe89c3cdb96f0bfcdd", +"TT_test_autolock.py::test_autolock_interrupts_passphrase": "8e45b1e888f0d4a7df02cd3b41407cf8fb83389ba9faceb7eb75e45e56ce2d72", "TT_test_autolock.py::test_autolock_interrupts_signing": "59666e372f5c10ef2ed10427829a128d5bf4fbf4e7a4792f51327e34e4328d74", -"TT_test_autolock.py::test_autolock_passphrase_keyboard": "ce176c566cc895b2532e36752fe1c3d817073ca6f62587333bf13dc1834e0beb", +"TT_test_autolock.py::test_autolock_passphrase_keyboard": "0ff48a1a94222cce776b6c261c1a20167d71b970ee9a9ee5254db942f3aec970", "TT_test_autolock.py::test_dryrun_enter_word_slowly": "cf9761167b8b155c60db2da5a4a6a689dd9f598e9551e06b21551851d6873e2d", "TT_test_autolock.py::test_dryrun_locks_at_number_of_words": "aa479397af496496db214b5debb4ab4d30c0e8e7b347ec3169bb76aaf5ce735b", "TT_test_autolock.py::test_dryrun_locks_at_word_entry": "145c53e02422062fd3d6b2c48b624ef85f2c54d153fc583acfdd7fb3a62b2a6b",