1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

fix(tests): increase delay between click test button presses

[no changelog]
This commit is contained in:
Martin Milata 2023-02-07 15:54:48 +01:00
parent 7a375b5642
commit 034947985a
2 changed files with 10 additions and 9 deletions

View File

@ -14,6 +14,7 @@
# You should have received a copy of the License along with this library. # You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. # If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import math
import time import time
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@ -110,13 +111,13 @@ def test_autolock_passphrase_keyboard(device_handler: "BackgroundDeviceHandler")
assert layout.text == "< PassphraseKeyboard >" assert layout.text == "< PassphraseKeyboard >"
CENTER_BUTTON = buttons.grid35(1, 2) CENTER_BUTTON = buttons.grid35(1, 2)
# total sleep time: 11 * 1.1 = 12.1 seconds # keep clicking for long enough to trigger the autolock if it incorrectly ignored key presses
for _ in range(11): for _ in range(math.ceil(11 / 1.5)):
debug.click(CENTER_BUTTON) debug.click(CENTER_BUTTON)
time.sleep(1.1) time.sleep(1.5)
debug.click(buttons.OK, wait=True) debug.click(buttons.OK, wait=True)
assert device_handler.result() == "mzAZ4BgqmFHYxhPgdFH2pR2h1X7jJrNFSs" assert device_handler.result() == "mnF4yRWJXmzRB6EuBzuVigqeqTqirQupxJ"
@pytest.mark.setup_client(pin=PIN4, passphrase=True) @pytest.mark.setup_client(pin=PIN4, passphrase=True)
@ -132,10 +133,10 @@ def test_autolock_interrupts_passphrase(device_handler: "BackgroundDeviceHandler
assert layout.text == "< PassphraseKeyboard >" assert layout.text == "< PassphraseKeyboard >"
CENTER_BUTTON = buttons.grid35(1, 2) CENTER_BUTTON = buttons.grid35(1, 2)
# total sleep time: 5 * 1.1 = 5.5 seconds # autolock must activate even if we pressed some buttons
for _ in range(5): for _ in range(math.ceil(6 / 1.5)):
debug.click(CENTER_BUTTON) debug.click(CENTER_BUTTON)
time.sleep(1.1) time.sleep(1.5)
# wait for autolock to kick in # wait for autolock to kick in
time.sleep(10.1) time.sleep(10.1)

View File

@ -633,9 +633,9 @@
}, },
"TT": { "TT": {
"click_tests": { "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_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_enter_word_slowly": "cf9761167b8b155c60db2da5a4a6a689dd9f598e9551e06b21551851d6873e2d",
"TT_test_autolock.py::test_dryrun_locks_at_number_of_words": "aa479397af496496db214b5debb4ab4d30c0e8e7b347ec3169bb76aaf5ce735b", "TT_test_autolock.py::test_dryrun_locks_at_number_of_words": "aa479397af496496db214b5debb4ab4d30c0e8e7b347ec3169bb76aaf5ce735b",
"TT_test_autolock.py::test_dryrun_locks_at_word_entry": "145c53e02422062fd3d6b2c48b624ef85f2c54d153fc583acfdd7fb3a62b2a6b", "TT_test_autolock.py::test_dryrun_locks_at_word_entry": "145c53e02422062fd3d6b2c48b624ef85f2c54d153fc583acfdd7fb3a62b2a6b",