diff --git a/Makefile b/Makefile index 661495e..7b1e933 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ #******************************************************************************* # Ledger App -# (c) 2017 Ledger +# (c) 2017-2024 Ledger # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ all: default APPNAME ="Passwords" APPVERSION_M=1 -APPVERSION_N=2 +APPVERSION_N=3 APPVERSION_P=0 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) @@ -37,10 +37,11 @@ HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1 DEFINES += APPNAME=\"$(APPNAME)\" -ICON_NANOS = icons/nanos_icon_password_manager.gif -ICON_NANOSP = icons/nanox_icon_password_manager.gif -ICON_NANOX = icons/nanox_icon_password_manager.gif -ICON_STAX = icons/stax_icon_password_manager_32px.gif +ICON_NANOS = icons/nanos_icon_passwords.gif +ICON_NANOSP = icons/nanox_icon_passwords.gif +ICON_NANOX = icons/nanox_icon_passwords.gif +ICON_STAX = icons/stax_icon_passwords.gif +ICON_FLEX = icons/flex_icon_passwords.gif DEFINES += OS_IO_SEPROXYHAL DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64 HAVE_USB_APDU @@ -58,10 +59,9 @@ else DEFINES += TESTING endif -ifneq ($(TARGET_NAME), TARGET_STAX) +ifneq ($(TARGET_NAME), $(filter $(TARGET_NAME), TARGET_STAX TARGET_FLEX)) $(info Using BAGL) DEFINES += HAVE_BAGL - DEFINES += HAVE_UX_FLOW ifneq ($(TARGET_NAME), TARGET_NANOS) DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 DEFINES += HAVE_GLO096 diff --git a/icons/flex_icon_passwords.gif b/icons/flex_icon_passwords.gif new file mode 100644 index 0000000..91d6031 Binary files /dev/null and b/icons/flex_icon_passwords.gif differ diff --git a/icons/nanos_icon_password_manager.gif b/icons/nanos_icon_passwords.gif similarity index 100% rename from icons/nanos_icon_password_manager.gif rename to icons/nanos_icon_passwords.gif diff --git a/icons/nanox_icon_password_manager.gif b/icons/nanox_icon_passwords.gif similarity index 100% rename from icons/nanox_icon_password_manager.gif rename to icons/nanox_icon_passwords.gif diff --git a/icons/stax_icon_password_manager_32px.gif b/icons/stax_icon_passwords.gif similarity index 100% rename from icons/stax_icon_password_manager_32px.gif rename to icons/stax_icon_passwords.gif diff --git a/ledger_app.toml b/ledger_app.toml index 1876ba8..47d5e77 100644 --- a/ledger_app.toml +++ b/ledger_app.toml @@ -1,6 +1,6 @@ [app] build_directory="." -devices = ["nanos", "nanos+", "nanox", "stax"] +devices = ["nanos", "nanos+", "nanox", "stax", "flex"] sdk = "c" [tests] diff --git a/src/app_main.c b/src/app_main.c index b9d570c..1b8948b 100644 --- a/src/app_main.c +++ b/src/app_main.c @@ -58,7 +58,8 @@ void app_main() { create_new_password("password1", sizeof("password1") - 1); create_new_password("password2", sizeof("password2") - 1); create_new_password("password3", sizeof("password3") - 1); -#endif +#endif // POPULATE + for (;;) { BEGIN_TRY { TRY { diff --git a/src/keyboards/keyboard.h b/src/keyboards/keyboard.h index 1e1148f..6382aeb 100644 --- a/src/keyboards/keyboard.h +++ b/src/keyboards/keyboard.h @@ -17,7 +17,7 @@ #pragma once -#if !defined(TARGET_STAX) +#if !defined(SCREEN_SIZE_WALLET) #include #include diff --git a/src/keyboards/keyboard_common.c b/src/keyboards/keyboard_common.c index 29ae9b2..e2ac2d5 100644 --- a/src/keyboards/keyboard_common.c +++ b/src/keyboards/keyboard_common.c @@ -5,7 +5,7 @@ #include "keyboard.h" -#if !defined(TARGET_STAX) +#if !defined(SCREEN_SIZE_WALLET) void bolos_ux_hslider3_init(unsigned int total_count) { G_keyboard_ctx.hslider3_total = total_count; diff --git a/src/keyboards/text_keyboard.c b/src/keyboards/text_keyboard.c index be0e8ea..d744676 100644 --- a/src/keyboards/text_keyboard.c +++ b/src/keyboards/text_keyboard.c @@ -3,7 +3,7 @@ #include #include -#if !defined(TARGET_STAX) +#if !defined(SCREEN_SIZE_WALLET) #include "keyboard.h" diff --git a/src/nano/ui.c b/src/nano/ui.c index 1e5d9d9..c756b1e 100644 --- a/src/nano/ui.c +++ b/src/nano/ui.c @@ -3,7 +3,7 @@ #include #include -#if !defined(TARGET_STAX) +#if !defined(SCREEN_SIZE_WALLET) #include @@ -638,4 +638,4 @@ void ui_idle() { } } -#endif // if !defined(TARGET_STAX) +#endif // if !defined(SCREEN_SIZE_WALLET) diff --git a/src/stax/password_list.c b/src/nbgl/password_list.c similarity index 100% rename from src/stax/password_list.c rename to src/nbgl/password_list.c diff --git a/src/stax/password_list.h b/src/nbgl/password_list.h similarity index 95% rename from src/stax/password_list.h rename to src/nbgl/password_list.h index 91165c8..42fb21c 100644 --- a/src/stax/password_list.h +++ b/src/nbgl/password_list.h @@ -4,7 +4,7 @@ #define DISPLAYED_PASSWORD_PER_PAGE 5 -#if defined(TARGET_STAX) +#if defined(SCREEN_SIZE_WALLET) void password_list_reset(); diff --git a/src/stax/ui.c b/src/nbgl/ui.c similarity index 85% rename from src/stax/ui.c rename to src/nbgl/ui.c index 9ddfda8..04b0b71 100644 --- a/src/stax/ui.c +++ b/src/nbgl/ui.c @@ -1,6 +1,6 @@ /******************************************************************************* * Password Manager application - * (c) 2017-2023 Ledger SAS + * (c) 2017-2024 Ledger SAS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ #include #include -#if defined(TARGET_STAX) +#if defined(SCREEN_SIZE_WALLET) #include #include @@ -97,13 +97,15 @@ static const char *const infoTypes[] = {"Version", "Passwords"}; static const char *const infoContents[] = {APPVERSION, "(c) 2017-2023 Ledger"}; static const char *const availableKbl[] = {"QWERTY", "QWERTY INT.", "AZERTY"}; -#define SETTINGS_CHARSET_OPTIONS_NUMBER 5 -#define SETTINGS_KEYBOARD_OPTIONS_NUMBER 3 -#define SETTINGS_MISC_OPTIONS_NUMBER 1 -#define SETTINGS_INFO_NUMBER 2 -#define SETTINGS_PAGE_NUMBER 4 +#define SETTINGS_FIRST_PAGE_STAX_OPTIONS_NUMBER 5 +#define SETTINGS_FIRST_PAGE_FLEX_OPTIONS_NUMBER 4 +#define SETTINGS_SECOND_PAGE_STAX_OPTIONS_NUMBER 1 +#define SETTINGS_SECOND_PAGE_FLEX_OPTIONS_NUMBER 2 +#define SETTINGS_KEYBOARD_OPTIONS_NUMBER 3 +#define SETTINGS_INFO_NUMBER 2 +#define SETTINGS_PAGE_NUMBER 4 -static nbgl_layoutSwitch_t switches[SETTINGS_CHARSET_OPTIONS_NUMBER]; +static nbgl_layoutSwitch_t switches[SETTINGS_FIRST_PAGE_STAX_OPTIONS_NUMBER]; static void _prepare_kbl_choice(nbgl_pageContent_t *content) { content->type = CHOICES_LIST; @@ -149,22 +151,39 @@ static bool display_settings_navigation(uint8_t page, nbgl_pageContent_t *conten .subText = "('-', ' ', '_')", .token = BARS_TOKEN, .tuneId = TUNE_TAP_CASUAL}; +#if defined(TARGET_STAX) switches[4] = (nbgl_layoutSwitch_t){.initState = has_charset_option(EXT_SYMBOLS_BITFLAG), .text = "Use special characters", .subText = NULL, .token = EXT_SYMBOLS_TOKEN, .tuneId = TUNE_TAP_CASUAL}; + content->switchesList.nbSwitches = SETTINGS_FIRST_PAGE_STAX_OPTIONS_NUMBER; +#else // TARGET_STAX + content->switchesList.nbSwitches = SETTINGS_FIRST_PAGE_FLEX_OPTIONS_NUMBER; +#endif // TARGET_STAX content->type = SWITCHES_LIST; - content->switchesList.nbSwitches = SETTINGS_CHARSET_OPTIONS_NUMBER; content->switchesList.switches = &switches[0]; } else if (page == 1) { - switches[0] = (nbgl_layoutSwitch_t){.initState = N_storage.press_enter_after_typing, - .text = "Press enter", - .subText = "after writing the password", - .token = NO_ENTER_TOKEN, + size_t index_after_charset = 0; +#if defined(TARGET_FLEX) + switches[0] = (nbgl_layoutSwitch_t){.initState = has_charset_option(EXT_SYMBOLS_BITFLAG), + .text = "Use special characters", + .subText = NULL, + .token = EXT_SYMBOLS_TOKEN, .tuneId = TUNE_TAP_CASUAL}; + index_after_charset++; + content->switchesList.nbSwitches = SETTINGS_SECOND_PAGE_FLEX_OPTIONS_NUMBER; +#else // TARGET_FLEX + content->switchesList.nbSwitches = SETTINGS_SECOND_PAGE_STAX_OPTIONS_NUMBER; +#endif // TARGET_FLEX + switches[index_after_charset] = + (nbgl_layoutSwitch_t){.initState = N_storage.press_enter_after_typing, + .text = "Press enter", + .subText = "after writing the password", + .token = NO_ENTER_TOKEN, + .tuneId = TUNE_TAP_CASUAL}; + content->type = SWITCHES_LIST; - content->switchesList.nbSwitches = SETTINGS_MISC_OPTIONS_NUMBER; content->switchesList.switches = &switches[0]; } else if (page == 2) { _prepare_kbl_choice(content); @@ -241,7 +260,11 @@ static void display_settings_page() { * Password creation & callback */ static char password_name[MAX_METANAME + 1] = {0}; -static int textIndex, keyboardIndex = 0; + +#if API_LEVEL <= 15 +static int textIndex = 0; +#endif // API_LEVEL <= 15 +static int keyboardIndex = 0; static void create_password(void) { PRINTF("Creating new password '%s'\n", password_name); @@ -293,8 +316,27 @@ static void key_press_callback(const char touchedKey) { // every characters mask = -1; } + PRINTF("New password name: '%s'\n", password_name); nbgl_layoutUpdateKeyboard(layoutContext, keyboardIndex, mask, false, LOWER_CASE); +#if API_LEVEL <= 15 // TODO: to be removed once Stax API_LEVEL goes from 15 to 18 nbgl_layoutUpdateEnteredText(layoutContext, textIndex, false, 0, &(password_name[0]), false); +#else + nbgl_layoutConfirmationButton_t confirmationButton = {.active = true, + .token = CREATE_TOKEN, + .text = PIC("Create password")}; + nbgl_layoutKeyboardContent_t keyboardContent = { + .type = KEYBOARD_WITH_BUTTON, + .title = "New password nickname", + .text = password_name, + .numbered = false, + .number = 0, + .grayedOut = false, + .textToken = KBD_TEXT_TOKEN, + .confirmationButton = confirmationButton, + .tuneId = CREATE_TOKEN, + }; + nbgl_layoutUpdateKeyboardContent(layoutContext, &keyboardContent); +#endif nbgl_refreshSpecialWithPostRefresh(BLACK_AND_WHITE_REFRESH, POST_REFRESH_FORCE_POWER_ON); } @@ -318,12 +360,14 @@ static void display_create_pwd_page() { nbgl_layoutAddProgressIndicator(layoutContext, 0, 0, true, BACK_BUTTON_TOKEN, TUNE_TAP_CASUAL); nbgl_layoutAddCenteredInfo(layoutContext, ¢eredInfo); keyboardIndex = nbgl_layoutAddKeyboard(layoutContext, &kbdInfo); + strlcpy(password_name, "", 1); + +#if API_LEVEL <= 15 // TODO: to be removed once Stax API_LEVEL goes from 15 to 18 nbgl_layoutAddConfirmationButton(layoutContext, true, "Create password", CREATE_TOKEN, TUNE_TAP_CASUAL); - strlcpy(password_name, "", 1); textIndex = nbgl_layoutAddEnteredText(layoutContext, false, 0, @@ -331,6 +375,23 @@ static void display_create_pwd_page() { false, 32, KBD_TEXT_TOKEN); +#else // API_LEVEL <= 15 + nbgl_layoutConfirmationButton_t confirmationButton = {.active = true, + .token = CREATE_TOKEN, + .text = PIC("Create password")}; + nbgl_layoutKeyboardContent_t keyboardContent = { + .type = KEYBOARD_WITH_BUTTON, + .title = PIC("New password nickname"), + .text = &(password_name[0]), + .numbered = false, + .number = 0, + .grayedOut = false, + .textToken = KBD_TEXT_TOKEN, + .confirmationButton = confirmationButton, + .tuneId = CREATE_TOKEN, + }; + nbgl_layoutAddKeyboardContent(layoutContext, &keyboardContent); +#endif // API_LEVEL <= 15 nbgl_layoutDraw(layoutContext); } @@ -680,14 +741,19 @@ void startup_callback(bool choice) { } void ui_idle() { - // First start: the keyboard layout is not selected yet if (N_storage.keyboard_layout == HID_MAPPING_NONE) { nbgl_useCaseChoice( &C_stax_icon_password_manager_64px, "Disclaimer", - "Be sure to backup your passwords every time you\nupdate either your device" - "\nOS or this application:\nhttps://passwords.ledger.com\n\nIf not, they " +#if defined(TARGET_STAX) + "Be sure to backup your passwords every time you update either your device " + "OS or this application: https://passwords.ledger.com\n\nIf not, they " "will be lost.", +#else // TARGET_STAX + "Be sure to backup your passwords every time you update either your device " + "OS or this application: https://passwords.ledger.com\nIf not, they " + "will be lost.", +#endif "Yes, I understand", "No, this is too complicated", startup_callback); @@ -695,6 +761,7 @@ void ui_idle() { display_home_page(); } } + void ui_request_user_approval(message_pair_t *msg) { display_approval_page(msg); } diff --git a/src/options.c b/src/options.c index 26e452c..31d89dd 100644 --- a/src/options.c +++ b/src/options.c @@ -4,7 +4,7 @@ #include "options.h" #include "globals.h" -#if !defined(TARGET_STAX) +#if !defined(SCREEN_SIZE_WALLET) static uint8_t charset_options; @@ -26,7 +26,7 @@ uint8_t get_charset_options() { return N_storage.charset_options; } -#endif // !defined(TARGET_STAX) +#endif // !defined(SCREEN_SIZE_WALLET) void init_charset_options() { // default: uppercase (1) + lowercase (2) + numbers (4) = 7 diff --git a/src/types.h b/src/types.h index d5f6938..9d54d2a 100644 --- a/src/types.h +++ b/src/types.h @@ -16,7 +16,7 @@ typedef struct internalStorage_t { */ size_t metadata_count; uint8_t metadatas[MAX_METADATAS]; -#if defined(TARGET_STAX) +#if defined(SCREEN_SIZE_WALLET) uint8_t charset_options; #endif } internalStorage_t; diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 9aa21df..8b925ae 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -4,7 +4,8 @@ from passwordsManager_cmd import PasswordsManagerCommand from tests_vectors import tests_vectors -from stax.navigator import CustomStaxNavigator +from touch.navigator import CustomTouchNavigator + from ragger.conftest import configuration pytest_plugins = ("ragger.conftest.base_conftest", ) @@ -39,18 +40,21 @@ def cmd(custom_backend, firmware): @pytest.fixture -def navigator(custom_backend, firmware): - navigator = CustomStaxNavigator(custom_backend, firmware) +def navigator(custom_backend, firmware, golden_run): + navigator = CustomTouchNavigator(custom_backend, firmware, golden_run) yield navigator @pytest.fixture(autouse=True) def use_on_firmware(request, firmware): if request.node.get_closest_marker('use_on_firmware'): - current_firmware = request.node.get_closest_marker('use_on_firmware').args[0].lower() - if current_firmware != firmware.device: - pytest.skip(f'skipped on this firmware: "{firmware.device}" is not '\ - f'"{current_firmware}"') + accepted_firmwares = request.node.get_closest_marker('use_on_firmware').args[0] + if isinstance(accepted_firmwares, str): + accepted_firmwares = [accepted_firmwares] + + if firmware.device not in [f.lower() for f in accepted_firmwares]: + pytest.skip(f'skipped on this firmware: "{firmware.device}" is not in '\ + f'{accepted_firmwares}') def pytest_configure(config): diff --git a/tests/functional/passwordsManager_cmd.py b/tests/functional/passwordsManager_cmd.py index 8dc08fd..707d2a1 100644 --- a/tests/functional/passwordsManager_cmd.py +++ b/tests/functional/passwordsManager_cmd.py @@ -3,7 +3,8 @@ from exception import DeviceException from ragger.backend import BackendInterface from ragger.firmware import Firmware -from ragger.firmware.stax.positions import BUTTON_ABOVE_LOWER_MIDDLE +from ragger.firmware.touch.positions import FLEX_BUTTON_ABOVE_LOWER_MIDDLE, \ + STAX_BUTTON_ABOVE_LOWER_MIDDLE CLA_SDK: int = 0xb0 CLA: int = 0xe0 @@ -32,8 +33,10 @@ def __init__(self, self.approved: bool = False def approve(self): - if self.firmware.has_nbgl: - self.transport.finger_touch(*BUTTON_ABOVE_LOWER_MIDDLE) + if self.firmware == Firmware.STAX: + self.transport.finger_touch(*STAX_BUTTON_ABOVE_LOWER_MIDDLE) + elif self.firmware == Firmware.FLEX: + self.transport.finger_touch(*FLEX_BUTTON_ABOVE_LOWER_MIDDLE) else: self.transport.both_click() diff --git a/tests/functional/snapshots/flex/all_passwords_deleted_screen.png b/tests/functional/snapshots/flex/all_passwords_deleted_screen.png new file mode 100644 index 0000000..e8bd1e5 Binary files /dev/null and b/tests/functional/snapshots/flex/all_passwords_deleted_screen.png differ diff --git a/tests/functional/snapshots/flex/confirm_all_passwords_deletion.png b/tests/functional/snapshots/flex/confirm_all_passwords_deletion.png new file mode 100644 index 0000000..6ec33ee Binary files /dev/null and b/tests/functional/snapshots/flex/confirm_all_passwords_deletion.png differ diff --git a/tests/functional/snapshots/flex/confirm_password_deletion.png b/tests/functional/snapshots/flex/confirm_password_deletion.png new file mode 100644 index 0000000..6ef3f8a Binary files /dev/null and b/tests/functional/snapshots/flex/confirm_password_deletion.png differ diff --git a/tests/functional/snapshots/flex/create_password/00000.png b/tests/functional/snapshots/flex/create_password/00000.png new file mode 120000 index 0000000..7123e5c --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00000.png @@ -0,0 +1 @@ +../disclaimer.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00001.png b/tests/functional/snapshots/flex/create_password/00001.png new file mode 120000 index 0000000..b9898b8 --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00001.png @@ -0,0 +1 @@ +../startup_choose_kbl.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00002.png b/tests/functional/snapshots/flex/create_password/00002.png new file mode 120000 index 0000000..0357e9d --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00002.png @@ -0,0 +1 @@ +../home_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00003.png b/tests/functional/snapshots/flex/create_password/00003.png new file mode 120000 index 0000000..32b816e --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00003.png @@ -0,0 +1 @@ +../menu_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00004.png b/tests/functional/snapshots/flex/create_password/00004.png new file mode 120000 index 0000000..795d97e --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00004.png @@ -0,0 +1 @@ +../list_screen_populated.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00005.png b/tests/functional/snapshots/flex/create_password/00005.png new file mode 120000 index 0000000..32b816e --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00005.png @@ -0,0 +1 @@ +../menu_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00006.png b/tests/functional/snapshots/flex/create_password/00006.png new file mode 120000 index 0000000..c53f297 --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00006.png @@ -0,0 +1 @@ +../keyboard_screen_empty.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00007.png b/tests/functional/snapshots/flex/create_password/00007.png new file mode 120000 index 0000000..0123bbd --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00007.png @@ -0,0 +1 @@ +../keyboard_screen_n_text.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00008.png b/tests/functional/snapshots/flex/create_password/00008.png new file mode 120000 index 0000000..a19caa8 --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00008.png @@ -0,0 +1 @@ +../keyboard_screen_ne_text.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00009.png b/tests/functional/snapshots/flex/create_password/00009.png new file mode 120000 index 0000000..6f4e476 --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00009.png @@ -0,0 +1 @@ +../keyboard_screen_new_text.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00010.png b/tests/functional/snapshots/flex/create_password/00010.png new file mode 120000 index 0000000..b477a5a --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00010.png @@ -0,0 +1 @@ +../password_created_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00011.png b/tests/functional/snapshots/flex/create_password/00011.png new file mode 120000 index 0000000..32b816e --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00011.png @@ -0,0 +1 @@ +../menu_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/create_password/00012.png b/tests/functional/snapshots/flex/create_password/00012.png new file mode 120000 index 0000000..863a334 --- /dev/null +++ b/tests/functional/snapshots/flex/create_password/00012.png @@ -0,0 +1 @@ +../list_screen_populated_and_new.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_all_password/00000.png b/tests/functional/snapshots/flex/delete_all_password/00000.png new file mode 120000 index 0000000..7123e5c --- /dev/null +++ b/tests/functional/snapshots/flex/delete_all_password/00000.png @@ -0,0 +1 @@ +../disclaimer.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_all_password/00001.png b/tests/functional/snapshots/flex/delete_all_password/00001.png new file mode 120000 index 0000000..b9898b8 --- /dev/null +++ b/tests/functional/snapshots/flex/delete_all_password/00001.png @@ -0,0 +1 @@ +../startup_choose_kbl.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_all_password/00002.png b/tests/functional/snapshots/flex/delete_all_password/00002.png new file mode 120000 index 0000000..0357e9d --- /dev/null +++ b/tests/functional/snapshots/flex/delete_all_password/00002.png @@ -0,0 +1 @@ +../home_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_all_password/00003.png b/tests/functional/snapshots/flex/delete_all_password/00003.png new file mode 120000 index 0000000..32b816e --- /dev/null +++ b/tests/functional/snapshots/flex/delete_all_password/00003.png @@ -0,0 +1 @@ +../menu_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_all_password/00004.png b/tests/functional/snapshots/flex/delete_all_password/00004.png new file mode 120000 index 0000000..a7ba4fa --- /dev/null +++ b/tests/functional/snapshots/flex/delete_all_password/00004.png @@ -0,0 +1 @@ +../confirm_all_passwords_deletion.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_all_password/00005.png b/tests/functional/snapshots/flex/delete_all_password/00005.png new file mode 120000 index 0000000..ff910fe --- /dev/null +++ b/tests/functional/snapshots/flex/delete_all_password/00005.png @@ -0,0 +1 @@ +../all_passwords_deleted_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_all_password/00006.png b/tests/functional/snapshots/flex/delete_all_password/00006.png new file mode 120000 index 0000000..32b816e --- /dev/null +++ b/tests/functional/snapshots/flex/delete_all_password/00006.png @@ -0,0 +1 @@ +../menu_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_all_password/00007.png b/tests/functional/snapshots/flex/delete_all_password/00007.png new file mode 120000 index 0000000..4d19873 --- /dev/null +++ b/tests/functional/snapshots/flex/delete_all_password/00007.png @@ -0,0 +1 @@ +../list_screen_empty.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00000.png b/tests/functional/snapshots/flex/delete_one_password/00000.png new file mode 120000 index 0000000..7123e5c --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00000.png @@ -0,0 +1 @@ +../disclaimer.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00001.png b/tests/functional/snapshots/flex/delete_one_password/00001.png new file mode 120000 index 0000000..b9898b8 --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00001.png @@ -0,0 +1 @@ +../startup_choose_kbl.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00002.png b/tests/functional/snapshots/flex/delete_one_password/00002.png new file mode 120000 index 0000000..0357e9d --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00002.png @@ -0,0 +1 @@ +../home_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00003.png b/tests/functional/snapshots/flex/delete_one_password/00003.png new file mode 120000 index 0000000..32b816e --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00003.png @@ -0,0 +1 @@ +../menu_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00004.png b/tests/functional/snapshots/flex/delete_one_password/00004.png new file mode 120000 index 0000000..795d97e --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00004.png @@ -0,0 +1 @@ +../list_screen_populated.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00005.png b/tests/functional/snapshots/flex/delete_one_password/00005.png new file mode 120000 index 0000000..411e304 --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00005.png @@ -0,0 +1 @@ +../confirm_password_deletion.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00006.png b/tests/functional/snapshots/flex/delete_one_password/00006.png new file mode 120000 index 0000000..9e273d4 --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00006.png @@ -0,0 +1 @@ +../password_deleted_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00007.png b/tests/functional/snapshots/flex/delete_one_password/00007.png new file mode 120000 index 0000000..32b816e --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00007.png @@ -0,0 +1 @@ +../menu_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00008.png b/tests/functional/snapshots/flex/delete_one_password/00008.png new file mode 120000 index 0000000..659f0cd --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00008.png @@ -0,0 +1 @@ +../list_screen_populated_one_deleted.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/delete_one_password/00009.png b/tests/functional/snapshots/flex/delete_one_password/00009.png new file mode 120000 index 0000000..32b816e --- /dev/null +++ b/tests/functional/snapshots/flex/delete_one_password/00009.png @@ -0,0 +1 @@ +../menu_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/disclaimer.png b/tests/functional/snapshots/flex/disclaimer.png new file mode 100644 index 0000000..01a6617 Binary files /dev/null and b/tests/functional/snapshots/flex/disclaimer.png differ diff --git a/tests/functional/snapshots/flex/home_screen.png b/tests/functional/snapshots/flex/home_screen.png new file mode 100644 index 0000000..bf961ff Binary files /dev/null and b/tests/functional/snapshots/flex/home_screen.png differ diff --git a/tests/functional/snapshots/flex/keyboard_screen_empty.png b/tests/functional/snapshots/flex/keyboard_screen_empty.png new file mode 100644 index 0000000..86460a6 Binary files /dev/null and b/tests/functional/snapshots/flex/keyboard_screen_empty.png differ diff --git a/tests/functional/snapshots/flex/keyboard_screen_n_text.png b/tests/functional/snapshots/flex/keyboard_screen_n_text.png new file mode 100644 index 0000000..0c99b87 Binary files /dev/null and b/tests/functional/snapshots/flex/keyboard_screen_n_text.png differ diff --git a/tests/functional/snapshots/flex/keyboard_screen_ne_text.png b/tests/functional/snapshots/flex/keyboard_screen_ne_text.png new file mode 100644 index 0000000..06a445a Binary files /dev/null and b/tests/functional/snapshots/flex/keyboard_screen_ne_text.png differ diff --git a/tests/functional/snapshots/flex/keyboard_screen_new_text.png b/tests/functional/snapshots/flex/keyboard_screen_new_text.png new file mode 100644 index 0000000..186aa05 Binary files /dev/null and b/tests/functional/snapshots/flex/keyboard_screen_new_text.png differ diff --git a/tests/functional/snapshots/flex/list_screen_empty.png b/tests/functional/snapshots/flex/list_screen_empty.png new file mode 100644 index 0000000..e9d8068 Binary files /dev/null and b/tests/functional/snapshots/flex/list_screen_empty.png differ diff --git a/tests/functional/snapshots/flex/list_screen_populated.png b/tests/functional/snapshots/flex/list_screen_populated.png new file mode 100644 index 0000000..cb850f9 Binary files /dev/null and b/tests/functional/snapshots/flex/list_screen_populated.png differ diff --git a/tests/functional/snapshots/flex/list_screen_populated_and_new.png b/tests/functional/snapshots/flex/list_screen_populated_and_new.png new file mode 100644 index 0000000..b1423a3 Binary files /dev/null and b/tests/functional/snapshots/flex/list_screen_populated_and_new.png differ diff --git a/tests/functional/snapshots/flex/list_screen_populated_one_deleted.png b/tests/functional/snapshots/flex/list_screen_populated_one_deleted.png new file mode 100644 index 0000000..551533c Binary files /dev/null and b/tests/functional/snapshots/flex/list_screen_populated_one_deleted.png differ diff --git a/tests/functional/snapshots/flex/menu_screen.png b/tests/functional/snapshots/flex/menu_screen.png new file mode 100644 index 0000000..9483ac9 Binary files /dev/null and b/tests/functional/snapshots/flex/menu_screen.png differ diff --git a/tests/functional/snapshots/flex/password_created_screen.png b/tests/functional/snapshots/flex/password_created_screen.png new file mode 100644 index 0000000..08a3a07 Binary files /dev/null and b/tests/functional/snapshots/flex/password_created_screen.png differ diff --git a/tests/functional/snapshots/flex/password_deleted_screen.png b/tests/functional/snapshots/flex/password_deleted_screen.png new file mode 100644 index 0000000..b50a3aa Binary files /dev/null and b/tests/functional/snapshots/flex/password_deleted_screen.png differ diff --git a/tests/functional/snapshots/flex/settings/00000.png b/tests/functional/snapshots/flex/settings/00000.png new file mode 120000 index 0000000..7123e5c --- /dev/null +++ b/tests/functional/snapshots/flex/settings/00000.png @@ -0,0 +1 @@ +../disclaimer.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/settings/00001.png b/tests/functional/snapshots/flex/settings/00001.png new file mode 120000 index 0000000..b9898b8 --- /dev/null +++ b/tests/functional/snapshots/flex/settings/00001.png @@ -0,0 +1 @@ +../startup_choose_kbl.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/settings/00002.png b/tests/functional/snapshots/flex/settings/00002.png new file mode 120000 index 0000000..0357e9d --- /dev/null +++ b/tests/functional/snapshots/flex/settings/00002.png @@ -0,0 +1 @@ +../home_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/settings/00003.png b/tests/functional/snapshots/flex/settings/00003.png new file mode 100644 index 0000000..e76c8c6 Binary files /dev/null and b/tests/functional/snapshots/flex/settings/00003.png differ diff --git a/tests/functional/snapshots/flex/settings/00004.png b/tests/functional/snapshots/flex/settings/00004.png new file mode 100644 index 0000000..6147284 Binary files /dev/null and b/tests/functional/snapshots/flex/settings/00004.png differ diff --git a/tests/functional/snapshots/flex/settings/00005.png b/tests/functional/snapshots/flex/settings/00005.png new file mode 100644 index 0000000..246db4c Binary files /dev/null and b/tests/functional/snapshots/flex/settings/00005.png differ diff --git a/tests/functional/snapshots/flex/settings/00006.png b/tests/functional/snapshots/flex/settings/00006.png new file mode 100644 index 0000000..e77be30 Binary files /dev/null and b/tests/functional/snapshots/flex/settings/00006.png differ diff --git a/tests/functional/snapshots/flex/settings/00007.png b/tests/functional/snapshots/flex/settings/00007.png new file mode 120000 index 0000000..0357e9d --- /dev/null +++ b/tests/functional/snapshots/flex/settings/00007.png @@ -0,0 +1 @@ +../home_screen.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/startup_choose_kbl.png b/tests/functional/snapshots/flex/startup_choose_kbl.png new file mode 100644 index 0000000..d8e7440 Binary files /dev/null and b/tests/functional/snapshots/flex/startup_choose_kbl.png differ diff --git a/tests/functional/snapshots/stax/all_passwords_deleted_screen.png b/tests/functional/snapshots/stax/all_passwords_deleted_screen.png index 242b76e..55912c3 100644 Binary files a/tests/functional/snapshots/stax/all_passwords_deleted_screen.png and b/tests/functional/snapshots/stax/all_passwords_deleted_screen.png differ diff --git a/tests/functional/snapshots/stax/confirm_all_passwords_deletion.png b/tests/functional/snapshots/stax/confirm_all_passwords_deletion.png index 008132c..ffd4215 100644 Binary files a/tests/functional/snapshots/stax/confirm_all_passwords_deletion.png and b/tests/functional/snapshots/stax/confirm_all_passwords_deletion.png differ diff --git a/tests/functional/snapshots/stax/confirm_password_deletion.png b/tests/functional/snapshots/stax/confirm_password_deletion.png index 20ad966..3cd58ce 100644 Binary files a/tests/functional/snapshots/stax/confirm_password_deletion.png and b/tests/functional/snapshots/stax/confirm_password_deletion.png differ diff --git a/tests/functional/snapshots/stax/disclaimer.png b/tests/functional/snapshots/stax/disclaimer.png index bf2af0b..74ef303 100644 Binary files a/tests/functional/snapshots/stax/disclaimer.png and b/tests/functional/snapshots/stax/disclaimer.png differ diff --git a/tests/functional/snapshots/stax/home_screen.png b/tests/functional/snapshots/stax/home_screen.png index 6477e51..00d9917 100644 Binary files a/tests/functional/snapshots/stax/home_screen.png and b/tests/functional/snapshots/stax/home_screen.png differ diff --git a/tests/functional/snapshots/stax/keyboard_screen_empty.png b/tests/functional/snapshots/stax/keyboard_screen_empty.png index 03e10c5..3940493 100644 Binary files a/tests/functional/snapshots/stax/keyboard_screen_empty.png and b/tests/functional/snapshots/stax/keyboard_screen_empty.png differ diff --git a/tests/functional/snapshots/stax/keyboard_screen_n_text.png b/tests/functional/snapshots/stax/keyboard_screen_n_text.png index 4324180..f155901 100644 Binary files a/tests/functional/snapshots/stax/keyboard_screen_n_text.png and b/tests/functional/snapshots/stax/keyboard_screen_n_text.png differ diff --git a/tests/functional/snapshots/stax/keyboard_screen_ne_text.png b/tests/functional/snapshots/stax/keyboard_screen_ne_text.png index 761f372..eacb79b 100644 Binary files a/tests/functional/snapshots/stax/keyboard_screen_ne_text.png and b/tests/functional/snapshots/stax/keyboard_screen_ne_text.png differ diff --git a/tests/functional/snapshots/stax/keyboard_screen_new_text.png b/tests/functional/snapshots/stax/keyboard_screen_new_text.png index 36ddf6a..32bf1cc 100644 Binary files a/tests/functional/snapshots/stax/keyboard_screen_new_text.png and b/tests/functional/snapshots/stax/keyboard_screen_new_text.png differ diff --git a/tests/functional/snapshots/stax/list_screen_empty.png b/tests/functional/snapshots/stax/list_screen_empty.png index 0a4f87c..bb5354b 100644 Binary files a/tests/functional/snapshots/stax/list_screen_empty.png and b/tests/functional/snapshots/stax/list_screen_empty.png differ diff --git a/tests/functional/snapshots/stax/list_screen_populated.png b/tests/functional/snapshots/stax/list_screen_populated.png index bcb6d24..158878f 100644 Binary files a/tests/functional/snapshots/stax/list_screen_populated.png and b/tests/functional/snapshots/stax/list_screen_populated.png differ diff --git a/tests/functional/snapshots/stax/list_screen_populated_and_new.png b/tests/functional/snapshots/stax/list_screen_populated_and_new.png index 33c7e8b..ec29c29 100644 Binary files a/tests/functional/snapshots/stax/list_screen_populated_and_new.png and b/tests/functional/snapshots/stax/list_screen_populated_and_new.png differ diff --git a/tests/functional/snapshots/stax/list_screen_populated_one_deleted.png b/tests/functional/snapshots/stax/list_screen_populated_one_deleted.png index 7cc7a99..86b9915 100644 Binary files a/tests/functional/snapshots/stax/list_screen_populated_one_deleted.png and b/tests/functional/snapshots/stax/list_screen_populated_one_deleted.png differ diff --git a/tests/functional/snapshots/stax/menu_screen.png b/tests/functional/snapshots/stax/menu_screen.png index 59862ec..0247d9b 100644 Binary files a/tests/functional/snapshots/stax/menu_screen.png and b/tests/functional/snapshots/stax/menu_screen.png differ diff --git a/tests/functional/snapshots/stax/password_created_screen.png b/tests/functional/snapshots/stax/password_created_screen.png index cce5b29..468bce8 100644 Binary files a/tests/functional/snapshots/stax/password_created_screen.png and b/tests/functional/snapshots/stax/password_created_screen.png differ diff --git a/tests/functional/snapshots/stax/password_deleted_screen.png b/tests/functional/snapshots/stax/password_deleted_screen.png index 55a4297..a602e35 100644 Binary files a/tests/functional/snapshots/stax/password_deleted_screen.png and b/tests/functional/snapshots/stax/password_deleted_screen.png differ diff --git a/tests/functional/snapshots/stax/settings/00003.png b/tests/functional/snapshots/stax/settings/00003.png index f205d17..aeadc70 100644 Binary files a/tests/functional/snapshots/stax/settings/00003.png and b/tests/functional/snapshots/stax/settings/00003.png differ diff --git a/tests/functional/snapshots/stax/settings/00004.png b/tests/functional/snapshots/stax/settings/00004.png index 9c1856c..31d33f4 100644 Binary files a/tests/functional/snapshots/stax/settings/00004.png and b/tests/functional/snapshots/stax/settings/00004.png differ diff --git a/tests/functional/snapshots/stax/settings/00005.png b/tests/functional/snapshots/stax/settings/00005.png index e920b84..1451b7d 100644 Binary files a/tests/functional/snapshots/stax/settings/00005.png and b/tests/functional/snapshots/stax/settings/00005.png differ diff --git a/tests/functional/snapshots/stax/settings/00006.png b/tests/functional/snapshots/stax/settings/00006.png index 90807ce..4cddbac 100644 Binary files a/tests/functional/snapshots/stax/settings/00006.png and b/tests/functional/snapshots/stax/settings/00006.png differ diff --git a/tests/functional/snapshots/stax/startup_choose_kbl.png b/tests/functional/snapshots/stax/startup_choose_kbl.png index 404fa23..62dd575 100644 Binary files a/tests/functional/snapshots/stax/startup_choose_kbl.png and b/tests/functional/snapshots/stax/startup_choose_kbl.png differ diff --git a/tests/functional/stax/screen.py b/tests/functional/stax/screen.py deleted file mode 100644 index 28c2f6c..0000000 --- a/tests/functional/stax/screen.py +++ /dev/null @@ -1,34 +0,0 @@ -from ragger.backend import BackendInterface -from ragger.firmware import Firmware -from ragger.firmware.stax import MetaScreen -from ragger.firmware.stax.use_cases import UseCaseChoice, UseCaseHomeExt, UseCaseReview, \ - UseCaseSettings -from ragger.firmware.stax.layouts import ChoiceList, FullKeyboardLetters, \ - LeftHeader, TappableCenter - - -class RadioList: - - def __init__(self, backend: BackendInterface, firmware: Firmware): - self.backend = backend - self.firmware = firmware - - def choose(self, index: int): - positions = [(200, 130), (200, 210), (200, 290), (200, 370), (200, 450)] - assert 0 <= index <= 4, "Choice index must be in [0, 4]" - self.backend.finger_touch(*positions[index]) - - -class CustomStaxScreen(metaclass=MetaScreen): - - use_case_home = UseCaseHomeExt - layout_kbl_choice = ChoiceList - use_case_settings = UseCaseSettings - use_case_menu = UseCaseSettings - use_case_confirmation = UseCaseReview - use_case_disclaimer = UseCaseChoice - layout_menu_choice = ChoiceList - layout_list_choice = RadioList - layout_keyboard = FullKeyboardLetters - layout_keyboard_confirm = TappableCenter - layout_keyboard_cancel = LeftHeader diff --git a/tests/functional/test_cmd.py b/tests/functional/test_cmd.py index 055e021..6241f98 100644 --- a/tests/functional/test_cmd.py +++ b/tests/functional/test_cmd.py @@ -1,5 +1,5 @@ def test_app_info(cmd): - assert cmd.get_app_info() == ("Passwords", "1.2.0") + assert cmd.get_app_info() == ("Passwords", "1.3.0") def test_app_config(cmd): diff --git a/tests/functional/stax/__init__.py b/tests/functional/touch/__init__.py similarity index 100% rename from tests/functional/stax/__init__.py rename to tests/functional/touch/__init__.py diff --git a/tests/functional/stax/navigator.py b/tests/functional/touch/navigator.py similarity index 91% rename from tests/functional/stax/navigator.py rename to tests/functional/touch/navigator.py index 799834b..eba119a 100644 --- a/tests/functional/stax/navigator.py +++ b/tests/functional/touch/navigator.py @@ -4,7 +4,7 @@ from ragger.navigator.navigator import Navigator from time import sleep -from .screen import CustomStaxScreen +from .screen import CustomTouchScreen class CustomNavInsID(BaseNavInsID): @@ -47,13 +47,14 @@ class CustomNavInsID(BaseNavInsID): DISCLAIMER_REJECT = auto() -class CustomStaxNavigator(Navigator): +class CustomTouchNavigator(Navigator): - def __init__(self, backend, firmware): - self.screen = CustomStaxScreen(backend, firmware) + def __init__(self, backend, firmware, golden_run=False): + self.screen = CustomTouchScreen(backend, firmware) callbacks = { # has to be defined for Ragger Navigator internals NavInsID.WAIT: sleep, + NavInsID.WAIT_FOR_SCREEN_CHANGE: backend.wait_for_screen_change, CustomNavInsID.WAIT: sleep, CustomNavInsID.TOUCH: backend.finger_touch, CustomNavInsID.HOME_TO_SETTINGS: self.screen.home.settings, @@ -74,7 +75,7 @@ def __init__(self, backend, firmware): CustomNavInsID.CONFIRM_YES: self.screen.confirmation.confirm, CustomNavInsID.CONFIRM_NO: self.screen.confirmation.reject, CustomNavInsID.KEYBOARD_WRITE: self.screen.keyboard.write, - CustomNavInsID.KEYBOARD_TO_CONFIRM: self.screen.keyboard_confirm.tap, + CustomNavInsID.KEYBOARD_TO_CONFIRM: self.screen.keyboard_confirm.confirm, CustomNavInsID.KEYBOARD_TO_MENU: self.screen.keyboard_cancel.tap, CustomNavInsID.LIST_CHOOSE: self._choose, CustomNavInsID.CHOOSE_KBL_QWERTY: partial(self._choose, 0), @@ -83,7 +84,7 @@ def __init__(self, backend, firmware): CustomNavInsID.DISCLAIMER_CONFIRM: self.screen.disclaimer.confirm, CustomNavInsID.DISCLAIMER_REJECT: self.screen.disclaimer.reject, } - super().__init__(backend, firmware, callbacks) #, golden_run=True) + super().__init__(backend, firmware, callbacks, golden_run=golden_run) def _choose(self, position: int): # Choosing a field in settings list will display a temporary screen where the chosen field diff --git a/tests/functional/touch/screen.py b/tests/functional/touch/screen.py new file mode 100644 index 0000000..caf4cbb --- /dev/null +++ b/tests/functional/touch/screen.py @@ -0,0 +1,45 @@ +from ragger.backend import BackendInterface +from ragger.firmware import Firmware +from ragger.firmware.touch import MetaScreen +from ragger.firmware.touch.use_cases import UseCaseChoice, UseCaseHomeExt, UseCaseReview, \ + UseCaseSettings +from ragger.firmware.touch.layouts import ChoiceList, FullKeyboardLetters, \ + KeyboardConfirmationButton, LeftHeader + + +class RadioList: + + def __init__(self, backend: BackendInterface, firmware: Firmware): + self.backend = backend + self.firmware = firmware + + def choose(self, index: int): + if self.firmware == Firmware.STAX: + positions = [(200, 130), (200, 210), (200, 290), (200, 370), (200, 450)] + else: # Firmware.FLEX + positions = [(240, 140), (240, 230), (240, 320), (240, 410), (240, 500)] + assert 0 <= index <= 4, "Choice index must be in [0, 4]" + self.backend.finger_touch(*positions[index]) + + +class CustomTouchScreen(metaclass=MetaScreen): + + # "backup your data" disclaimer, displayed the first time the app is started + use_case_disclaimer = UseCaseChoice + # "choose your keyboard layout" choice, displayed the first time the app is started + layout_kbl_choice = ChoiceList + # home page + use_case_home = UseCaseHomeExt + # app settings + use_case_settings = UseCaseSettings + # main app menu, where to choose actions (write, display, create, delete, ... passwords) + use_case_menu = UseCaseSettings + use_case_confirmation = UseCaseReview + # choose a password menu (for action like write, display or delete) + layout_menu_choice = ChoiceList + layout_list_choice = RadioList + # Keyboard for naming password when creating one + layout_keyboard = FullKeyboardLetters + # confirm and cancel action (delete, delete all, create, ...) + layout_keyboard_confirm = KeyboardConfirmationButton + layout_keyboard_cancel = LeftHeader diff --git a/tests/functional/stax/test_common.py b/tests/functional/touch/test_common.py similarity index 91% rename from tests/functional/stax/test_common.py rename to tests/functional/touch/test_common.py index a162dfb..d802a93 100644 --- a/tests/functional/stax/test_common.py +++ b/tests/functional/touch/test_common.py @@ -4,7 +4,7 @@ from .navigator import CustomNavInsID -@pytest.mark.use_on_firmware("stax") +@pytest.mark.use_on_firmware(["stax", "flex"]) def test_immediate_quit(navigator): instructions = [ CustomNavInsID.DISCLAIMER_CONFIRM, diff --git a/tests/functional/stax/test_passwords.py b/tests/functional/touch/test_passwords.py similarity index 93% rename from tests/functional/stax/test_passwords.py rename to tests/functional/touch/test_passwords.py index 09447dd..2a657b4 100644 --- a/tests/functional/stax/test_passwords.py +++ b/tests/functional/touch/test_passwords.py @@ -4,7 +4,7 @@ from .navigator import CustomNavInsID -@pytest.mark.use_on_firmware("stax") +@pytest.mark.use_on_firmware(["stax", "flex"]) def test_delete_one_password(navigator, functional_test_directory): instructions = [ CustomNavInsID.DISCLAIMER_CONFIRM, @@ -26,7 +26,7 @@ def test_delete_one_password(navigator, functional_test_directory): screen_change_before_first_instruction=False) -@pytest.mark.use_on_firmware("stax") +@pytest.mark.use_on_firmware(["stax", "flex"]) def test_delete_all_passwords(navigator, functional_test_directory): instructions = [ CustomNavInsID.DISCLAIMER_CONFIRM, @@ -46,7 +46,7 @@ def test_delete_all_passwords(navigator, functional_test_directory): screen_change_before_first_instruction=False) -@pytest.mark.use_on_firmware("stax") +@pytest.mark.use_on_firmware(["stax", "flex"]) def test_create_password(navigator, functional_test_directory): instructions = [ CustomNavInsID.DISCLAIMER_CONFIRM, @@ -61,6 +61,7 @@ def test_create_password(navigator, functional_test_directory): NavIns(CustomNavInsID.KEYBOARD_WRITE, ("e", )), NavIns(CustomNavInsID.KEYBOARD_WRITE, ("w", )), CustomNavInsID.KEYBOARD_TO_CONFIRM, + NavInsID.WAIT_FOR_SCREEN_CHANGE, # return to list to see the newly created password CustomNavInsID.MENU_TO_DISPLAY, ] diff --git a/tests/functional/stax/test_settings.py b/tests/functional/touch/test_settings.py similarity index 94% rename from tests/functional/stax/test_settings.py rename to tests/functional/touch/test_settings.py index 926c78b..a176f46 100644 --- a/tests/functional/stax/test_settings.py +++ b/tests/functional/touch/test_settings.py @@ -4,8 +4,7 @@ from .navigator import CustomNavInsID - -@pytest.mark.use_on_firmware("stax") +@pytest.mark.use_on_firmware(["stax", "flex"]) def test_settings_screens(navigator, functional_test_directory): instructions = [ CustomNavInsID.DISCLAIMER_CONFIRM, diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index dd40e12..5a62ae3 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -38,18 +38,19 @@ add_compile_definitions(WIDE=) add_compile_definitions(TEST) add_compile_definitions(MAX_METANAME=20) add_compile_definitions(HAVE_BOLOS_UX) +add_compile_definitions(SCREEN_SIZE_WALLET) add_compile_definitions(TARGET_STAX) add_compile_definitions(OS_IO_SEPROXYHAL) include_directories(../../src ../../include ./mocks/) -add_executable(test_stax_password_list stax/test_password_list.c) -add_library(password_list SHARED ../../src/stax/password_list.c) -target_link_libraries(test_stax_password_list PUBLIC cmocka gcov password_list bsd) +add_executable(test_nbgl_password_list nbgl/test_password_list.c) +add_library(password_list SHARED ../../src/nbgl/password_list.c) +target_link_libraries(test_nbgl_password_list PUBLIC cmocka gcov password_list bsd) add_executable(test_hid_mapping test_hid_mapping.c) add_library(hid_mapping SHARED ../../src/hid_mapping.c) target_link_libraries(test_hid_mapping PUBLIC cmocka gcov hid_mapping bsd) -add_test(stax_password_list test_stax_password_list) +add_test(nbgl_password_list test_nbgl_password_list) add_test(hid_mapping test_hid_mapping) diff --git a/tests/unit/stax/test_password_list.c b/tests/unit/nbgl/test_password_list.c similarity index 99% rename from tests/unit/stax/test_password_list.c rename to tests/unit/nbgl/test_password_list.c index 1b3f958..349e513 100644 --- a/tests/unit/stax/test_password_list.c +++ b/tests/unit/nbgl/test_password_list.c @@ -3,7 +3,7 @@ #include #include -#include "stax/password_list.h" +#include "nbgl/password_list.h" static int setup(void **state __attribute__((unused))) {