mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-25 23:14:18 +03:00
fix Reset OATH test when 1 key is connected
This commit is contained in:
parent
c0a9d2b8f8
commit
539f4fb89c
@ -303,26 +303,14 @@ extension OathFunctions on WidgetTester {
|
||||
|
||||
/// Factory reset OATH application
|
||||
Future<void> 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<void> 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());
|
||||
|
@ -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(
|
||||
|
@ -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');
|
||||
|
@ -156,8 +156,8 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
|
||||
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<ResetDialog> {
|
||||
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)),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user