yubioath-flutter/integration_test/passkey_test.dart

99 lines
3.4 KiB
Dart
Raw Normal View History

/*
* Copyright (C) 2023 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2024-02-12 10:32:47 +03:00
@Tags(['desktop', 'passkey'])
2024-07-03 13:44:20 +03:00
library;
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:yubico_authenticator/fido/keys.dart';
import 'utils/passkey_test_util.dart';
import 'utils/test_util.dart';
void main() {
var binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
2024-02-12 10:35:19 +03:00
group('Passkey PIN tests', () {
const simplePin = '1111';
2024-02-12 09:30:50 +03:00
const fidoPin1 = '947344';
const fidoPin2 = '478178';
/// Sadly these tests are built on each other to save reset-dance
2024-02-12 09:30:50 +03:00
appTest('Reset Fido2 1/2', (WidgetTester tester) async {
await tester.resetFido2();
});
2024-02-12 09:30:50 +03:00
group('Set/change pin', () {
appTest('Set simplePin', (WidgetTester tester) async {
2024-02-12 09:30:50 +03:00
// OBS: This will not work if there is pin complexity requirements
await tester.configurePasskey();
await tester.tap(find.byKey(managePinAction).hitTestable());
await tester.shortWait();
await tester.enterText(find.byKey(newPin), simplePin);
2024-09-10 12:27:34 +03:00
await tester.longWait();
await tester.enterText(find.byKey(confirmPin), simplePin);
2024-09-10 12:27:34 +03:00
await tester.longWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait();
2024-02-12 09:30:50 +03:00
/// TODO: deal with error messages from fips keys
/// TODO: make sure that the outcome of this test is a set state, right now it differs between FIPS and non-FIPS keys.
});
appTest('Change to fidoPin1', (WidgetTester tester) async {
await tester.configurePasskey();
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(confirmPin), fidoPin1);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait();
});
appTest('Change to fidoPin2', (WidgetTester tester) async {
await tester.configurePasskey();
await tester.tap(find.byKey(managePinAction));
await tester.shortWait();
await tester.enterText(find.byKey(currentPin), fidoPin1);
await tester.shortWait();
await tester.enterText(find.byKey(newPin), fidoPin2);
await tester.shortWait();
await tester.enterText(find.byKey(confirmPin), fidoPin2);
await tester.shortWait();
await tester.tap(find.byKey(saveButton).hitTestable());
await tester.shortWait();
});
});
2024-02-12 09:30:50 +03:00
appTest('Reset Fido2 2/2', (WidgetTester tester) async {
await tester.resetFido2();
});
});
}