diff --git a/integration_test/utils/oath_test_util.dart b/integration_test/utils/oath_test_util.dart index f529472a..6b2a97a2 100644 --- a/integration_test/utils/oath_test_util.dart +++ b/integration_test/utils/oath_test_util.dart @@ -303,26 +303,14 @@ extension OathFunctions on WidgetTester { /// Factory reset OATH application Future resetOATH() async { - - // TODO: Implement this using new Reset Dialog - - /// 1. instead of tapping actioniconbutton, first click navigation + /// 1. open drawer if needed await openDrawer(); await shortWait(); - // await tapActionIconButton(); - // Future tapActionIconButton() async { - // await tap(findActionIconButton()); - // await pump(const Duration(milliseconds: 500)); - // } - /// 2. then click the meatball button+'Factory reset' for correct S/N - // stealing some of startUp to get serialnumber check: await collectYubiKeyInformation(); final approvedSerialNumbers = await getApprovedSerialNumbers(); - if (approvedSerialNumbers.contains(yubiKeySerialNumber)) { - // this does not work, yubikeyPopupMenuButton probably wrong!? await tap(find.byKey(yubikeyPopupMenuButton).hitTestable()); await shortWait(); await tap(find.byKey(yubikeyFactoryResetMenuButton).hitTestable()); diff --git a/lib/app/views/device_picker.dart b/lib/app/views/device_picker.dart index 34abda2a..d9e14373 100644 --- a/lib/app/views/device_picker.dart +++ b/lib/app/views/device_picker.dart @@ -178,6 +178,7 @@ class _DeviceMenuButton extends ConsumerWidget { child: Opacity( opacity: menuItems.isNotEmpty ? opacity : 0.0, child: PopupMenuButton( + key: yubikeyPopupMenuButton, enabled: menuItems.isNotEmpty, icon: const Icon(Icons.more_horiz_outlined), tooltip: '', @@ -348,7 +349,6 @@ class _DeviceRowState extends ConsumerState<_DeviceRow> { if (serial != null) PopupMenuItem( enabled: true, - key: yubikeyPopupMenuButton, onTap: () async { await ref.read(withContextProvider)((context) async { await _showKeyCustomizationDialog( diff --git a/lib/app/views/keys.dart b/lib/app/views/keys.dart index f5379b60..c5a2d2c4 100644 --- a/lib/app/views/keys.dart +++ b/lib/app/views/keys.dart @@ -37,9 +37,12 @@ const openpgpAppDrawer = Key('$_prefix.drawer.openpgp'); // drawer yubikey more items const yubikeyPopupMenuButton = Key('$_prefix.yubikey_popup_menu_button'); -const yubikeyLabelColorMenuButton = Key('$_prefix.yubikey_label_color_menu_button'); -const yubikeyApplicationToggleMenuButton = Key('$_prefix.yubikey_application_toggle_menu_button'); -const yubikeyFactoryResetMenuButton = Key('$_prefix.yubikey_factory_reset_menu_button'); +const yubikeyLabelColorMenuButton = + Key('$_prefix.yubikey_label_color_menu_button'); +const yubikeyApplicationToggleMenuButton = + Key('$_prefix.yubikey_application_toggle_menu_button'); +const yubikeyFactoryResetMenuButton = + Key('$_prefix.yubikey_factory_reset_menu_button'); // factory reset dialog const factoryResetPickResetOath = Key('$_prefix.yubikey_factory_reset_oath'); @@ -48,7 +51,6 @@ const factoryResetPickResetPiv = Key('$_prefix.yubikey_factory_reset_piv'); const factoryResetCancel = Key('$_prefix.yubikey_factory_reset_cancel'); const factoryResetReset = Key('$_prefix.yubikey_factory_reset_reset'); - // settings page const settingDrawerIcon = Key('$_prefix.settings_drawer_icon'); const helpDrawerIcon = Key('$_prefix.setting_drawer_icon'); diff --git a/lib/app/views/reset_dialog.dart b/lib/app/views/reset_dialog.dart index 8ac801d9..4008837d 100644 --- a/lib/app/views/reset_dialog.dart +++ b/lib/app/views/reset_dialog.dart @@ -156,8 +156,8 @@ class _ResetDialogState extends ConsumerState { null => null, _ => throw UnsupportedError('Application cannot be reset'), }, - child: Text(l10n.s_reset), key: factoryResetReset, + child: Text(l10n.s_reset), ) ], child: Padding( @@ -177,6 +177,12 @@ class _ResetDialogState extends ConsumerState { value: c, icon: const Icon(null), label: Padding( + key: switch (c) { + Capability.oath => factoryResetPickResetOath, + Capability.fido2 => factoryResetPickResetFido2, + Capability.piv => factoryResetPickResetPiv, + _ => const Key('_invalid') // no reset + }, padding: const EdgeInsets.only(right: 22), child: Text(c.getDisplayName(l10n)), ),