This commit is contained in:
Dain Nilsson 2024-09-10 15:04:22 +02:00
commit 76f60a9eb5
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
12 changed files with 875 additions and 586 deletions

View File

@ -36,21 +36,22 @@ void main() {
}); });
group('Settings', () { group('Settings', () {
appTestKeyless('Click through all Themes', (WidgetTester tester) async { appTestKeyless('Click through all Themes', (WidgetTester tester) async {
var settingDrawerButton = find.byKey(settingDrawerIcon).hitTestable(); await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.tap(settingDrawerButton); await tester.shortWait();
await tester.longWait(); await tester.tap(find.byKey(settingDrawerIcon).hitTestable());
await tester.shortWait();
await tester.tap(find.byKey(themeModeSetting)); await tester.tap(find.byKey(themeModeSetting));
await tester.longWait(); await tester.shortWait();
await tester await tester
.tap(find.byKey(themeModeOption(ThemeMode.light)).hitTestable()); .tap(find.byKey(themeModeOption(ThemeMode.light)).hitTestable());
await tester.longWait(); await tester.longWait();
await tester.tap(find.byKey(themeModeSetting)); await tester.tap(find.byKey(themeModeSetting));
await tester.longWait(); await tester.shortWait();
await tester await tester
.tap(find.byKey(themeModeOption(ThemeMode.dark)).hitTestable()); .tap(find.byKey(themeModeOption(ThemeMode.dark)).hitTestable());
await tester.longWait(); await tester.longWait();
await tester.tap(find.byKey(themeModeSetting)); await tester.tap(find.byKey(themeModeSetting));
await tester.longWait(); await tester.shortWait();
await tester await tester
.tap(find.byKey(themeModeOption(ThemeMode.system)).hitTestable()); .tap(find.byKey(themeModeOption(ThemeMode.system)).hitTestable());
await tester.longWait(); await tester.longWait();
@ -60,6 +61,8 @@ void main() {
var helpDrawerButton = find.byKey(helpDrawerIcon).hitTestable(); var helpDrawerButton = find.byKey(helpDrawerIcon).hitTestable();
appTestKeyless('Check Licenses view', (WidgetTester tester) async { appTestKeyless('Check Licenses view', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.shortWait(); await tester.shortWait();
var licensesButtonText = find.byKey(licensesButton).hitTestable(); var licensesButtonText = find.byKey(licensesButton).hitTestable();
@ -70,8 +73,10 @@ void main() {
}); });
group('Opening of URLs', () { group('Opening of URLs', () {
appTestKeyless('TOS link', (WidgetTester tester) async { appTestKeyless('TOS link', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
if (isAndroid) { if (isAndroid) {
expect(find.byKey(tosButton).hitTestable(), findsOneWidget); expect(find.byKey(tosButton).hitTestable(), findsOneWidget);
} else { } else {
@ -80,8 +85,10 @@ void main() {
} }
}); });
appTestKeyless('Privacy link', (WidgetTester tester) async { appTestKeyless('Privacy link', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
if (isAndroid) { if (isAndroid) {
expect(find.byKey(privacyButton).hitTestable(), findsOneWidget); expect(find.byKey(privacyButton).hitTestable(), findsOneWidget);
} else { } else {
@ -90,8 +97,10 @@ void main() {
} }
}); });
appTestKeyless('Feedback link', (WidgetTester tester) async { appTestKeyless('Feedback link', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
if (isAndroid) { if (isAndroid) {
expect(find.byKey(userGuideButton).hitTestable(), findsOneWidget); expect(find.byKey(userGuideButton).hitTestable(), findsOneWidget);
} else { } else {
@ -100,6 +109,8 @@ void main() {
} }
}); });
appTestKeyless('Help link', (WidgetTester tester) async { appTestKeyless('Help link', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.longWait();
if (isAndroid) { if (isAndroid) {
@ -113,14 +124,18 @@ void main() {
group('Troubleshooting', () { group('Troubleshooting', () {
appTestKeyless('Diagnostics Button', skip: isAndroid, appTestKeyless('Diagnostics Button', skip: isAndroid,
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
await tester.tap(find.byKey(diagnosticsChip).hitTestable()); await tester.tap(find.byKey(diagnosticsChip).hitTestable());
await tester.longWait(); await tester.longWait();
}); });
appTestKeyless('Log button', (WidgetTester tester) async { appTestKeyless('Log button', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
await tester.tap(find.byKey(logChip).hitTestable()); await tester.tap(find.byKey(logChip).hitTestable());
await tester.longWait(); await tester.longWait();
}); });

View File

@ -17,245 +17,288 @@
@Tags(['desktop', 'management']) @Tags(['desktop', 'management'])
library; library;
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart'; import 'package:integration_test/integration_test.dart';
import 'package:yubico_authenticator/app/views/keys.dart' as app_keys; import 'package:yubico_authenticator/management/views/keys.dart';
import 'package:yubico_authenticator/management/views/keys.dart'
as management_keys;
import 'utils/test_util.dart'; import 'utils/test_util.dart';
Key _getCapabilityWidgetKey(bool isUsb, String name) => // Key _getCapabilityWidgetKey(bool isUsb, String name) =>
Key('management.keys.capability.${isUsb ? 'usb' : 'nfc'}.$name'); // Key('management.keys.capability.${isUsb ? 'usb' : 'nfc'}.$name');
//
Future<FilterChip?> _getCapabilityWidget(Key key) async { // Future<FilterChip?> _getCapabilityWidget(Key key) async {
return find.byKey(key).hitTestable().evaluate().single.widget as FilterChip; // return find.byKey(key).hitTestable().evaluate().single.widget as FilterChip;
} // }
void main() { void main() {
var binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized(); var binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive; binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
group('Management UI tests', () {
appTest('Drawer items exist', (WidgetTester tester) async {
await tester.openDrawer();
expect(find.byKey(app_keys.managementAppDrawer).hitTestable(),
findsOneWidget);
});
});
group('Toggle Applications on key', () { group('Toggle Applications on key', () {
appTest('Toggle OTP', (WidgetTester tester) async { appTest('Toggle all but PIV 1', (WidgetTester tester) async {
await tester.openManagementScreen(); await tester.openHomeAndToggleScreen();
// find USB OTP capability
var usbOtpKey = _getCapabilityWidgetKey(true, 'OTP');
var otpChip = await _getCapabilityWidget(usbOtpKey);
if (otpChip != null) {
// we expect OTP to be enabled on the Key for this test
expect(otpChip.selected, equals(true));
await tester.tap(find.byKey(usbOtpKey));
await tester.shortWait(); await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey)); await tester.tap(find.text('Yubico OTP').hitTestable());
// long wait
await tester.ultraLongWait();
expect(find.byKey(management_keys.screenKey), findsNothing);
await tester.shortWait(); await tester.shortWait();
} await tester.tap(find.text('OATH').hitTestable());
await tester.openManagementScreen();
if (otpChip != null) {
await tester.tap(find.byKey(usbOtpKey));
await tester.shortWait(); await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey)); await tester.tap(find.text('OpenPGP').hitTestable());
// long wait await tester.shortWait();
await tester.ultraLongWait(); await tester.tap(find.text('YubiHSM Auth').hitTestable());
await tester.shortWait();
// no management screen visible now await tester.tap(find.text('FIDO U2F').hitTestable());
expect(find.byKey(management_keys.screenKey), findsNothing); await tester.shortWait();
await tester.tap(find.text('FIDO2').hitTestable());
await tester.shortWait();
await tester.tap(find.byKey(saveButtonKey).hitTestable());
await tester.longWait(); await tester.longWait();
}
}); });
appTest('Toggle PIV', (WidgetTester tester) async { appTest('Toggle all but PIV 2', (WidgetTester tester) async {
await tester.openManagementScreen(); await tester.openHomeAndToggleScreen();
var usbPivKey = _getCapabilityWidgetKey(true, 'PIV');
var pivChip = await _getCapabilityWidget(usbPivKey);
// find USB PIV capability
if (pivChip != null) {
expect(pivChip.selected, equals(true));
await tester.tap(find.byKey(usbPivKey));
await tester.shortWait(); await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey)); await tester.tap(find.text('Yubico OTP').hitTestable());
// long wait
await tester.ultraLongWait();
expect(find.byKey(management_keys.screenKey), findsNothing);
await tester.shortWait(); await tester.shortWait();
} await tester.tap(find.text('OATH').hitTestable());
await tester.openManagementScreen();
if (pivChip != null) {
// we expect PIV to be enabled on the Key for this test
await tester.tap(find.byKey(usbPivKey));
await tester.shortWait(); await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey)); await tester.tap(find.text('OpenPGP').hitTestable());
// long wait await tester.shortWait();
await tester.ultraLongWait(); await tester.tap(find.text('YubiHSM Auth').hitTestable());
await tester.shortWait();
// no management screen visible now await tester.tap(find.text('FIDO U2F').hitTestable());
expect(find.byKey(management_keys.screenKey), findsNothing); await tester.shortWait();
await tester.tap(find.text('FIDO2').hitTestable());
await tester.shortWait();
await tester.tap(find.byKey(saveButtonKey).hitTestable());
await tester.longWait(); await tester.longWait();
}
});
appTest('Toggle OATH', (WidgetTester tester) async {
await tester.openManagementScreen();
// find USB OATH capability
var usbOathKey = _getCapabilityWidgetKey(true, 'OATH');
var oathChip = await _getCapabilityWidget(usbOathKey);
if (oathChip != null) {
// we expect OATH to be enabled on the Key for this test
expect(oathChip.selected, equals(true));
await tester.tap(find.byKey(usbOathKey));
await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey));
// long wait
await tester.ultraLongWait();
expect(find.byKey(management_keys.screenKey), findsNothing);
await tester.shortWait();
}
await tester.openManagementScreen();
if (oathChip != null) {
await tester.tap(find.byKey(usbOathKey));
await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey));
// long wait
await tester.ultraLongWait();
// no management screen visible now
expect(find.byKey(management_keys.screenKey), findsNothing);
await tester.longWait();
}
});
appTest('Toggle OpenPGP', (WidgetTester tester) async {
await tester.openManagementScreen();
// find USB OPENPGP capability
var usbPgpKey = _getCapabilityWidgetKey(true, 'OpenPGP');
var pgpChip = await _getCapabilityWidget(usbPgpKey);
if (pgpChip != null) {
// we expect OPENPGP to be enabled on the Key for this test
expect(pgpChip.selected, equals(true));
await tester.tap(find.byKey(usbPgpKey));
await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey));
// long wait
await tester.ultraLongWait();
expect(find.byKey(management_keys.screenKey), findsNothing);
await tester.shortWait();
}
await tester.openManagementScreen();
if (pgpChip != null) {
await tester.tap(find.byKey(usbPgpKey));
await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey));
// long wait
await tester.ultraLongWait();
// no management screen visible now
expect(find.byKey(management_keys.screenKey), findsNothing);
await tester.longWait();
}
});
appTest('Toggle YubiHSM Auth', (WidgetTester tester) async {
await tester.openManagementScreen();
// find USB YubiHSM Auth capability
var usbHsmKey = _getCapabilityWidgetKey(true, 'YubiHSM Auth');
var hsmChip = await _getCapabilityWidget(usbHsmKey);
if (hsmChip != null) {
// we expect YubiHSM Auth to be enabled on the Key for this test
expect(hsmChip.selected, equals(true));
await tester.tap(find.byKey(usbHsmKey));
await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey));
// long wait
await tester.ultraLongWait();
expect(find.byKey(management_keys.screenKey), findsNothing);
await tester.shortWait();
}
await tester.openManagementScreen();
if (hsmChip != null) {
await tester.tap(find.byKey(usbHsmKey));
await tester.shortWait();
await tester.tap(find.byKey(management_keys.saveButtonKey));
// long wait
await tester.ultraLongWait();
// no management screen visible now
expect(find.byKey(management_keys.screenKey), findsNothing);
await tester.longWait();
}
}); });
}); });
appTest('Toggle FIDO U2F', (WidgetTester tester) async {
await tester.openManagementScreen();
// find USB FIDO U2F capability // group('OLD: Toggle Applications on key', () {
var usbU2fKey = _getCapabilityWidgetKey(true, 'FIDO U2F'); // appTest('Toggle OTP', (WidgetTester tester) async {
var u2fChip = await _getCapabilityWidget(usbU2fKey); // await tester.openHomeAndToggleScreen();
if (u2fChip != null) { // await tester.shortWait();
// we expect FIDO U2F to be enabled on the Key for this test // await tester.tap(find.text('Yubico OTP').hitTestable());
expect(u2fChip.selected, equals(true)); // await tester.shortWait();
await tester.tap(find.byKey(usbU2fKey)); // await tester.tap(find.byKey(saveButtonKey).hitTestable());
await tester.shortWait(); // await tester.ultraLongWait();
await tester.tap(find.byKey(management_keys.saveButtonKey)); //
// long wait // // TODO: expecter that the Yubico OTP is not present
await tester.ultraLongWait(); //
expect(find.byKey(management_keys.screenKey), findsNothing); // await tester.openHomeAndToggleScreen();
await tester.shortWait(); // await tester.shortWait();
} // await tester.tap(find.text('Yubico OTP').hitTestable());
await tester.openManagementScreen(); // await tester.shortWait();
if (u2fChip != null) { // await tester.tap(find.byKey(saveButtonKey).hitTestable());
await tester.tap(find.byKey(usbU2fKey)); // await tester.ultraLongWait();
await tester.shortWait(); //
await tester.tap(find.byKey(management_keys.saveButtonKey)); // // TODO: this is old method of doing this test, review if usable.
// long wait // // find USB OTP capability
await tester.ultraLongWait(); // // var usbOtpKey = _getCapabilityWidgetKey(true, 'Yubico OTP');
// // var otpChip = await _getCapabilityWidget(usbOtpKey);
// no management screen visible now // // if (otpChip != null) {
expect(find.byKey(management_keys.screenKey), findsNothing); // // // we expect OTP to be enabled on the Key for this test
await tester.longWait(); // // expect(otpChip.selected, equals(true));
} // // await tester.tap(find.byKey(usbOtpKey));
}); // // await tester.shortWait();
appTest('Toggle FIDO2', (WidgetTester tester) async { // // await tester.tap(find.byKey(management_keys.saveButtonKey));
await tester.openManagementScreen(); // // // long wait
// // await tester.ultraLongWait();
// find USB FIDO2 capability // // expect(find.byKey(management_keys.screenKey), findsNothing);
var usbFido2Key = _getCapabilityWidgetKey(true, 'FIDO2'); // // await tester.shortWait();
var fido2Chip = await _getCapabilityWidget(usbFido2Key); // // }
if (fido2Chip != null) { // // await tester.openToggleScreen();
// we expect FIDO2 to be enabled on the Key for this test // // if (otpChip != null) {
expect(fido2Chip.selected, equals(true)); // // await tester.tap(find.byKey(usbOtpKey));
await tester.tap(find.byKey(usbFido2Key)); // // await tester.shortWait();
await tester.shortWait(); // // await tester.tap(find.byKey(management_keys.saveButtonKey));
await tester.tap(find.byKey(management_keys.saveButtonKey)); // // // long wait
// long wait // // await tester.ultraLongWait();
await tester.ultraLongWait(); // //
expect(find.byKey(management_keys.screenKey), findsNothing); // // // no management screen visible now
await tester.shortWait(); // // expect(find.byKey(management_keys.screenKey), findsNothing);
} // // await tester.longWait();
await tester.openManagementScreen(); // // }
if (fido2Chip != null) { // });
await tester.tap(find.byKey(usbFido2Key)); // appTest('Toggle PIV', (WidgetTester tester) async {
await tester.shortWait(); // await tester.openToggleScreen();
await tester.tap(find.byKey(management_keys.saveButtonKey)); // var usbPivKey = _getCapabilityWidgetKey(true, 'PIV');
// long wait // var pivChip = await _getCapabilityWidget(usbPivKey);
await tester.ultraLongWait(); //
// // find USB PIV capability
// no management screen visible now // if (pivChip != null) {
expect(find.byKey(management_keys.screenKey), findsNothing); // expect(pivChip.selected, equals(true));
await tester.longWait(); // await tester.tap(find.byKey(usbPivKey));
} // await tester.shortWait();
}); // await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.shortWait();
// }
// await tester.openToggleScreen();
// if (pivChip != null) {
// // we expect PIV to be enabled on the Key for this test
// await tester.tap(find.byKey(usbPivKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
//
// // no management screen visible now
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.longWait();
// }
// });
//
// appTest('Toggle OATH', (WidgetTester tester) async {
// await tester.openToggleScreen();
//
// // find USB OATH capability
// var usbOathKey = _getCapabilityWidgetKey(true, 'OATH');
// var oathChip = await _getCapabilityWidget(usbOathKey);
// if (oathChip != null) {
// // we expect OATH to be enabled on the Key for this test
// expect(oathChip.selected, equals(true));
// await tester.tap(find.byKey(usbOathKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.shortWait();
// }
// await tester.openToggleScreen();
// if (oathChip != null) {
// await tester.tap(find.byKey(usbOathKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
//
// // no management screen visible now
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.longWait();
// }
// });
// appTest('Toggle OpenPGP', (WidgetTester tester) async {
// await tester.openToggleScreen();
//
// // find USB OPENPGP capability
// var usbPgpKey = _getCapabilityWidgetKey(true, 'OpenPGP');
// var pgpChip = await _getCapabilityWidget(usbPgpKey);
// if (pgpChip != null) {
// // we expect OPENPGP to be enabled on the Key for this test
// expect(pgpChip.selected, equals(true));
// await tester.tap(find.byKey(usbPgpKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.shortWait();
// }
// await tester.openToggleScreen();
// if (pgpChip != null) {
// await tester.tap(find.byKey(usbPgpKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
//
// // no management screen visible now
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.longWait();
// }
// });
// appTest('Toggle YubiHSM Auth', (WidgetTester tester) async {
// await tester.openToggleScreen();
//
// // find USB YubiHSM Auth capability
// var usbHsmKey = _getCapabilityWidgetKey(true, 'YubiHSM Auth');
// var hsmChip = await _getCapabilityWidget(usbHsmKey);
// if (hsmChip != null) {
// // we expect YubiHSM Auth to be enabled on the Key for this test
// expect(hsmChip.selected, equals(true));
// await tester.tap(find.byKey(usbHsmKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.shortWait();
// }
// await tester.openToggleScreen();
// if (hsmChip != null) {
// await tester.tap(find.byKey(usbHsmKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
//
// // no management screen visible now
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.longWait();
// }
// });
// });
// appTest('Toggle FIDO U2F', (WidgetTester tester) async {
// await tester.openToggleScreen();
//
// // find USB FIDO U2F capability
// var usbU2fKey = _getCapabilityWidgetKey(true, 'FIDO U2F');
// var u2fChip = await _getCapabilityWidget(usbU2fKey);
// if (u2fChip != null) {
// // we expect FIDO U2F to be enabled on the Key for this test
// expect(u2fChip.selected, equals(true));
// await tester.tap(find.byKey(usbU2fKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.shortWait();
// }
// await tester.openToggleScreen();
// if (u2fChip != null) {
// await tester.tap(find.byKey(usbU2fKey));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
//
// // no management screen visible now
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.longWait();
// }
// });
// appTest('Toggle FIDO2', (WidgetTester tester) async {
// await tester.openToggleScreen();
//
// // find USB FIDO2 capability
// var usbFido2Key = _getCapabilityWidgetKey(true, 'FIDO2');
// var fido2Chip = await _getCapabilityWidget(usbFido2Key);
// if (fido2Chip != null) {
// // we expect FIDO2 to be enabled on the Key for this test
// expect(fido2Chip.selected, equals(true));
// await tester.tap(find.byKey(usbFido2Key));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.shortWait();
// }
// await tester.openToggleScreen();
// if (fido2Chip != null) {
// await tester.tap(find.byKey(usbFido2Key));
// await tester.shortWait();
// await tester.tap(find.byKey(management_keys.saveButtonKey));
// // long wait
// await tester.ultraLongWait();
//
// // no management screen visible now
// expect(find.byKey(management_keys.screenKey), findsNothing);
// await tester.longWait();
// }
// });
} }

View File

@ -21,7 +21,6 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart'; import 'package:integration_test/integration_test.dart';
import 'package:yubico_authenticator/app/views/keys.dart'; import 'package:yubico_authenticator/app/views/keys.dart';
import 'package:yubico_authenticator/core/state.dart'; import 'package:yubico_authenticator/core/state.dart';
import 'package:yubico_authenticator/oath/keys.dart' as keys;
import 'package:yubico_authenticator/oath/models.dart'; import 'package:yubico_authenticator/oath/models.dart';
import 'package:yubico_authenticator/oath/views/account_list.dart'; import 'package:yubico_authenticator/oath/views/account_list.dart';
@ -32,17 +31,17 @@ void main() {
var binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized(); var binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive; binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
group('OATH UI tests', () { // group('OATH UI tests', () {
appTest('Menu items exist', (WidgetTester tester) async { // appTest('Menu items exist', (WidgetTester tester) async {
await tester.tapActionIconButton(); // await tester.tapActionIconButton();
await tester.shortWait(); // await tester.shortWait();
expect(find.byKey(keys.addAccountAction), findsOneWidget); // expect(find.byKey(keys.addAccountAction), findsOneWidget);
expect(find.byKey(keys.setOrManagePasswordAction), findsOneWidget); // expect(find.byKey(keys.setOrManagePasswordAction), findsOneWidget);
// close dialog // // close dialog
await tester.tapTopLeftCorner(); // await tester.tapTopLeftCorner();
await tester.longWait(); // await tester.longWait();
}); // });
}); // });
group('Account creation', () { group('Account creation', () {
appTest('Initial reset OATH', (WidgetTester tester) async { appTest('Initial reset OATH', (WidgetTester tester) async {
@ -64,11 +63,11 @@ void main() {
await tester.addAccount(testAccount); await tester.addAccount(testAccount);
await tester.shortWait(); await tester.shortWait();
expect( // expect(
find.descendant( // find.descendant(
of: find.byType(AccountList), // of: find.byType(AccountList),
matching: find.textContaining(testAccount.name)), // matching: find.textContaining(testAccount.name)),
findsOneWidget); // findsOneWidget);
await tester.shortWait(); await tester.shortWait();
} }
@ -241,20 +240,20 @@ void main() {
await tester.longWait(); await tester.longWait();
}); });
/// adds an account, renames, verifies // /// adds an account, renames, verifies
appTest('Rename OATH account', (WidgetTester tester) async { // appTest('Rename OATH account', (WidgetTester tester) async {
var testAccount = // var testAccount =
const Account(issuer: 'IssuerToRename', name: 'NameToRename'); // const Account(issuer: 'IssuerToRename', name: 'NameToRename');
//
/// delete account if it exists // /// delete account if it exists
await tester.deleteAccount(testAccount); // await tester.deleteAccount(testAccount);
await tester.deleteAccount( // await tester.deleteAccount(
const Account(issuer: 'RenamedIssuer', name: 'RenamedName')); // const Account(issuer: 'RenamedIssuer', name: 'RenamedName'));
await tester.longWait(); // await tester.longWait();
await tester.addAccount(testAccount); // await tester.addAccount(testAccount);
await tester.longWait(); // await tester.longWait();
await tester.renameAccount(testAccount, 'RenamedIssuer', 'RenamedName'); // await tester.renameAccount(testAccount, 'RenamedIssuer', 'RenamedName');
}); // });
}); });
group('Password tests', () { group('Password tests', () {
@ -265,20 +264,28 @@ void main() {
var secondPassword = 'secondPassword'; var secondPassword = 'secondPassword';
var thirdPassword = 'thirdPassword'; var thirdPassword = 'thirdPassword';
appTest('Reset OATH', (WidgetTester tester) async { appTest('Reset OATH', (WidgetTester tester) async {
await tester.tapAppDrawerButton(oathAppDrawer);
await tester.resetOATH(); await tester.resetOATH();
await tester.longWait();
}); });
appTest('Set first OATH password', (WidgetTester tester) async { appTest('Set first OATH password', (WidgetTester tester) async {
await tester.tapAppDrawerButton(oathAppDrawer);
// Sets a password for OATH // Sets a password for OATH
await tester.setOathPassword(firstPassword); await tester.setOathPassword(firstPassword);
}); });
appTest('Set second OATH password', (WidgetTester tester) async { appTest('Set second OATH password', (WidgetTester tester) async {
await tester.tapAppDrawerButton(oathAppDrawer);
// Without removing the first, change to a second password // Without removing the first, change to a second password
await tester.unlockOathSession(firstPassword); await tester.unlockOathSession(firstPassword);
await tester.replaceOathPassword(firstPassword, secondPassword); await tester.replaceOathPassword(firstPassword, secondPassword);
}); });
appTest('Set third OATH password', (WidgetTester tester) async { appTest('Set third OATH password', (WidgetTester tester) async {
await tester.tapAppDrawerButton(oathAppDrawer);
// Without removing the second, set a third password // Without removing the second, set a third password
await tester.unlockOathSession(secondPassword); await tester.unlockOathSession(secondPassword);
await tester.replaceOathPassword(secondPassword, thirdPassword); await tester.replaceOathPassword(secondPassword, thirdPassword);

View File

@ -47,9 +47,9 @@ void main() {
await tester.shortWait(); await tester.shortWait();
await tester.enterText(find.byKey(newPin), simplePin); await tester.enterText(find.byKey(newPin), simplePin);
await tester.shortWait(); await tester.longWait();
await tester.enterText(find.byKey(confirmPin), simplePin); await tester.enterText(find.byKey(confirmPin), simplePin);
await tester.shortWait(); await tester.longWait();
await tester.tap(find.byKey(saveButton).hitTestable()); await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait(); await tester.shortWait();

View File

@ -34,87 +34,121 @@ void main() {
group('PIV Settings', skip: isAndroid, () { group('PIV Settings', skip: isAndroid, () {
const factoryPin = '123456'; const factoryPin = '123456';
const factoryPuk = '12345678'; const factoryPuk = '12345678';
appTest('Reset PIV (settings-init)', (WidgetTester tester) async { const uno = 'abcdabcd';
const due = 'bcdabcda';
const tre = 'cdabcdab';
appTest('reset PIV (settings-init)', (WidgetTester tester) async {
await tester.resetPiv(); await tester.resetPiv();
await tester.shortWait(); await tester.shortWait();
}); });
appTest('Lock PIN, unlock with PUK', (WidgetTester tester) async {
await tester.configurePiv();
await tester.shortWait();
await tester.tap(find.byKey(managePinAction).hitTestable());
await tester.shortWait();
await tester.lockPinPuk();
await tester.shortWait();
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
/// TODO: This expect needs to verify that Pin subtitle is 'Blocked' appTest('pin lock-unlock', (WidgetTester tester) async {
/// expect(find.byKey(managePinAction), find.byTooltip('Blocked')); await tester.resetPiv();
await tester.shortWait(); await tester.shortWait();
await tester.pinView();
await tester.pivFirst();
await tester.longWait();
await tester.pinView();
await tester.longWait();
await tester.pivLockTest();
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.shortWait();
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.longWait();
expect(find.text('Blocked, use PUK to reset'), findsOne);
await tester.tap(find.byKey(managePinAction).hitTestable()); await tester.tap(find.byKey(managePinAction).hitTestable());
await tester.shortWait(); await tester.shortWait();
await tester.enterText(find.byKey(pinPukField).hitTestable(), factoryPuk);
await tester.shortWait(); // PUK field is pre-filled
await tester.enterText( await tester.pivFirst();
find.byKey(newPinPukField).hitTestable(), factoryPin); await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.enterText(
find.byKey(confirmPinPukField).hitTestable(), factoryPin);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait();
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.longWait(); await tester.longWait();
await tester.resetPiv();
expect(find.text('Blocked, use PUK to reset'), findsNothing);
}); });
appTest('Lock PUK, lock PIN, factory reset', (WidgetTester tester) async {
await tester.configurePiv();
await tester.shortWait();
await tester.tap(find.byKey(managePukAction).hitTestable());
await tester.shortWait();
await tester.lockPinPuk();
await tester.shortWait();
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
/// TODO: This expect needs to verify that PUK underline is 'Blocked' appTest('lock PUK, lock PIN, factory reset', (WidgetTester tester) async {
/// expect(find.byKey(managePukAction), find.byTooltip('Blocked'));
await tester.shortWait();
await tester.tap(find.byKey(managePinAction).hitTestable());
await tester.shortWait();
await tester.lockPinPuk();
await tester.shortWait();
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
/// TODO: This expect needs to verify that Pin underline is 'Blocked'
/// expect(find.byKey(managePinAction), find.byTooltip('Blocked'));
await tester.shortWait();
await tester.tap(find.byKey(managePinAction).hitTestable());
await tester.shortWait();
await tester.tap(find.byKey(managePukAction).hitTestable());
await tester.shortWait();
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.longWait();
await tester.resetPiv(); await tester.resetPiv();
await tester.shortWait();
// set first pin/puk
await tester.pinView();
await tester.pivFirst();
await tester.pukView();
await tester.pivFirst();
// lock pin and puk
await tester.pinView();
await tester.pivLockTest();
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.shortWait();
await tester.pukView();
await tester.pivLockTest();
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.shortWait();
// verify blockedness
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
expect(find.text('Blocked, factory reset needed'), findsAny);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.shortWait();
}); });
appTest('Change PIN', (WidgetTester tester) async { appTest('Change PIN', (WidgetTester tester) async {
const newpin = '123123'; await tester.resetPiv();
await tester.configurePiv();
await tester.tap(find.byKey(managePinAction).hitTestable());
await tester.shortWait(); await tester.shortWait();
await tester.enterText(find.byKey(pinPukField).hitTestable(), factoryPin);
//reset factorypin
await tester.pinView();
await tester.pivFirst();
// onepin
await tester.pinView();
await tester.enterText(find.byKey(pinPukField).hitTestable(), 'firstpin');
await tester.shortWait(); await tester.shortWait();
await tester.enterText(find.byKey(newPinPukField).hitTestable(), newpin); await tester.enterText(find.byKey(newPinPukField).hitTestable(), uno);
await tester.shortWait(); await tester.shortWait();
await tester.enterText( await tester.enterText(find.byKey(confirmPinPukField).hitTestable(), uno);
find.byKey(confirmPinPukField).hitTestable(), newpin);
await tester.shortWait(); await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable()); await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait();
await tester.configurePiv();
await tester.tap(find.byKey(managePinAction).hitTestable());
await tester.shortWait(); await tester.shortWait();
await tester.enterText(find.byKey(pinPukField).hitTestable(), newpin);
// onepin
await tester.pinView();
await tester.enterText(find.byKey(pinPukField).hitTestable(), uno);
await tester.shortWait();
await tester.enterText(find.byKey(newPinPukField).hitTestable(), due);
await tester.shortWait();
await tester.enterText(find.byKey(confirmPinPukField).hitTestable(), due);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait();
// onepin
await tester.pinView();
await tester.enterText(find.byKey(pinPukField).hitTestable(), due);
await tester.shortWait();
await tester.enterText(find.byKey(newPinPukField).hitTestable(), tre);
await tester.shortWait();
await tester.enterText(find.byKey(confirmPinPukField).hitTestable(), tre);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait();
// factorpin
await tester.pinView();
await tester.enterText(find.byKey(pinPukField).hitTestable(), tre);
await tester.shortWait(); await tester.shortWait();
await tester.enterText( await tester.enterText(
find.byKey(newPinPukField).hitTestable(), factoryPin); find.byKey(newPinPukField).hitTestable(), factoryPin);
@ -123,26 +157,52 @@ void main() {
find.byKey(confirmPinPukField).hitTestable(), factoryPin); find.byKey(confirmPinPukField).hitTestable(), factoryPin);
await tester.shortWait(); await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable()); await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait(); await tester.shortWait();
}); });
appTest('Change PUK', (WidgetTester tester) async { appTest('Change PUK', (WidgetTester tester) async {
const newpuk = '12341234'; await tester.resetPiv();
await tester.configurePiv();
await tester.tap(find.byKey(managePukAction).hitTestable());
await tester.shortWait(); await tester.shortWait();
await tester.enterText(find.byKey(pinPukField).hitTestable(), factoryPuk);
//reset factorypuk
await tester.pinView();
await tester.pivFirst();
// onepin
await tester.pinView();
await tester.enterText(find.byKey(pinPukField).hitTestable(), 'firstpin');
await tester.shortWait(); await tester.shortWait();
await tester.enterText(find.byKey(newPinPukField).hitTestable(), newpuk); await tester.enterText(find.byKey(newPinPukField).hitTestable(), uno);
await tester.shortWait(); await tester.shortWait();
await tester.enterText( await tester.enterText(find.byKey(confirmPinPukField).hitTestable(), uno);
find.byKey(confirmPinPukField).hitTestable(), newpuk);
await tester.shortWait(); await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable()); await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait();
await tester.configurePiv();
await tester.tap(find.byKey(managePukAction).hitTestable());
await tester.shortWait(); await tester.shortWait();
await tester.enterText(find.byKey(pinPukField).hitTestable(), newpuk);
// onepin
await tester.pinView();
await tester.enterText(find.byKey(pinPukField).hitTestable(), uno);
await tester.shortWait();
await tester.enterText(find.byKey(newPinPukField).hitTestable(), due);
await tester.shortWait();
await tester.enterText(find.byKey(confirmPinPukField).hitTestable(), due);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait();
// onepin
await tester.pinView();
await tester.enterText(find.byKey(pinPukField).hitTestable(), due);
await tester.shortWait();
await tester.enterText(find.byKey(newPinPukField).hitTestable(), tre);
await tester.shortWait();
await tester.enterText(find.byKey(confirmPinPukField).hitTestable(), tre);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait();
// factorpuk
await tester.pinView();
await tester.enterText(find.byKey(pinPukField).hitTestable(), tre);
await tester.shortWait(); await tester.shortWait();
await tester.enterText( await tester.enterText(
find.byKey(newPinPukField).hitTestable(), factoryPuk); find.byKey(newPinPukField).hitTestable(), factoryPuk);
@ -151,127 +211,148 @@ void main() {
find.byKey(confirmPinPukField).hitTestable(), factoryPuk); find.byKey(confirmPinPukField).hitTestable(), factoryPuk);
await tester.shortWait(); await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable()); await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait();
});
group('PIV Management Key', () {
const newmanagementkey =
'aaaabbbbccccaaaabbbbccccaaaabbbbccccaaaabbbbcccc';
const boundsmanagementkey =
'llllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkmmmm';
const shortmanagementkey =
'aaaabbbbccccaaaabbbbccccaaaabbbbccccaaaabbbbccc';
appTest('Out of bounds managementkey key', (WidgetTester tester) async {
await tester.configurePiv();
await tester.shortWait();
await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
await tester.longWait();
// testing out of bounds management key does not work
await tester.enterText(
find.byKey(newPinPukField).hitTestable(), boundsmanagementkey);
await tester.longWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait();
expect(tester.isTextButtonEnabled(saveButton), true);
// TODO assert that errorText and errorIcon are shown
});
appTest('Short managementkey key', (WidgetTester tester) async {
await tester.configurePiv();
await tester.shortWait();
await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
await tester.longWait();
// testing too short management key does not work
await tester.enterText(
find.byKey(newPinPukField).hitTestable(), shortmanagementkey);
await tester.longWait();
expect(tester.isTextButtonEnabled(saveButton), false);
});
appTest('Change managementkey key', (WidgetTester tester) async {
await tester.configurePiv();
await tester.shortWait();
await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
await tester.shortWait();
// setting newmanagementkey
await tester.enterText(
find.byKey(newPinPukField).hitTestable(), newmanagementkey);
await tester.longWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait();
// verifying newmanagementkey
await tester.configurePiv();
await tester.shortWait();
await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
await tester.shortWait();
await tester.enterText(
find.byKey(managementKeyField).hitTestable(), newmanagementkey);
await tester.shortWait();
await tester.enterText(
find.byKey(newPinPukField).hitTestable(), newmanagementkey);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait();
await tester.resetPiv();
});
appTest('Change managementkey type', (WidgetTester tester) async {
await tester.configurePiv();
await tester.shortWait();
await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
await tester.shortWait();
// TODO: this needs to use manageManagementKeyAction chip
await tester.enterText(
find.byKey(newPinPukField).hitTestable(), newmanagementkey);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait();
await tester.resetPiv();
await tester.shortWait(); await tester.shortWait();
}); });
appTest('Change managementkey PIN-lock', (WidgetTester tester) async { // group('PIV Management Key', () {
await tester.configurePiv(); // const newmanagementkey =
await tester.shortWait(); // 'aaaabbbbccccaaaabbbbccccaaaabbbbccccaaaabbbbcccc';
await tester.tap(find.byKey(manageManagementKeyAction).hitTestable()); // const boundsmanagementkey =
await tester.shortWait(); // 'llllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkssssllllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkmmmm';
// testing out of bounds management key does not work // const shortmanagementkey =
await tester.enterText( // 'aaaabbbbccccaaaabbbbccccaaaabbbbccccaaaabbbbccc';
find.byKey(newPinPukField).hitTestable(), newmanagementkey); //
await tester.shortWait(); // appTest('Out of bounds managementkey key', (WidgetTester tester) async {
// TODO: Investigate why chip-tap fails // //await tester.resetPiv();
//await tester.tap(find.byKey(pinLockManagementKeyChip).hitTestable());
// await tester.shortWait(); // await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable()); //
await tester.longWait(); // // short management key
await tester.resetPiv(); // await tester.configurePiv();
await tester.shortWait(); // await tester.shortWait();
}); // await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
// await tester.longWait();
appTest('Random managementkeytype', (WidgetTester tester) async { // // testing out of bounds management key does not work
await tester.configurePiv(); // await tester.enterText(
await tester.shortWait(); // find.text('New management key').hitTestable(), shortmanagementkey);
await tester.tap(find.byKey(manageManagementKeyAction).hitTestable()); // await tester.longWait();
await tester.shortWait(); //
// rndm 3x, for luck // expect(tester.isTextButtonEnabled(saveButton), false);
await tester.tap(find.byKey(managementKeyRefresh).hitTestable()); // expect(find.text('47/48'), findsOne);
await tester.shortWait(); // await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.tap(find.byKey(managementKeyRefresh).hitTestable()); //
await tester.shortWait(); // // out of bounds management key
await tester.tap(find.byKey(managementKeyRefresh).hitTestable()); // await tester.configurePiv();
await tester.shortWait(); // await tester.shortWait();
await tester.enterText( // await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
find.byKey(newPinPukField).hitTestable(), newmanagementkey); // await tester.shortWait();
await tester.shortWait(); // // testing out of bounds management key does not work
await tester.tap(find.byKey(saveButton).hitTestable()); // await tester.enterText(
await tester.longWait(); // find.byKey(newManagementKeyField).hitTestable(), shortmanagementkey);
await tester.resetPiv(); // await tester.shortWait();
}); //
// expect(tester.isTextButtonEnabled(saveButton), false);
appTest('Reset PIV (settings-exit)', (WidgetTester tester) async { // expect(find.text('48/48'), findsOne);
await tester.resetPiv(); // expect(find.text('llllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkssssllllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkmmmm'), findsNothing);
await tester.shortWait(); // await tester.sendKeyEvent(LogicalKeyboardKey.escape);
}); //
}); //
// });
//
// appTest('Short managementkey key', (WidgetTester tester) async {
// await tester.configurePiv();
// await tester.shortWait();
// await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
// await tester.longWait();
// // testing too short management key does not work
// await tester.enterText(
// find.byKey(newPinPukField).hitTestable(), shortmanagementkey);
// await tester.longWait();
// expect(tester.isTextButtonEnabled(saveButton), false);
// });
//
// appTest('Change managementkey key', (WidgetTester tester) async {
// await tester.configurePiv();
// await tester.shortWait();
// await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
// await tester.shortWait();
// // setting newmanagementkey
// await tester.enterText(
// find.byKey(newPinPukField).hitTestable(), newmanagementkey);
// await tester.longWait();
// await tester.tap(find.byKey(saveButton).hitTestable());
// await tester.longWait();
// // verifying newmanagementkey
// await tester.configurePiv();
// await tester.shortWait();
// await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
// await tester.shortWait();
// await tester.enterText(
// find.byKey(managementKeyField).hitTestable(), newmanagementkey);
// await tester.shortWait();
// await tester.enterText(
// find.byKey(newPinPukField).hitTestable(), newmanagementkey);
// await tester.shortWait();
// await tester.tap(find.byKey(saveButton).hitTestable());
// await tester.longWait();
// await tester.resetPiv();
// });
// appTest('Change managementkey type', (WidgetTester tester) async {
// await tester.configurePiv();
// await tester.shortWait();
// await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
// await tester.shortWait();
// // TODO: this needs to use manageManagementKeyAction chip
// await tester.enterText(
// find.byKey(newPinPukField).hitTestable(), newmanagementkey);
// await tester.shortWait();
// await tester.tap(find.byKey(saveButton).hitTestable());
// await tester.longWait();
//
// await tester.resetPiv();
// await tester.shortWait();
// });
// appTest('Change managementkey PIN-lock', (WidgetTester tester) async {
// await tester.configurePiv();
// await tester.shortWait();
// await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
// await tester.shortWait();
// // testing out of bounds management key does not work
// await tester.enterText(
// find.byKey(newPinPukField).hitTestable(), newmanagementkey);
// await tester.shortWait();
// // TODO: Investigate why chip-tap fails
// //await tester.tap(find.byKey(pinLockManagementKeyChip).hitTestable());
// //await tester.shortWait();
// await tester.tap(find.byKey(saveButton).hitTestable());
// await tester.longWait();
// await tester.resetPiv();
// await tester.shortWait();
// });
//
// appTest('Random managementkeytype', (WidgetTester tester) async {
// await tester.configurePiv();
// await tester.shortWait();
// await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
// await tester.shortWait();
// // rndm 3x, for luck
// await tester.tap(find.byKey(managementKeyRefresh).hitTestable());
// await tester.shortWait();
// await tester.tap(find.byKey(managementKeyRefresh).hitTestable());
// await tester.shortWait();
// await tester.tap(find.byKey(managementKeyRefresh).hitTestable());
// await tester.shortWait();
// await tester.enterText(
// find.byKey(newPinPukField).hitTestable(), newmanagementkey);
// await tester.shortWait();
// await tester.tap(find.byKey(saveButton).hitTestable());
// await tester.longWait();
// await tester.resetPiv();
// });
//
// appTest('Reset PIV (settings-exit)', (WidgetTester tester) async {
// await tester.resetPiv();
// await tester.shortWait();
// });
// });
}); });
// Distinguished name schema according to RFC 4514 // Distinguished name schema according to RFC 4514
@ -303,11 +384,11 @@ void main() {
await tester.tap(find.byKey(generateAction).hitTestable()); await tester.tap(find.byKey(generateAction).hitTestable());
await tester.longWait(); await tester.longWait();
// 4. enter PIN and click Unlock // 4. enter PIN and click Unlock
await tester.enterText( // await tester.enterText(
find.byKey(managementKeyField).hitTestable(), '123456'); // find.byKey(managementKeyField).hitTestable(), '123456');
await tester.longWait(); // await tester.longWait();
await tester.tap(find.byKey(unlockButton).hitTestable()); // await tester.tap(find.byKey(unlockButton).hitTestable());
await tester.longWait(); // await tester.longWait();
// 5. Enter DN // 5. Enter DN
await tester.enterText( await tester.enterText(
@ -331,7 +412,7 @@ void main() {
return false; return false;
}), findsOneWidget);*/ }), findsOneWidget);*/
await tester.pump(const Duration(milliseconds: 5000)); await tester.longWait();
// 10. Export Certificate // 10. Export Certificate
// await tester.tap(find.byKey(exportAction).hitTestable()); // await tester.tap(find.byKey(exportAction).hitTestable());
// await tester.enterText( // await tester.enterText(
@ -355,11 +436,11 @@ void main() {
await tester.tap(find.byKey(generateAction).hitTestable()); await tester.tap(find.byKey(generateAction).hitTestable());
await tester.longWait(); await tester.longWait();
// 4. enter PIN and click Unlock // 4. enter PIN and click Unlock
await tester.enterText( // await tester.enterText(
find.byKey(managementKeyField).hitTestable(), '123456'); // find.byKey(managementKeyField).hitTestable(), '123456');
await tester.longWait(); // await tester.longWait();
await tester.tap(find.byKey(unlockButton).hitTestable()); // await tester.tap(find.byKey(unlockButton).hitTestable());
await tester.longWait(); // await tester.longWait();
// 5. Enter DN // 5. Enter DN
await tester.enterText( await tester.enterText(
@ -403,11 +484,11 @@ void main() {
await tester.tap(find.byKey(generateAction).hitTestable()); await tester.tap(find.byKey(generateAction).hitTestable());
await tester.longWait(); await tester.longWait();
// 4. enter PIN and click Unlock // 4. enter PIN and click Unlock
await tester.enterText( // await tester.enterText(
find.byKey(managementKeyField).hitTestable(), '123456'); // find.byKey(managementKeyField).hitTestable(), '123456');
await tester.longWait(); // await tester.longWait();
await tester.tap(find.byKey(unlockButton).hitTestable()); // await tester.tap(find.byKey(unlockButton).hitTestable());
await tester.longWait(); // await tester.longWait();
// 5. Enter DN // 5. Enter DN
await tester.enterText( await tester.enterText(
@ -456,11 +537,11 @@ void main() {
await tester.tap(find.byKey(generateAction).hitTestable()); await tester.tap(find.byKey(generateAction).hitTestable());
await tester.longWait(); await tester.longWait();
// 4. enter PIN and click Unlock // 4. enter PIN and click Unlock
await tester.enterText( // await tester.enterText(
find.byKey(managementKeyField).hitTestable(), '123456'); // find.byKey(managementKeyField).hitTestable(), '123456');
await tester.longWait(); // await tester.longWait();
await tester.tap(find.byKey(unlockButton).hitTestable()); // await tester.tap(find.byKey(unlockButton).hitTestable());
await tester.longWait(); // await tester.longWait();
// 5. Enter DN // 5. Enter DN
await tester.enterText( await tester.enterText(
@ -497,59 +578,59 @@ void main() {
await tester.tap(find.byKey(deleteButton).hitTestable()); await tester.tap(find.byKey(deleteButton).hitTestable());
await tester.longWait(); await tester.longWait();
}); });
appTest('Import outdated Key+Certificate from file', // appTest('Import outdated Key+Certificate from file',
(WidgetTester tester) async {}); // (WidgetTester tester) async {});
//
/// TODO fileload needs to be handled // /// TODO fileload needs to be handled
appTest('Import neverexpire Key+Certificate from file', // appTest('Import neverexpire Key+Certificate from file',
(WidgetTester tester) async { // (WidgetTester tester) async {
/// TODO fileload needs to be handled // /// TODO fileload needs to be handled
});
appTest('Generate a CSR', (WidgetTester tester) async {
// 1. open PIV view
var pivDrawerButton = find.byKey(pivAppDrawer).hitTestable();
await tester.tap(pivDrawerButton);
await tester.longWait();
// 2. click meatball menu for 9e
await tester.tap(find.byKey(meatballButton9e).hitTestable());
await tester.longWait();
// 3. click generate
await tester.tap(find.byKey(generateAction).hitTestable());
await tester.longWait();
// 4. enter PIN and click Unlock
await tester.enterText(
find.byKey(managementKeyField).hitTestable(), '123456');
await tester.longWait();
await tester.tap(find.byKey(unlockButton).hitTestable());
await tester.longWait();
// 5. Enter DN
await tester.enterText(
find.byKey(subjectField).hitTestable(), 'CN=Generate9e-CSR');
await tester.longWait();
// 6. Change 'output format': CSR
// enum models.dart, generate_key_dialog.dart
// 7. Choose File Name > Save As > 'File Name generate93-csr'
// TODO: where are files saved?
// 8. click save
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.longWait();
// 9 Verify 'No certificate loaded'
/* expect(find.byWidgetPredicate((widget) {
if (widget is TooltipIfTruncated) {
final TooltipIfTruncated textWidget = widget;
if (textWidget.key == certInfoSubjectKey &&
textWidget.text == 'CN=Generate9e') {
return true;
}
}
return false;
}), findsOneWidget);*/
});
// appTest('Reset PIV (load-exit)', (WidgetTester tester) async {
// /// TODO: investigate why this reset randomly fails!
// await tester.resetPiv();
// await tester.shortWait();
// }); // });
// appTest('Generate a CSR', (WidgetTester tester) async {
// // 1. open PIV view
// var pivDrawerButton = find.byKey(pivAppDrawer).hitTestable();
// await tester.tap(pivDrawerButton);
// await tester.longWait();
// // 2. click meatball menu for 9e
// await tester.tap(find.byKey(meatballButton9e).hitTestable());
// await tester.longWait();
// // 3. click generate
// await tester.tap(find.byKey(generateAction).hitTestable());
// await tester.longWait();
// // 4. enter PIN and click Unlock
// // await tester.enterText(
// // find.byKey(managementKeyField).hitTestable(), '123456');
// // await tester.longWait();
// // await tester.tap(find.byKey(unlockButton).hitTestable());
// // await tester.longWait();
//
// // 5. Enter DN
// await tester.enterText(
// find.byKey(subjectField).hitTestable(), 'CN=Generate9e-CSR');
// await tester.longWait();
// // 6. Change 'output format': CSR
// // enum models.dart, generate_key_dialog.dart
// // 7. Choose File Name > Save As > 'File Name generate93-csr'
// // TODO: where are files saved?
// // 8. click save
// await tester.tap(find.byKey(saveButton).hitTestable());
// await tester.longWait();
// // 9 Verify 'No certificate loaded'
// /* expect(find.byWidgetPredicate((widget) {
// if (widget is TooltipIfTruncated) {
// final TooltipIfTruncated textWidget = widget;
// if (textWidget.key == certInfoSubjectKey &&
// textWidget.text == 'CN=Generate9e') {
// return true;
// }
// }
// return false;
// }), findsOneWidget);*/
// });
// // appTest('Reset PIV (load-exit)', (WidgetTester tester) async {
// // /// TODO: investigate why this reset randomly fails!
// // await tester.resetPiv();
// // await tester.shortWait();
// // });
}); });
} }

View File

@ -149,7 +149,7 @@ extension OathFunctions on WidgetTester {
Finder findAccountList() { Finder findAccountList() {
var accountList = var accountList =
find.byType(AccountList).hitTestable(at: Alignment.topCenter); find.byType(AccountList).hitTestable(at: Alignment.topCenter);
expect(accountList, findsOneWidget); // expect(accountList, findsOneWidget);
return accountList; return accountList;
} }
@ -310,19 +310,23 @@ extension OathFunctions on WidgetTester {
await switchToKey(targetKey); await switchToKey(targetKey);
await shortWait(); await shortWait();
/// 2. open the key menu /// 2. open the home view
await tapPopupMenu(targetKey); await tap(find.byKey(homeDrawer).hitTestable());
await shortWait(); await shortWait();
await tap(find.byKey(yubikeyFactoryResetMenuButton).hitTestable());
await longWait();
/// 3. then toggle 'OATH' in the 'Factory reset' reset_dialog.dart /// 3. open menu
await tap(find.byKey(actionsIconButtonKey).hitTestable());
await shortWait();
await tap(find.byKey(yubikeyFactoryResetMenuButton));
await shortWait();
/// 4. then toggle 'Piv' in the 'Factory reset' reset_dialog.dart
await tap(find.byKey(factoryResetPickResetOath)); await tap(find.byKey(factoryResetPickResetOath));
await longWait(); await longWait();
/// 4. Click reset TextButton: done /// 5. Click reset TextButton: done
await tap(find.byKey(factoryResetReset)); await tap(find.byKey(factoryResetReset));
await shortWait(); await longWait();
} }
/// Opens the device menu and taps the "Set/Manage password" menu item /// Opens the device menu and taps the "Set/Manage password" menu item

View File

@ -35,7 +35,7 @@ extension Fido2Functions on WidgetTester {
await shortWait(); await shortWait();
} }
/// Factory reset Fido2 application /// Factory reset FIDO application
Future<void> resetFido2() async { Future<void> resetFido2() async {
final targetKey = approvedKeys[0]; // only reset approved keys! final targetKey = approvedKeys[0]; // only reset approved keys!
@ -43,24 +43,55 @@ extension Fido2Functions on WidgetTester {
await switchToKey(targetKey); await switchToKey(targetKey);
await shortWait(); await shortWait();
/// 2. open the key menu /// 2. open the home view
await tapPopupMenu(targetKey); await tap(find.byKey(homeDrawer).hitTestable());
await shortWait(); await shortWait();
await tap(find.byKey(yubikeyFactoryResetMenuButton).hitTestable());
await longWait();
/// 3. then toggle 'Fido2' in the 'Factory reset' reset_dialog.dart /// 3. open menu
await tap(find.byKey(actionsIconButtonKey).hitTestable());
await shortWait();
await tap(find.byKey(yubikeyFactoryResetMenuButton));
await shortWait();
/// 4. then toggle 'Piv' in the 'Factory reset' reset_dialog.dart
await tap(find.byKey(factoryResetPickResetFido2)); await tap(find.byKey(factoryResetPickResetFido2));
await longWait(); await longWait();
/// 4. Click reset TextButton: done /// 5. Click reset TextButton: done
await tap(find.byKey(factoryResetReset)); await tap(find.byKey(factoryResetReset));
await fido2DanceWait(); await fido2DanceWait();
/// 5. Click the 'Close' button /// 6. Click the close button
await tap(find.text('Close').hitTestable()); await tap(find.text('Close').hitTestable());
await shortWait(); await shortWait();
}
/// TODO 6. Verify Resetedness // /// Factory reset Fido2 application
} // Future<void> resetFido2() async {
// final targetKey = approvedKeys[0]; // only reset approved keys!
//
// /// 1. make sure we are using approved key
// await switchToKey(targetKey);
// await shortWait();
//
// /// 2. open the key menu
// await tapPopupMenu(targetKey);
// await shortWait();
// await tap(find.byKey(yubikeyFactoryResetMenuButton).hitTestable());
// await longWait();
//
// /// 3. then toggle 'Fido2' in the 'Factory reset' reset_dialog.dart
// await tap(find.byKey(factoryResetPickResetFido2));
// await longWait();
//
// /// 4. Click reset TextButton: done
// await tap(find.byKey(factoryResetReset));
// await fido2DanceWait();
//
// /// 5. Click the 'Close' button
// await tap(find.text('Close').hitTestable());
// await shortWait();
//
// /// TODO 6. Verify Resetedness
// }
} }

