diff --git a/tests/click_tests/common.py b/tests/click_tests/common.py index b82384a1ca..d4361f0e84 100644 --- a/tests/click_tests/common.py +++ b/tests/click_tests/common.py @@ -27,6 +27,8 @@ class CommonPass: EMPTY_ADDRESS = "mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q" + MULTI_CATEGORY = "as12 *&_N" + class PassphraseCategory(Enum): MENU = "MENU" diff --git a/tests/click_tests/test_passphrase_mercury.py b/tests/click_tests/test_passphrase_mercury.py index 9bed04da84..4a0ad25eb2 100644 --- a/tests/click_tests/test_passphrase_mercury.py +++ b/tests/click_tests/test_passphrase_mercury.py @@ -70,6 +70,9 @@ DA_51_ADDRESS = DA_50_ADDRESS assert len(DA_51) == 51 assert DA_51_ADDRESS == DA_50_ADDRESS +# pending + entered character is shown for 1 + 1 seconds, so the delay must be grater +DELAY_S = 2.1 + def get_passphrase_choices(char: str) -> tuple[str, ...]: if char in " *#": @@ -176,6 +179,11 @@ def enter_passphrase(debug: "DebugLink") -> None: debug.click(buttons.MERCURY_YES) +def show_passphrase(debug: "DebugLink") -> None: + """See the passphrase""" + debug.click(buttons.TOP_ROW) + + def delete_char(debug: "DebugLink") -> None: """Deletes the last char""" coords = buttons.pin_passphrase_grid(9) @@ -329,3 +337,16 @@ def test_cycle_through_last_character( passphrase = DA_49 + "i" # for i we need to cycle through "ghi" three times input_passphrase(debug, passphrase) enter_passphrase(debug) + + +@pytest.mark.setup_client(passphrase=True) +def test_last_char_timeout(device_handler: "BackgroundDeviceHandler"): + with prepare_passphrase_dialogue(device_handler) as debug: + for character in CommonPass.MULTI_CATEGORY: + # insert a digit + input_passphrase(debug, character) + # wait until the last digit is hidden + time.sleep(DELAY_S) + # show the entire PIN + show_passphrase(debug) + enter_passphrase(debug) diff --git a/tests/click_tests/test_passphrase_tr.py b/tests/click_tests/test_passphrase_tr.py index 57685451ba..79165e9376 100644 --- a/tests/click_tests/test_passphrase_tr.py +++ b/tests/click_tests/test_passphrase_tr.py @@ -14,6 +14,7 @@ # You should have received a copy of the License along with this library. # If not, see . +import time from contextlib import contextmanager from typing import TYPE_CHECKING, Generator, Optional @@ -54,6 +55,9 @@ AAA_51_ADDRESS = "miPeCUxf1Ufh5DtV3AuBopNM8YEDvnQZMh" assert len(AAA_51) == 51 assert AAA_51_ADDRESS == AAA_50_ADDRESS +# entered character is shown for 1 second, so the delay must be grater +DELAY_S = 1.1 + BACK = "inputs__back" SHOW = "inputs__show" @@ -264,3 +268,16 @@ def test_passphrase_loop_all_characters(device_handler: "BackgroundDeviceHandler go_to_category(debug, PassphraseCategory.MENU, use_carousel=False) enter_passphrase(debug) + + +@pytest.mark.setup_client(passphrase=True) +def test_last_char_timeout(device_handler: "BackgroundDeviceHandler"): + with prepare_passphrase_dialogue(device_handler) as debug: + for character in CommonPass.MULTI_CATEGORY: + # insert a digit + input_passphrase(debug, character) + # wait until the last digit is hidden + time.sleep(DELAY_S) + # show the entire PIN + show_passphrase(debug) + enter_passphrase(debug) diff --git a/tests/click_tests/test_passphrase_tt.py b/tests/click_tests/test_passphrase_tt.py index 8f490c0309..504fac333b 100644 --- a/tests/click_tests/test_passphrase_tt.py +++ b/tests/click_tests/test_passphrase_tt.py @@ -63,6 +63,9 @@ DA_51_ADDRESS = DA_50_ADDRESS assert len(DA_51) == 51 assert DA_51_ADDRESS == DA_50_ADDRESS +# pending + entered character is shown for 1 + 1 seconds, so the delay must be grater +DELAY_S = 2.1 + @contextmanager def prepare_passphrase_dialogue( @@ -145,6 +148,11 @@ def enter_passphrase(debug: "DebugLink") -> None: debug.click(coords) +def show_passphrase(debug: "DebugLink") -> None: + """See the passphrase""" + debug.click(buttons.TOP_ROW) + + def delete_char(debug: "DebugLink") -> None: """Deletes the last char""" coords = buttons.pin_passphrase_grid(9) @@ -296,3 +304,16 @@ def test_cycle_through_last_character( passphrase = DA_49 + "i" # for i we need to cycle through "ghi" three times input_passphrase(debug, passphrase) enter_passphrase(debug) + + +@pytest.mark.setup_client(passphrase=True) +def test_last_char_timeout(device_handler: "BackgroundDeviceHandler"): + with prepare_passphrase_dialogue(device_handler) as debug: + for character in CommonPass.MULTI_CATEGORY: + # insert a digit + input_passphrase(debug, character) + # wait until the last digit is hidden + time.sleep(DELAY_S) + # show the entire PIN + show_passphrase(debug) + enter_passphrase(debug)