mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 16:32:01 +03:00
Everything almost works, to fix:
-pin entry when locking key is damn hard!
This commit is contained in:
parent
813904e878
commit
461d0de317
@ -31,41 +31,45 @@ void main() {
|
||||
const simplePin = '1111';
|
||||
const fidoPin1 = '9473';
|
||||
const fidoPin2 = '4781';
|
||||
appTest('Reset Key', (WidgetTester tester) async {
|
||||
// await tester.configurePasskey();
|
||||
|
||||
/// Sadly these tests are built on each other to save reset-dance
|
||||
|
||||
appTest('Reset Fido2 1/3', (WidgetTester tester) async {
|
||||
await tester.resetFido2();
|
||||
});
|
||||
appTest('Set SimplePin', (WidgetTester tester) async {
|
||||
group('Set/change pin and pin complexity', (){
|
||||
appTest('Set simplePin', (WidgetTester tester) async {
|
||||
/// OBS: This will not work if there is pin complexity requirements
|
||||
await tester.configurePasskey();
|
||||
|
||||
await tester.tap(find.byKey(managePinAction));
|
||||
await tester.tap(find.byKey(managePinAction).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.enterText(find.byKey(newPin), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(newPin), simplePin);
|
||||
await tester.enterText(find.byKey(confirmPin), simplePin);
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.tap(find.byKey(saveButton));
|
||||
await tester.tap(find.byKey(saveButton).hitTestable());
|
||||
await tester.shortWait();
|
||||
});
|
||||
appTest('Change to FidoPin1', (WidgetTester tester) async {
|
||||
appTest('Change to fidoPin1', (WidgetTester tester) async {
|
||||
await tester.configurePasskey();
|
||||
|
||||
await tester.tap(find.byKey(managePinAction));
|
||||
await tester.tap(find.byKey(managePinAction).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.enterText(find.byKey(currentPin), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(newPin), fidoPin1);
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(newPin), fidoPin1);
|
||||
await tester.enterText(find.byKey(confirmPin), fidoPin1);
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.tap(find.byKey(saveButton));
|
||||
await tester.tap(find.byKey(saveButton).hitTestable());
|
||||
await tester.shortWait();
|
||||
});
|
||||
appTest('Change to FidoPin2', (WidgetTester tester) async {
|
||||
appTest('Change to fidoPin2', (WidgetTester tester) async {
|
||||
await tester.configurePasskey();
|
||||
|
||||
await tester.tap(find.byKey(managePinAction));
|
||||
@ -75,14 +79,88 @@ void main() {
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(newPin), fidoPin2);
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(newPin), fidoPin2);
|
||||
await tester.enterText(find.byKey(confirmPin), fidoPin2);
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.tap(find.byKey(saveButton));
|
||||
await tester.tap(find.byKey(saveButton).hitTestable());
|
||||
await tester.shortWait();
|
||||
});
|
||||
appTest('Reset Key', (WidgetTester tester) async {
|
||||
});
|
||||
appTest('Reset Fido2 2/3', (WidgetTester tester) async {
|
||||
await tester.resetFido2();
|
||||
});
|
||||
group('Pin use, pin lock', () {
|
||||
appTest('Set fidoPin1', (WidgetTester tester) async {
|
||||
await tester.configurePasskey();
|
||||
|
||||
await tester.tap(find.byKey(managePinAction).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.enterText(find.byKey(newPin), fidoPin1);
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(confirmPin), fidoPin1);
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.tap(find.byKey(saveButton).hitTestable());
|
||||
await tester.shortWait();
|
||||
});
|
||||
appTest('Wrong pin 1/3', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(fidoPasskeysAppDrawer).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(unlockFido2WithPin).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(unlockFido2WithPin).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(unlockFido2WithPin).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
||||
/// TODO verify that l_pin_soft_locked is seen.
|
||||
});
|
||||
appTest('Wrong pin 2/3', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(fidoPasskeysAppDrawer).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(unlockFido2WithPin).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(unlockFido2WithPin).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(unlockFido2WithPin).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
||||
/// TODO verify that l_pin_soft_locked is seen.
|
||||
});
|
||||
appTest('Wrong pin 3/3', (WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(fidoPasskeysAppDrawer).hitTestable());
|
||||
await tester.shortWait();
|
||||
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(unlockFido2WithPin).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
await tester.tap(find.byKey(unlockFido2WithPin).hitTestable());
|
||||
await tester.shortWait();
|
||||
await tester.enterText(find.byKey(pinEntry), simplePin);
|
||||
await tester.shortWait();
|
||||
|
||||
/// TODO verify that l_pin_blocked_reset_locked is seen.
|
||||
});
|
||||
});
|
||||
appTest('Reset Fido2 3/3', (WidgetTester tester) async {
|
||||
await tester.resetFido2();
|
||||
});
|
||||
});
|
||||
|
@ -30,8 +30,7 @@ extension Fido2Functions on WidgetTester {
|
||||
/// Open the PIV Configuration
|
||||
Future<void> configurePasskey() async {
|
||||
// 1. open PIV view
|
||||
var pivDrawerButton = find.byKey(fidoPasskeysAppDrawer).hitTestable();
|
||||
await tap(pivDrawerButton);
|
||||
await tap(find.byKey(fidoPasskeysAppDrawer).hitTestable());
|
||||
await shortWait();
|
||||
await tap(find.byKey(actionsIconButtonKey).hitTestable());
|
||||
await shortWait();
|
||||
@ -59,7 +58,11 @@ extension Fido2Functions on WidgetTester {
|
||||
await tap(find.byKey(factoryResetReset));
|
||||
await fido2DanceWait();
|
||||
|
||||
/// TODO 5. Verify Resetedness
|
||||
/// 5. Click the 'Close' button
|
||||
await tap(find.text('Close').hitTestable());
|
||||
await shortWait();
|
||||
|
||||
/// TODO 6. Verify Resetedness
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,11 @@ const newPin = Key('$_keyAction.new_pin');
|
||||
const confirmPin = Key('$_keyAction.confirm_pin');
|
||||
const currentPin = Key('$_keyAction.current_pin');
|
||||
|
||||
// pin entry
|
||||
const pinEntry = Key('$_keyAction.pin_entry');
|
||||
const unlockFido2WithPin = Key('$_keyAction.unlock_fido2_with_pin');
|
||||
|
||||
|
||||
// Credential actions
|
||||
const editCredentialAction = Key('$_credentialAction.edit');
|
||||
const deleteCredentialAction = Key('$_credentialAction.delete');
|
||||
|
@ -69,6 +69,7 @@ class _FidoPinDialogState extends ConsumerState<FidoPinDialog> {
|
||||
TextButton(
|
||||
onPressed: isValid ? _submit : null,
|
||||
child: Text(l10n.s_save),
|
||||
key: saveButton,
|
||||
),
|
||||
],
|
||||
child: Padding(
|
||||
|
@ -21,6 +21,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../app/models.dart';
|
||||
import '../../widgets/app_input_decoration.dart';
|
||||
import '../../widgets/app_text_field.dart';
|
||||
import '../keys.dart';
|
||||
import '../models.dart';
|
||||
import '../state.dart';
|
||||
|
||||
@ -85,6 +86,7 @@ class _PinEntryFormState extends ConsumerState<PinEntryForm> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0, bottom: 4.0),
|
||||
child: AppTextField(
|
||||
key: pinEntry,
|
||||
autofocus: true,
|
||||
obscureText: _isObscure,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
|
Loading…
Reference in New Issue
Block a user