todo-app/test/settings_screen_e2e_lock_test.dart
Krzysztof kuhy Rudnicki 4423937f5c E2E: key cache, CLI password, lock tile
Argon2id runs once per device (keystore key cache); the CLI/MCP read
~/.config/crdt-sync/password; pull-only merges old and encrypted
prefixes; the settings lock tile follows the last sync and resyncs on
save. Pins crdt_sync 0.14.0, crdt_sync_flutter 0.8.0, sync_settings_ui
0.7.2.

Todo: fda71ed1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 09:52:15 +01:00

36 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:todo/sync/run_sync.dart';
import 'capture_screen_harness.dart' show recordingMock;
import 'settings_screen_harness.dart';
void main() {
tearDown(() => e2eLocked.value = false);
testWidgets('the lock tile follows the last sync', (tester) async {
e2eLocked.value = true;
await pumpSettings(tester);
expect(find.byIcon(Icons.lock), findsOneWidget);
e2eLocked.value = false;
await tester.pump();
expect(find.byIcon(Icons.lock_open), findsOneWidget);
});
testWidgets('saving a passphrase retries the sync, which unlocks', (
tester,
) async {
e2eLocked.value = true;
await pumpSettings(tester, httpClient: recordingMock(<String>[]));
await tester.tap(find.byIcon(Icons.lock));
await tester.pumpAndSettle();
await tester.enterText(find.byType(TextField).last, 'test-passphrase');
await tester.tap(find.byIcon(Icons.check));
await tester.runAsync(
() => Future<void>.delayed(const Duration(seconds: 1)),
);
await tester.pump();
expect(e2eLocked.value, isFalse);
});
}