Fix broken tests.

This commit is contained in:
Elias Bonnici 2023-12-15 14:34:10 +01:00
parent d8debd239a
commit 0d3c7ef4a0
No known key found for this signature in database
GPG Key ID: 5EAC28EA3F980CCF
2 changed files with 12 additions and 1 deletions

View File

@ -158,7 +158,7 @@ void main() {
const shortmanagementkey =
'aaaabbbbccccaaaabbbbccccaaaabbbbccccaaaabbbbccc';
appTest('Bad managementkey key', (WidgetTester tester) async {
appTest('Out of bounds managementkey key', (WidgetTester tester) async {
await tester.configurePiv();
await tester.shortWait();
await tester.tap(find.byKey(manageManagementKeyAction).hitTestable());
@ -169,12 +169,22 @@ void main() {
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();

View File

@ -265,6 +265,7 @@ class _ManageKeyDialogState extends ConsumerState<ManageKeyDialog> {
enabled: currentLenOk,
prefixIcon: const Icon(Icons.key_outlined),
suffixIcon: IconButton(
key: keys.managementKeyRefresh,
icon: const Icon(Icons.refresh),
tooltip: l10n.s_generate_random,
onPressed: currentLenOk