View File

@ -22,30 +22,112 @@ import 'package:yubico_authenticator/piv/keys.dart';
import 'test_util.dart'; import 'test_util.dart';
extension PIVFunctions on WidgetTester { extension PIVFunctions on WidgetTester {
static const ett = 'firstpin';
static const lock1 = 'lockpinn1';
static const lock2 = 'lockpinn2';
static const lock3 = 'lockpinn3';
/// Open the PIV Configuration /// Open the PIV Configuration
Future<void> configurePiv() async { Future<void> configurePiv() async {
// 1. open PIV view await tap(find.byKey(pivAppDrawer).hitTestable());
var pivDrawerButton = find.byKey(pivAppDrawer).hitTestable(); await shortWait();
await tap(pivDrawerButton);
await longWait();
await tap(find.byKey(actionsIconButtonKey).hitTestable()); await tap(find.byKey(actionsIconButtonKey).hitTestable());
await longWait(); await shortWait();
} }
/// Locks PIN or PUK Future<void> pinView() async {
Future<void> lockPinPuk() async { await tap(find.byKey(pivAppDrawer).hitTestable());
for (var i = 0; i < 3; i += 1) {
var wrongpin = '123456$i';
await enterText(find.byKey(pinPukField).hitTestable(), wrongpin);
await shortWait(); await shortWait();
await enterText(find.byKey(newPinPukField).hitTestable(), wrongpin); await tap(find.byKey(actionsIconButtonKey).hitTestable());
await shortWait(); await shortWait();
await enterText(find.byKey(confirmPinPukField).hitTestable(), wrongpin); await tap(find.byKey(managePinAction));
await shortWait();
}
Future<void> pukView() async {
await tap(find.byKey(pivAppDrawer).hitTestable());
await shortWait();
await tap(find.byKey(actionsIconButtonKey).hitTestable());
await shortWait();
await tap(find.byKey(managePukAction));
await shortWait();
}
Future<void> managementKeyView() async {
await tap(find.byKey(pivAppDrawer).hitTestable());
await shortWait();
await tap(find.byKey(actionsIconButtonKey).hitTestable());
await shortWait();
await tap(find.byKey(manageManagementKeyAction));
await shortWait();
}
Future<void> pivFirst() async {
// when in pin or puk view, remove factorypin/puk
await enterText(find.byKey(newPinPukField), ett);
await shortWait();
await enterText(find.byKey(confirmPinPukField), ett);
await shortWait();
await tap(find.byKey(saveButton).hitTestable());
await shortWait();
}
Future<void> pivLockTest() async {
// when in pin or puk view this will lock it
var pintext1 = 'lockpin1';
await enterText(find.byKey(pinPukField), pintext1);
await shortWait();
await enterText(find.byKey(newPinPukField), pintext1);
await shortWait();
await enterText(find.byKey(confirmPinPukField), pintext1);
await shortWait();
await tap(find.byKey(saveButton).hitTestable());
await shortWait();
var pintext2 = 'lockpin2';
await enterText(find.byKey(pinPukField), pintext2);
await shortWait();
await enterText(find.byKey(newPinPukField), pintext2);
await shortWait();
await enterText(find.byKey(confirmPinPukField), pintext2);
await shortWait();
await tap(find.byKey(saveButton).hitTestable());
await shortWait();
var pintext3 = 'lockpin3';
await enterText(find.byKey(pinPukField), pintext3);
await shortWait();
await enterText(find.byKey(newPinPukField), pintext3);
await shortWait();
await enterText(find.byKey(confirmPinPukField), pintext3);
await shortWait(); await shortWait();
await tap(find.byKey(saveButton).hitTestable()); await tap(find.byKey(saveButton).hitTestable());
await longWait(); await longWait();
} }
Future<void> pivLock() async {
// when in pin or puk view this will lock it
// for (var i = 0; i < 3; i += 1) {
await enterText(find.byKey(pinPukField), 'skrivhär');
await shortWait();
await enterText(find.byKey(newPinPukField), lock1);
await shortWait();
await enterText(find.byKey(confirmPinPukField), lock1);
await shortWait();
await tap(find.byKey(saveButton).hitTestable());
await shortWait();
await enterText(find.byKey(pinPukField), lock2);
await shortWait();
await enterText(find.byKey(newPinPukField), lock2);
await shortWait();
await enterText(find.byKey(confirmPinPukField), lock2);
await shortWait();
await tap(find.byKey(saveButton).hitTestable());
await shortWait();
// }
await sendKeyEvent(LogicalKeyboardKey.escape); await sendKeyEvent(LogicalKeyboardKey.escape);
await shortWait();
} }
/// Factory reset Piv application /// Factory reset Piv application
@ -56,19 +138,23 @@ extension PIVFunctions on WidgetTester {
await switchToKey(targetKey); await switchToKey(targetKey);
await shortWait(); await shortWait();
/// 2. open the key menu /// 2. open the home view
await tapPopupMenu(targetKey); await tap(find.byKey(homeDrawer).hitTestable());
await shortWait(); await shortWait();
await tap(find.byKey(yubikeyFactoryResetMenuButton).hitTestable());
await longWait();
/// 3. then toggle 'Piv' in the 'Factory reset' reset_dialog.dart /// 3. open menu
await tap(find.byKey(actionsIconButtonKey).hitTestable());
await shortWait();
await tap(find.byKey(yubikeyFactoryResetMenuButton));
await shortWait();
/// 4. then toggle 'Piv' in the 'Factory reset' reset_dialog.dart
await tap(find.byKey(factoryResetPickResetPiv)); await tap(find.byKey(factoryResetPickResetPiv));
await longWait(); await longWait();
/// 4. Click reset TextButton: done /// 5. Click reset TextButton: done
await tap(find.byKey(factoryResetReset)); await tap(find.byKey(factoryResetReset));
await shortWait(); await longWait();
// 5. Verify Resetedness // 5. Verify Resetedness
// /// TODO: this expect algorithm is flaky // /// TODO: this expect algorithm is flaky

View File

@ -22,12 +22,11 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:yubico_authenticator/app/views/device_picker.dart'; import 'package:yubico_authenticator/app/views/device_picker.dart';
import 'package:yubico_authenticator/app/views/keys.dart'; import 'package:yubico_authenticator/app/views/keys.dart';
import 'package:yubico_authenticator/core/state.dart'; import 'package:yubico_authenticator/core/state.dart';
import 'package:yubico_authenticator/management/views/keys.dart';
import 'android/util.dart' as android_test_util; import 'android/util.dart' as android_test_util;
import 'desktop/util.dart' as desktop_test_util; import 'desktop/util.dart' as desktop_test_util;
const shortWaitMs = 200; const shortWaitMs = 240;
const longWaitMs = 500; const longWaitMs = 500;
const ultraLongWaitMs = 3000; const ultraLongWaitMs = 3000;
@ -235,15 +234,32 @@ extension AppWidgetTester on WidgetTester {
} }
/// Management screen /// Management screen
Future<void> openManagementScreen() async { Future<void> openHomeAndToggleScreen() async {
if (!isDrawerOpened()) { // if (!isDrawerOpened()) {
await openDrawer(); // await openDrawer();
// }
await tap(find.byKey(homeDrawer).hitTestable());
await shortWait();
await openToggleScreen();
//expect(find.byKey(screenKey), findsOneWidget);
} }
await tap(find.byKey(managementAppDrawer).hitTestable()); /// Toggle Application screen
await pump(const Duration(milliseconds: 500)); Future<void> openToggleScreen() async {
// if (!isDrawerOpened()) {
// await openDrawer();
// }
expect(find.byKey(screenKey), findsOneWidget); await tap(find.byKey(actionsIconButtonKey).hitTestable());
await shortWait();
await tap(find.byKey(yubikeyApplicationToggleMenuButton).hitTestable());
await shortWait();
//expect(find.byKey(screenKey), findsOneWidget);
} }
/// Retrieve a list of test approved serial numbers. /// Retrieve a list of test approved serial numbers.

View File

@ -25,6 +25,7 @@ import '../../app/message.dart';
import '../../app/models.dart'; import '../../app/models.dart';
import '../../app/shortcuts.dart'; import '../../app/shortcuts.dart';
import '../../app/views/action_list.dart'; import '../../app/views/action_list.dart';
import '../../app/views/keys.dart';
import '../../app/views/reset_dialog.dart'; import '../../app/views/reset_dialog.dart';
import '../../core/models.dart'; import '../../core/models.dart';
import '../../core/state.dart'; import '../../core/state.dart';
@ -57,6 +58,7 @@ Widget homeBuildActions(
title: deviceData.info.version.major > 4 title: deviceData.info.version.major > 4
? l10n.s_toggle_applications ? l10n.s_toggle_applications
: l10n.s_toggle_interfaces, : l10n.s_toggle_interfaces,
key: yubikeyApplicationToggleMenuButton,
subtitle: interfacesLocked subtitle: interfacesLocked
? l10n.l_factory_reset_required ? l10n.l_factory_reset_required
: (deviceData.info.version.major > 4 : (deviceData.info.version.major > 4
@ -82,6 +84,7 @@ Widget homeBuildActions(
ActionListItem( ActionListItem(
icon: const Icon(Symbols.delete_forever), icon: const Icon(Symbols.delete_forever),
title: l10n.s_factory_reset, title: l10n.s_factory_reset,
key: yubikeyFactoryResetMenuButton,
subtitle: l10n.l_factory_reset_desc, subtitle: l10n.l_factory_reset_desc,
actionStyle: ActionStyle.primary, actionStyle: ActionStyle.primary,
onTap: (context) { onTap: (context) {
@ -97,6 +100,7 @@ Widget homeBuildActions(
ActionListSection(l10n.s_application, children: [ ActionListSection(l10n.s_application, children: [
ActionListItem( ActionListItem(
icon: const Icon(Symbols.settings), icon: const Icon(Symbols.settings),
key: settingDrawerIcon,
title: l10n.s_settings, title: l10n.s_settings,
subtitle: l10n.l_settings_desc, subtitle: l10n.l_settings_desc,
actionStyle: ActionStyle.primary, actionStyle: ActionStyle.primary,
@ -107,6 +111,7 @@ Widget homeBuildActions(
), ),
ActionListItem( ActionListItem(
icon: const Icon(Symbols.help), icon: const Icon(Symbols.help),
key: helpDrawerIcon,
title: l10n.s_help_and_about, title: l10n.s_help_and_about,
subtitle: l10n.l_help_and_about_desc, subtitle: l10n.l_help_and_about_desc,
actionStyle: ActionStyle.primary, actionStyle: ActionStyle.primary,

View File

@ -40,6 +40,7 @@ const unlockButton = Key('$_prefix.unlock');
const resetButton = Key('$_prefix.reset'); const resetButton = Key('$_prefix.reset');
const managementKeyField = Key('$_prefix.management_key'); const managementKeyField = Key('$_prefix.management_key');
const newManagementKeyField = Key('$_prefix.management_key');
const managementKeyRefresh = Key('$_prefix.management_key_refresh'); const managementKeyRefresh = Key('$_prefix.management_key_refresh');
const pinPukField = Key('$_prefix.pin_puk'); const pinPukField = Key('$_prefix.pin_puk');

View File

@ -292,7 +292,7 @@ class _ManageKeyDialogState extends ConsumerState<ManageKeyDialog> {
}, },
).init(), ).init(),
AppTextField( AppTextField(
key: keys.newPinPukField, key: keys.newManagementKeyField,
autofocus: _defaultKeyUsed, autofocus: _defaultKeyUsed,
autofillHints: const [AutofillHints.newPassword], autofillHints: const [AutofillHints.newPassword],
maxLength: hexLength, maxLength: hexLength,