mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-22 17:51:29 +03:00
Merge PR #1685
This commit is contained in:
commit
76f60a9eb5
@ -36,21 +36,22 @@ void main() {
|
||||
});
|
||||
group('Settings', () {
|
||||
appTestKeyless('Click through all Themes', (WidgetTester tester) async {
|
||||
var settingDrawerButton = find.byKey(settingDrawerIcon).hitTestable();
|
||||
await tester.tap(settingDrawerButton);
|
||||
await tester.longWait();
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(settingDrawerIcon).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(themeModeSetting));
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
await tester
|
||||
.tap(find.byKey(themeModeOption(ThemeMode.light)).hitTestable());
|
||||
await tester.longWait();
|
||||
await tester.tap(find.byKey(themeModeSetting));
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
await tester
|
||||
.tap(find.byKey(themeModeOption(ThemeMode.dark)).hitTestable());
|
||||
await tester.longWait();
|
||||
await tester.tap(find.byKey(themeModeSetting));
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
await tester
|
||||
.tap(find.byKey(themeModeOption(ThemeMode.system)).hitTestable());
|
||||
await tester.longWait();
|
||||
@ -60,6 +61,8 @@ void main() {
|
||||
var helpDrawerButton = find.byKey(helpDrawerIcon).hitTestable();
|
||||
|
||||
appTestKeyless('Check Licenses view', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(helpDrawerButton);
|
||||
await tester.shortWait();
|
||||
var licensesButtonText = find.byKey(licensesButton).hitTestable();
|
||||
@ -70,8 +73,10 @@ void main() {
|
||||
});
|
||||
group('Opening of URLs', () {
|
||||
appTestKeyless('TOS link', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(helpDrawerButton);
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
if (isAndroid) {
|
||||
expect(find.byKey(tosButton).hitTestable(), findsOneWidget);
|
||||
} else {
|
||||
@ -80,8 +85,10 @@ void main() {
|
||||
}
|
||||
});
|
||||
appTestKeyless('Privacy link', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(helpDrawerButton);
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
if (isAndroid) {
|
||||
expect(find.byKey(privacyButton).hitTestable(), findsOneWidget);
|
||||
} else {
|
||||
@ -90,8 +97,10 @@ void main() {
|
||||
}
|
||||
});
|
||||
appTestKeyless('Feedback link', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(helpDrawerButton);
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
if (isAndroid) {
|
||||
expect(find.byKey(userGuideButton).hitTestable(), findsOneWidget);
|
||||
} else {
|
||||
@ -100,6 +109,8 @@ void main() {
|
||||
}
|
||||
});
|
||||
appTestKeyless('Help link', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(helpDrawerButton);
|
||||
await tester.longWait();
|
||||
if (isAndroid) {
|
||||
@ -113,14 +124,18 @@ void main() {
|
||||
group('Troubleshooting', () {
|
||||
appTestKeyless('Diagnostics Button', skip: isAndroid,
|
||||
(WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(helpDrawerButton);
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(diagnosticsChip).hitTestable());
|
||||
await tester.longWait();
|
||||
});
|
||||
appTestKeyless('Log button', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(helpDrawerButton);
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(logChip).hitTestable());
|
||||
await tester.longWait();
|
||||
});
|
||||
|
@ -17,245 +17,288 @@
|
||||
@Tags(['desktop', 'management'])
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_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'
|
||||
as management_keys;
|
||||
import 'package:yubico_authenticator/management/views/keys.dart';
|
||||
|
||||
import 'utils/test_util.dart';
|
||||
|
||||
Key _getCapabilityWidgetKey(bool isUsb, String name) =>
|
||||
Key('management.keys.capability.${isUsb ? 'usb' : 'nfc'}.$name');
|
||||
|
||||
Future<FilterChip?> _getCapabilityWidget(Key key) async {
|
||||
return find.byKey(key).hitTestable().evaluate().single.widget as FilterChip;
|
||||
}
|
||||
// Key _getCapabilityWidgetKey(bool isUsb, String name) =>
|
||||
// Key('management.keys.capability.${isUsb ? 'usb' : 'nfc'}.$name');
|
||||
//
|
||||
// Future<FilterChip?> _getCapabilityWidget(Key key) async {
|
||||
// return find.byKey(key).hitTestable().evaluate().single.widget as FilterChip;
|
||||
// }
|
||||
|
||||
void main() {
|
||||
var binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
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', () {
|
||||
appTest('Toggle OTP', (WidgetTester tester) async {
|
||||
await tester.openManagementScreen();
|
||||
|
||||
// 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.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 (otpChip != null) {
|
||||
await tester.tap(find.byKey(usbOtpKey));
|
||||
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 PIV', (WidgetTester tester) async {
|
||||
await tester.openManagementScreen();
|
||||
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.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 (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.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
|
||||
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));
|
||||
appTest('Toggle all but PIV 1', (WidgetTester tester) async {
|
||||
await tester.openHomeAndToggleScreen();
|
||||
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.tap(find.text('Yubico OTP').hitTestable());
|
||||
await tester.shortWait();
|
||||
}
|
||||
await tester.openManagementScreen();
|
||||
if (u2fChip != null) {
|
||||
await tester.tap(find.byKey(usbU2fKey));
|
||||
await tester.tap(find.text('OATH').hitTestable());
|
||||
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.tap(find.text('OpenPGP').hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.text('YubiHSM Auth').hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.text('FIDO U2F').hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.text('FIDO2').hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(saveButtonKey).hitTestable());
|
||||
await tester.longWait();
|
||||
}
|
||||
});
|
||||
appTest('Toggle FIDO2', (WidgetTester tester) async {
|
||||
await tester.openManagementScreen();
|
||||
|
||||
// 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));
|
||||
});
|
||||
appTest('Toggle all but PIV 2', (WidgetTester tester) async {
|
||||
await tester.openHomeAndToggleScreen();
|
||||
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.tap(find.text('Yubico OTP').hitTestable());
|
||||
await tester.shortWait();
|
||||
}
|
||||
await tester.openManagementScreen();
|
||||
if (fido2Chip != null) {
|
||||
await tester.tap(find.byKey(usbFido2Key));
|
||||
await tester.tap(find.text('OATH').hitTestable());
|
||||
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.tap(find.text('OpenPGP').hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.text('YubiHSM Auth').hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.text('FIDO U2F').hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.text('FIDO2').hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(saveButtonKey).hitTestable());
|
||||
await tester.longWait();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// group('OLD: Toggle Applications on key', () {
|
||||
// appTest('Toggle OTP', (WidgetTester tester) async {
|
||||
// await tester.openHomeAndToggleScreen();
|
||||
// await tester.shortWait();
|
||||
// await tester.tap(find.text('Yubico OTP').hitTestable());
|
||||
// await tester.shortWait();
|
||||
// await tester.tap(find.byKey(saveButtonKey).hitTestable());
|
||||
// await tester.ultraLongWait();
|
||||
//
|
||||
// // TODO: expecter that the Yubico OTP is not present
|
||||
//
|
||||
// await tester.openHomeAndToggleScreen();
|
||||
// await tester.shortWait();
|
||||
// await tester.tap(find.text('Yubico OTP').hitTestable());
|
||||
// await tester.shortWait();
|
||||
// await tester.tap(find.byKey(saveButtonKey).hitTestable());
|
||||
// await tester.ultraLongWait();
|
||||
//
|
||||
// // TODO: this is old method of doing this test, review if usable.
|
||||
// // find USB OTP capability
|
||||
// // var usbOtpKey = _getCapabilityWidgetKey(true, 'Yubico 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.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 (otpChip != null) {
|
||||
// // await tester.tap(find.byKey(usbOtpKey));
|
||||
// // 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 PIV', (WidgetTester tester) async {
|
||||
// await tester.openToggleScreen();
|
||||
// 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.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();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
import 'package:yubico_authenticator/app/views/keys.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/views/account_list.dart';
|
||||
|
||||
@ -32,17 +31,17 @@ void main() {
|
||||
var binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
|
||||
group('OATH UI tests', () {
|
||||
appTest('Menu items exist', (WidgetTester tester) async {
|
||||
await tester.tapActionIconButton();
|
||||
await tester.shortWait();
|
||||
expect(find.byKey(keys.addAccountAction), findsOneWidget);
|
||||
expect(find.byKey(keys.setOrManagePasswordAction), findsOneWidget);
|
||||
// close dialog
|
||||
await tester.tapTopLeftCorner();
|
||||
await tester.longWait();
|
||||
});
|
||||
});
|
||||
// group('OATH UI tests', () {
|
||||
// appTest('Menu items exist', (WidgetTester tester) async {
|
||||
// await tester.tapActionIconButton();
|
||||
// await tester.shortWait();
|
||||
// expect(find.byKey(keys.addAccountAction), findsOneWidget);
|
||||
// expect(find.byKey(keys.setOrManagePasswordAction), findsOneWidget);
|
||||
// // close dialog
|
||||
// await tester.tapTopLeftCorner();
|
||||
// await tester.longWait();
|
||||
// });
|
||||
// });
|
||||
|
||||
group('Account creation', () {
|
||||
appTest('Initial reset OATH', (WidgetTester tester) async {
|
||||
@ -64,11 +63,11 @@ void main() {
|
||||
await tester.addAccount(testAccount);
|
||||
await tester.shortWait();
|
||||
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(AccountList),
|
||||
matching: find.textContaining(testAccount.name)),
|
||||
findsOneWidget);
|
||||
// expect(
|
||||
// find.descendant(
|
||||
// of: find.byType(AccountList),
|
||||
// matching: find.textContaining(testAccount.name)),
|
||||
// findsOneWidget);
|
||||
|
||||
await tester.shortWait();
|
||||
}
|
||||
@ -241,20 +240,20 @@ void main() {
|
||||
await tester.longWait();
|
||||
});
|
||||
|
||||
/// adds an account, renames, verifies
|
||||
appTest('Rename OATH account', (WidgetTester tester) async {
|
||||
var testAccount =
|
||||
const Account(issuer: 'IssuerToRename', name: 'NameToRename');
|
||||
|
||||
/// delete account if it exists
|
||||
await tester.deleteAccount(testAccount);
|
||||
await tester.deleteAccount(
|
||||
const Account(issuer: 'RenamedIssuer', name: 'RenamedName'));
|
||||
await tester.longWait();
|
||||
await tester.addAccount(testAccount);
|
||||
await tester.longWait();
|
||||
await tester.renameAccount(testAccount, 'RenamedIssuer', 'RenamedName');
|
||||
});
|
||||
// /// adds an account, renames, verifies
|
||||
// appTest('Rename OATH account', (WidgetTester tester) async {
|
||||
// var testAccount =
|
||||
// const Account(issuer: 'IssuerToRename', name: 'NameToRename');
|
||||
//
|
||||
// /// delete account if it exists
|
||||
// await tester.deleteAccount(testAccount);
|
||||
// await tester.deleteAccount(
|
||||
// const Account(issuer: 'RenamedIssuer', name: 'RenamedName'));
|
||||
// await tester.longWait();
|
||||
// await tester.addAccount(testAccount);
|
||||
// await tester.longWait();
|
||||
// await tester.renameAccount(testAccount, 'RenamedIssuer', 'RenamedName');
|
||||
// });
|
||||
});
|
||||
|
||||
group('Password tests', () {
|
||||
@ -265,20 +264,28 @@ void main() {
|
||||
var secondPassword = 'secondPassword';
|
||||
var thirdPassword = 'thirdPassword';
|
||||
appTest('Reset OATH', (WidgetTester tester) async {
|
||||
await tester.tapAppDrawerButton(oathAppDrawer);
|
||||
await tester.resetOATH();
|
||||
await tester.longWait();
|
||||
});
|
||||
appTest('Set first OATH password', (WidgetTester tester) async {
|
||||
await tester.tapAppDrawerButton(oathAppDrawer);
|
||||
|
||||
// Sets a password for OATH
|
||||
await tester.setOathPassword(firstPassword);
|
||||
});
|
||||
|
||||
appTest('Set second OATH password', (WidgetTester tester) async {
|
||||
await tester.tapAppDrawerButton(oathAppDrawer);
|
||||
|
||||
// Without removing the first, change to a second password
|
||||
await tester.unlockOathSession(firstPassword);
|
||||
await tester.replaceOathPassword(firstPassword, secondPassword);
|
||||
});
|
||||
|
||||
appTest('Set third OATH password', (WidgetTester tester) async {
|
||||
await tester.tapAppDrawerButton(oathAppDrawer);
|
||||
|
||||
// Without removing the second, set a third password
|
||||
await tester.unlockOathSession(secondPassword);
|
||||
await tester.replaceOathPassword(secondPassword, thirdPassword);
|
||||
|
@ -47,9 +47,9 @@ void main() {
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.enterText(find.byKey(newPin), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.longWait();
|
||||
await tester.enterText(find.byKey(confirmPin), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.longWait();
|
||||
|
||||
await tester.tap(find.byKey(saveButton).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
@ -34,87 +34,121 @@ void main() {
|
||||
group('PIV Settings', skip: isAndroid, () {
|
||||
const factoryPin = '123456';
|
||||
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.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'
|
||||
/// expect(find.byKey(managePinAction), find.byTooltip('Blocked'));
|
||||
appTest('pin lock-unlock', (WidgetTester tester) async {
|
||||
await tester.resetPiv();
|
||||
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.shortWait();
|
||||
await tester.enterText(find.byKey(pinPukField).hitTestable(), factoryPuk);
|
||||
await tester.shortWait();
|
||||
await tester.enterText(
|
||||
find.byKey(newPinPukField).hitTestable(), factoryPin);
|
||||
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);
|
||||
|
||||
// PUK field is pre-filled
|
||||
await tester.pivFirst();
|
||||
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
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'
|
||||
/// 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();
|
||||
appTest('lock PUK, lock PIN, factory reset', (WidgetTester tester) async {
|
||||
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 {
|
||||
const newpin = '123123';
|
||||
await tester.configurePiv();
|
||||
await tester.tap(find.byKey(managePinAction).hitTestable());
|
||||
await tester.resetPiv();
|
||||
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.enterText(find.byKey(newPinPukField).hitTestable(), newpin);
|
||||
await tester.enterText(find.byKey(newPinPukField).hitTestable(), uno);
|
||||
await tester.shortWait();
|
||||
await tester.enterText(
|
||||
find.byKey(confirmPinPukField).hitTestable(), newpin);
|
||||
await tester.enterText(find.byKey(confirmPinPukField).hitTestable(), uno);
|
||||
await tester.shortWait();
|
||||
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.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.enterText(
|
||||
find.byKey(newPinPukField).hitTestable(), factoryPin);
|
||||
@ -123,26 +157,52 @@ void main() {
|
||||
find.byKey(confirmPinPukField).hitTestable(), factoryPin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(saveButton).hitTestable());
|
||||
await tester.longWait();
|
||||
await tester.shortWait();
|
||||
});
|
||||
appTest('Change PUK', (WidgetTester tester) async {
|
||||
const newpuk = '12341234';
|
||||
await tester.configurePiv();
|
||||
await tester.tap(find.byKey(managePukAction).hitTestable());
|
||||
await tester.resetPiv();
|
||||
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.enterText(find.byKey(newPinPukField).hitTestable(), newpuk);
|
||||
await tester.enterText(find.byKey(newPinPukField).hitTestable(), uno);
|
||||
await tester.shortWait();
|
||||
await tester.enterText(
|
||||
find.byKey(confirmPinPukField).hitTestable(), newpuk);
|
||||
await tester.enterText(find.byKey(confirmPinPukField).hitTestable(), uno);
|
||||
await tester.shortWait();
|
||||
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.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.enterText(
|
||||
find.byKey(newPinPukField).hitTestable(), factoryPuk);
|
||||
@ -151,127 +211,148 @@ void main() {
|
||||
find.byKey(confirmPinPukField).hitTestable(), factoryPuk);
|
||||
await tester.shortWait();
|
||||
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();
|
||||
});
|
||||
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();
|
||||
});
|
||||
await tester.shortWait();
|
||||
});
|
||||
// group('PIV Management Key', () {
|
||||
// const newmanagementkey =
|
||||
// 'aaaabbbbccccaaaabbbbccccaaaabbbbccccaaaabbbbcccc';
|
||||
// const boundsmanagementkey =
|
||||
// 'llllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkssssllllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkmmmm';
|
||||
// const shortmanagementkey =
|
||||
// 'aaaabbbbccccaaaabbbbccccaaaabbbbccccaaaabbbbccc';
|
||||
//
|
||||
// appTest('Out of bounds managementkey key', (WidgetTester tester) async {
|
||||
// //await tester.resetPiv();
|
||||
// await tester.shortWait();
|
||||
//
|
||||
// // short management key
|
||||
// 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.text('New management key').hitTestable(), shortmanagementkey);
|
||||
// await tester.longWait();
|
||||
//
|
||||
// expect(tester.isTextButtonEnabled(saveButton), false);
|
||||
// expect(find.text('47/48'), findsOne);
|
||||
// await tester.sendKeyEvent(LogicalKeyboardKey.escape);
|
||||
//
|
||||
// // out of bounds management key
|
||||
// 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(newManagementKeyField).hitTestable(), shortmanagementkey);
|
||||
// await tester.shortWait();
|
||||
//
|
||||
// expect(tester.isTextButtonEnabled(saveButton), false);
|
||||
// expect(find.text('48/48'), findsOne);
|
||||
// expect(find.text('llllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkssssllllkkkkmmmmllllkkkkmmmmllllkkkkmmmmllllkkkkmmmm'), findsNothing);
|
||||
// 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
|
||||
@ -303,11 +384,11 @@ void main() {
|
||||
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();
|
||||
// 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(
|
||||
@ -331,7 +412,7 @@ void main() {
|
||||
return false;
|
||||
}), findsOneWidget);*/
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 5000));
|
||||
await tester.longWait();
|
||||
// 10. Export Certificate
|
||||
// await tester.tap(find.byKey(exportAction).hitTestable());
|
||||
// await tester.enterText(
|
||||
@ -355,11 +436,11 @@ void main() {
|
||||
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();
|
||||
// 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(
|
||||
@ -403,11 +484,11 @@ void main() {
|
||||
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();
|
||||
// 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(
|
||||
@ -456,11 +537,11 @@ void main() {
|
||||
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();
|
||||
// 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(
|
||||
@ -497,59 +578,59 @@ void main() {
|
||||
await tester.tap(find.byKey(deleteButton).hitTestable());
|
||||
await tester.longWait();
|
||||
});
|
||||
appTest('Import outdated Key+Certificate from file',
|
||||
(WidgetTester tester) async {});
|
||||
|
||||
/// TODO fileload needs to be handled
|
||||
appTest('Import neverexpire Key+Certificate from file',
|
||||
(WidgetTester tester) async {
|
||||
/// 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('Import outdated Key+Certificate from file',
|
||||
// (WidgetTester tester) async {});
|
||||
//
|
||||
// /// TODO fileload needs to be handled
|
||||
// appTest('Import neverexpire Key+Certificate from file',
|
||||
// (WidgetTester tester) async {
|
||||
// /// 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();
|
||||
// // });
|
||||
});
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ extension OathFunctions on WidgetTester {
|
||||
Finder findAccountList() {
|
||||
var accountList =
|
||||
find.byType(AccountList).hitTestable(at: Alignment.topCenter);
|
||||
expect(accountList, findsOneWidget);
|
||||
// expect(accountList, findsOneWidget);
|
||||
return accountList;
|
||||
}
|
||||
|
||||
@ -310,19 +310,23 @@ extension OathFunctions on WidgetTester {
|
||||
await switchToKey(targetKey);
|
||||
await shortWait();
|
||||
|
||||
/// 2. open the key menu
|
||||
await tapPopupMenu(targetKey);
|
||||
/// 2. open the home view
|
||||
await tap(find.byKey(homeDrawer).hitTestable());
|
||||
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 longWait();
|
||||
|
||||
/// 4. Click reset TextButton: done
|
||||
/// 5. Click reset TextButton: done
|
||||
await tap(find.byKey(factoryResetReset));
|
||||
await shortWait();
|
||||
await longWait();
|
||||
}
|
||||
|
||||
/// Opens the device menu and taps the "Set/Manage password" menu item
|
||||
|
@ -35,7 +35,7 @@ extension Fido2Functions on WidgetTester {
|
||||
await shortWait();
|
||||
}
|
||||
|
||||
/// Factory reset Fido2 application
|
||||
/// Factory reset FIDO application
|
||||
Future<void> resetFido2() async {
|
||||
final targetKey = approvedKeys[0]; // only reset approved keys!
|
||||
|
||||
@ -43,24 +43,55 @@ extension Fido2Functions on WidgetTester {
|
||||
await switchToKey(targetKey);
|
||||
await shortWait();
|
||||
|
||||
/// 2. open the key menu
|
||||
await tapPopupMenu(targetKey);
|
||||
/// 2. open the home view
|
||||
await tap(find.byKey(homeDrawer).hitTestable());
|
||||
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 longWait();
|
||||
|
||||
/// 4. Click reset TextButton: done
|
||||
/// 5. Click reset TextButton: done
|
||||
await tap(find.byKey(factoryResetReset));
|
||||
await fido2DanceWait();
|
||||
|
||||
/// 5. Click the 'Close' button
|
||||
/// 6. Click the close button
|
||||
await tap(find.text('Close').hitTestable());
|
||||
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
|
||||
// }
|
||||
}
|
||||
|
@ -22,30 +22,112 @@ import 'package:yubico_authenticator/piv/keys.dart';
|
||||
import 'test_util.dart';
|
||||
|
||||
extension PIVFunctions on WidgetTester {
|
||||
static const ett = 'firstpin';
|
||||
static const lock1 = 'lockpinn1';
|
||||
static const lock2 = 'lockpinn2';
|
||||
static const lock3 = 'lockpinn3';
|
||||
|
||||
/// Open the PIV Configuration
|
||||
Future<void> configurePiv() async {
|
||||
// 1. open PIV view
|
||||
var pivDrawerButton = find.byKey(pivAppDrawer).hitTestable();
|
||||
await tap(pivDrawerButton);
|
||||
await longWait();
|
||||
await tap(find.byKey(pivAppDrawer).hitTestable());
|
||||
await shortWait();
|
||||
await tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await shortWait();
|
||||
}
|
||||
|
||||
Future<void> pinView() async {
|
||||
await tap(find.byKey(pivAppDrawer).hitTestable());
|
||||
await shortWait();
|
||||
await tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await shortWait();
|
||||
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 tap(find.byKey(saveButton).hitTestable());
|
||||
await longWait();
|
||||
}
|
||||
|
||||
/// Locks PIN or PUK
|
||||
Future<void> lockPinPuk() async {
|
||||
for (var i = 0; i < 3; i += 1) {
|
||||
var wrongpin = '123456$i';
|
||||
await enterText(find.byKey(pinPukField).hitTestable(), wrongpin);
|
||||
await shortWait();
|
||||
await enterText(find.byKey(newPinPukField).hitTestable(), wrongpin);
|
||||
await shortWait();
|
||||
await enterText(find.byKey(confirmPinPukField).hitTestable(), wrongpin);
|
||||
await shortWait();
|
||||
await tap(find.byKey(saveButton).hitTestable());
|
||||
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 shortWait();
|
||||
}
|
||||
|
||||
/// Factory reset Piv application
|
||||
@ -56,19 +138,23 @@ extension PIVFunctions on WidgetTester {
|
||||
await switchToKey(targetKey);
|
||||
await shortWait();
|
||||
|
||||
/// 2. open the key menu
|
||||
await tapPopupMenu(targetKey);
|
||||
/// 2. open the home view
|
||||
await tap(find.byKey(homeDrawer).hitTestable());
|
||||
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 longWait();
|
||||
|
||||
/// 4. Click reset TextButton: done
|
||||
/// 5. Click reset TextButton: done
|
||||
await tap(find.byKey(factoryResetReset));
|
||||
await shortWait();
|
||||
await longWait();
|
||||
|
||||
// 5. Verify Resetedness
|
||||
// /// TODO: this expect algorithm is flaky
|
||||
|
@ -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/keys.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 'desktop/util.dart' as desktop_test_util;
|
||||
|
||||
const shortWaitMs = 200;
|
||||
const shortWaitMs = 240;
|
||||
const longWaitMs = 500;
|
||||
const ultraLongWaitMs = 3000;
|
||||
|
||||
@ -235,15 +234,32 @@ extension AppWidgetTester on WidgetTester {
|
||||
}
|
||||
|
||||
/// Management screen
|
||||
Future<void> openManagementScreen() async {
|
||||
if (!isDrawerOpened()) {
|
||||
await openDrawer();
|
||||
}
|
||||
Future<void> openHomeAndToggleScreen() async {
|
||||
// if (!isDrawerOpened()) {
|
||||
// await openDrawer();
|
||||
// }
|
||||
|
||||
await tap(find.byKey(managementAppDrawer).hitTestable());
|
||||
await pump(const Duration(milliseconds: 500));
|
||||
await tap(find.byKey(homeDrawer).hitTestable());
|
||||
await shortWait();
|
||||
|
||||
expect(find.byKey(screenKey), findsOneWidget);
|
||||
await openToggleScreen();
|
||||
|
||||
//expect(find.byKey(screenKey), findsOneWidget);
|
||||
}
|
||||
|
||||
/// Toggle Application screen
|
||||
Future<void> openToggleScreen() async {
|
||||
// if (!isDrawerOpened()) {
|
||||
// await openDrawer();
|
||||
// }
|
||||
|
||||
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.
|
||||
|
@ -25,6 +25,7 @@ import '../../app/message.dart';
|
||||
import '../../app/models.dart';
|
||||
import '../../app/shortcuts.dart';
|
||||
import '../../app/views/action_list.dart';
|
||||
import '../../app/views/keys.dart';
|
||||
import '../../app/views/reset_dialog.dart';
|
||||
import '../../core/models.dart';
|
||||
import '../../core/state.dart';
|
||||
@ -57,6 +58,7 @@ Widget homeBuildActions(
|
||||
title: deviceData.info.version.major > 4
|
||||
? l10n.s_toggle_applications
|
||||
: l10n.s_toggle_interfaces,
|
||||
key: yubikeyApplicationToggleMenuButton,
|
||||
subtitle: interfacesLocked
|
||||
? l10n.l_factory_reset_required
|
||||
: (deviceData.info.version.major > 4
|
||||
@ -82,6 +84,7 @@ Widget homeBuildActions(
|
||||
ActionListItem(
|
||||
icon: const Icon(Symbols.delete_forever),
|
||||
title: l10n.s_factory_reset,
|
||||
key: yubikeyFactoryResetMenuButton,
|
||||
subtitle: l10n.l_factory_reset_desc,
|
||||
actionStyle: ActionStyle.primary,
|
||||
onTap: (context) {
|
||||
@ -97,6 +100,7 @@ Widget homeBuildActions(
|
||||
ActionListSection(l10n.s_application, children: [
|
||||
ActionListItem(
|
||||
icon: const Icon(Symbols.settings),
|
||||
key: settingDrawerIcon,
|
||||
title: l10n.s_settings,
|
||||
subtitle: l10n.l_settings_desc,
|
||||
actionStyle: ActionStyle.primary,
|
||||
@ -107,6 +111,7 @@ Widget homeBuildActions(
|
||||
),
|
||||
ActionListItem(
|
||||
icon: const Icon(Symbols.help),
|
||||
key: helpDrawerIcon,
|
||||
title: l10n.s_help_and_about,
|
||||
subtitle: l10n.l_help_and_about_desc,
|
||||
actionStyle: ActionStyle.primary,
|
||||
|
@ -40,6 +40,7 @@ const unlockButton = Key('$_prefix.unlock');
|
||||
const resetButton = Key('$_prefix.reset');
|
||||
|
||||
const managementKeyField = Key('$_prefix.management_key');
|
||||
const newManagementKeyField = Key('$_prefix.management_key');
|
||||
const managementKeyRefresh = Key('$_prefix.management_key_refresh');
|
||||
|
||||
const pinPukField = Key('$_prefix.pin_puk');
|
||||
|
@ -292,7 +292,7 @@ class _ManageKeyDialogState extends ConsumerState<ManageKeyDialog> {
|
||||
},
|
||||
).init(),
|
||||
AppTextField(
|
||||
key: keys.newPinPukField,
|
||||
key: keys.newManagementKeyField,
|
||||
autofocus: _defaultKeyUsed,
|
||||
autofillHints: const [AutofillHints.newPassword],
|
||||
maxLength: hexLength,
|
||||
|
Loading…
Reference in New Issue
Block a user