From c857fcdc2f70fa1b7451593a98b443aae6bd9dce Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Tue, 9 Jul 2024 01:41:29 +0200 Subject: [PATCH] test(core): T3T1 ShowDeviceTutorial [no changelog] --- .../test_msg_show_device_tutorial.py | 37 +++++++++++++++++++ tests/input_flows.py | 27 ++++++++++++++ tests/ui_tests/fixtures.json | 10 +++++ 3 files changed, 74 insertions(+) create mode 100644 tests/device_tests/test_msg_show_device_tutorial.py diff --git a/tests/device_tests/test_msg_show_device_tutorial.py b/tests/device_tests/test_msg_show_device_tutorial.py new file mode 100644 index 0000000000..47bb62f192 --- /dev/null +++ b/tests/device_tests/test_msg_show_device_tutorial.py @@ -0,0 +1,37 @@ +# This file is part of the Trezor project. +# +# Copyright (C) 2012-2024 SatoshiLabs and contributors +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the License along with this library. +# If not, see . + +import pytest + +from trezorlib import device +from trezorlib.debuglink import TrezorClientDebugLink as Client + +from ..input_flows import InputFlowTutorial + + +# TODO not initialized? +@pytest.mark.setup_client(uninitialized=True) +@pytest.mark.skip_t1b1 +@pytest.mark.skip_t2b1 +@pytest.mark.skip_t2t1 +@pytest.mark.parametrize("cancel", (True, False)) +def test_tutorial_t3t1(client: Client, cancel: bool): + with client: + IF = InputFlowTutorial(client, cancel=cancel) + client.set_input_flow(IF.get()) + device.show_device_tutorial(client) + + assert client.features.initialized is False diff --git a/tests/input_flows.py b/tests/input_flows.py index 70ea07a44f..c71e2070de 100644 --- a/tests/input_flows.py +++ b/tests/input_flows.py @@ -2293,3 +2293,30 @@ class InputFlowConfirmAllWarnings(InputFlowBase): else: self.debug.press_yes() br = yield + + +class InputFlowTutorial(InputFlowBase): + def __init__(self, client: Client, cancel: bool = False): + super().__init__(client) + self.cancel = cancel + + def input_flow_t3t1(self) -> BRGeneratorType: + yield + self.debug.click(buttons.TAP_TO_CONFIRM, wait=True) + self.debug.swipe_up(wait=True) + self.debug.swipe_up(wait=True) + if self.cancel: + self.debug.click(buttons.CORNER_BUTTON, wait=True) + self.debug.click(buttons.VERTICAL_MENU[0], wait=True) + self.debug.click(buttons.CORNER_BUTTON, wait=True) + self.debug.click(buttons.VERTICAL_MENU[1], wait=True) + self.debug.swipe_up(wait=True) + self.debug.swipe_up(wait=True) + self.debug.click(buttons.CORNER_BUTTON, wait=True) + self.debug.click(buttons.VERTICAL_MENU[2], wait=True) + self.debug.click(buttons.TAP_TO_CONFIRM, wait=True) + self.debug.swipe_up(wait=True) + else: + self.debug.swipe_up(wait=True) + self.debug.click(buttons.TAP_TO_CONFIRM, wait=True) + self.debug.swipe_up(wait=True) diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index 1cb52a879b..a4d3578e95 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -16833,6 +16833,8 @@ "T3T1_cs_test_msg_sd_protect.py::test_enable_disable": "8da52dc761d4eacb3a863864b948d5a572980563118b456527acbd05ef126af4", "T3T1_cs_test_msg_sd_protect.py::test_refresh": "a6f842c917efdd62369a4f911fd5061d1e39c5557d0daf1b7af4a4ecbaccaa00", "T3T1_cs_test_msg_sd_protect.py::test_wipe": "59c3fe698e1b61c7d8d58258764d80bb41e94ef248688bc4ce287e3a5cbf9bbd", +"T3T1_cs_test_msg_show_device_tutorial.py::test_tutorial_t3t1[False]": "49b728c5299c3f8ceeed9595dd407c6940cc7bde3c77e34e22cce90262b1f44a", +"T3T1_cs_test_msg_show_device_tutorial.py::test_tutorial_t3t1[True]": "a459905ea805dd3b02e7748bdfd6c641a005ab6b22a13d74c75b2281a4aa5e51", "T3T1_cs_test_msg_wipedevice.py::test_autolock_not_retained": "f4bec18c2bc8fa5b78154cc654e5ebe72b490672b2fe85be9e3d835f9f6787f3", "T3T1_cs_test_msg_wipedevice.py::test_wipe_device": "40a7391636fb753cb23571e00f1bf2259b159c5917b1f2f62fd15470b1156516", "T3T1_cs_test_passphrase_slip39_advanced.py::test_128bit_passphrase": "f0f5d5aa30d7d5cd8da49fef8ad632f6055b22826418728a5502b3e0f909fc0f", @@ -18178,6 +18180,8 @@ "T3T1_de_test_msg_sd_protect.py::test_enable_disable": "b72176473ecb6213e331528b2624a3fabc5ed8e669a73b4cd25ba58232365984", "T3T1_de_test_msg_sd_protect.py::test_refresh": "f9335bfc0cc27036a247e9e898a0c984a8e9aa34a90bbede111221ba4ef1b284", "T3T1_de_test_msg_sd_protect.py::test_wipe": "93cdc75a6112304054f645d19c0ef17fc32bd2f1e3abf7b2b90a3d204c72a328", +"T3T1_de_test_msg_show_device_tutorial.py::test_tutorial_t3t1[False]": "9ca49844a75ac43f361232a76fe360f5ec1652a05f6c427f35b687798151b102", +"T3T1_de_test_msg_show_device_tutorial.py::test_tutorial_t3t1[True]": "b74617a1a728933e965d6964b5502be7b3ca9a3227d23623ad07a2ed18eb9117", "T3T1_de_test_msg_wipedevice.py::test_autolock_not_retained": "000904338e45c805390ee084831438abace2c8f8020aa054ac929e6bd21ce522", "T3T1_de_test_msg_wipedevice.py::test_wipe_device": "ee901f817ed7a3c6038b9c32eee7c8e7843fdcdadbd2d5633de9978dcb9ba469", "T3T1_de_test_passphrase_slip39_advanced.py::test_128bit_passphrase": "179ffe4191ed9e8e281f68dcf259269312aed11903fea363c6fd326e2784b64d", @@ -19523,6 +19527,8 @@ "T3T1_en_test_msg_sd_protect.py::test_enable_disable": "ef4a453a3b9fea0482efbfe81211d0d144d53ecaa3cda7089dadadd03bfd9d6b", "T3T1_en_test_msg_sd_protect.py::test_refresh": "030f7ca3d8ed718340b2311f66af1adea2cfc685f6a94ca07abda09f79f7fe5a", "T3T1_en_test_msg_sd_protect.py::test_wipe": "0a8bcb6567ecbfadb48f0bde53367a383faa6796354fa2de04ede1cc08da64d4", +"T3T1_en_test_msg_show_device_tutorial.py::test_tutorial_t3t1[False]": "2f39eedba0ef8010f232b77606c453e06e63c74a54f08117a60066d64412e589", +"T3T1_en_test_msg_show_device_tutorial.py::test_tutorial_t3t1[True]": "8908a0d44786f8d60477d04f54dbdb28a059358bc04f093daf4129c89e6b529b", "T3T1_en_test_msg_wipedevice.py::test_autolock_not_retained": "afc88dd78d678a5438a060572e1738ae2186894a2952aaee59b29ff92831d403", "T3T1_en_test_msg_wipedevice.py::test_wipe_device": "2f83c328124f022f5a8b8e27a56cd9b8e520d23db8a91ec0bf72f463ed198d31", "T3T1_en_test_passphrase_slip39_advanced.py::test_128bit_passphrase": "6def6c3c6ecd03c7345cce0ab75f71e9e76b45e047f1026b8149f6676048d748", @@ -20868,6 +20874,8 @@ "T3T1_es_test_msg_sd_protect.py::test_enable_disable": "c61dc1ac8bcd22c99901925d03e0525a3d6ce151b4fcffa4aff6e3a3ba40e7da", "T3T1_es_test_msg_sd_protect.py::test_refresh": "8a0af022678a5340f20619d38cecfeacc5d1c3cba0a205a5e0593f8eedbbbb82", "T3T1_es_test_msg_sd_protect.py::test_wipe": "c61091b534a94f870c937819d6cc81005dbd5aab7acbcaed8eddfaa4393b77e9", +"T3T1_es_test_msg_show_device_tutorial.py::test_tutorial_t3t1[False]": "324856403c2cc8a54f9ba167845e37e8adb8f7ecbc212227aa3422aeec6b05c0", +"T3T1_es_test_msg_show_device_tutorial.py::test_tutorial_t3t1[True]": "c7f6ff6fc460b7e310c1ca1c1e2b07a208e8deca1c99f74a2cce91c2a16a1b5b", "T3T1_es_test_msg_wipedevice.py::test_autolock_not_retained": "201d5b07bb64be2b607bb22ae004c8369391123e360481db835842ee73b49da4", "T3T1_es_test_msg_wipedevice.py::test_wipe_device": "2c28b43c64a91f6ced3f7db4f06ddb1b347d932f95b0cb1aa0518cae5ca5c0cf", "T3T1_es_test_passphrase_slip39_advanced.py::test_128bit_passphrase": "3034969f1ef1dd6ba774b7ea5828066b7688da1efb1d89fe86bd0ed657cc387b", @@ -22213,6 +22221,8 @@ "T3T1_fr_test_msg_sd_protect.py::test_enable_disable": "769a5349ecd4f2140187f0789c8b300f34d63b54606e4e6bb8454268cad39e32", "T3T1_fr_test_msg_sd_protect.py::test_refresh": "c7d2f2c025a11857c453507b0ccd5c3ff4b00103d91adfe39e67bd2a51556085", "T3T1_fr_test_msg_sd_protect.py::test_wipe": "4a38e7cbed38d10ff2f7a24d6788cdd20a75057f2e70c583b938c42d8ef98dcf", +"T3T1_fr_test_msg_show_device_tutorial.py::test_tutorial_t3t1[False]": "8367ee29080faf467cde999256920cc18e3d0238e05dee16b4502519443b2263", +"T3T1_fr_test_msg_show_device_tutorial.py::test_tutorial_t3t1[True]": "88c706fa341925c54fbab47e335a596a8ec0880c9312701e78ae37bcdad18e36", "T3T1_fr_test_msg_wipedevice.py::test_autolock_not_retained": "41a16c6f838b79b53b2bca3f2bb73410bb26320e92477eea6732ce3cdca20074", "T3T1_fr_test_msg_wipedevice.py::test_wipe_device": "9fb4e1ccdc0df2f0c2e597e35e44391c3582f2ffb3c364c15de37ca29fbed4b8", "T3T1_fr_test_passphrase_slip39_advanced.py::test_128bit_passphrase": "e66c1e71edd702b180073acf2fc7629c1eb51f50f7d3d0f4e5843abd2fab3c2f",