Files
pfm-ocr/test/login_screen_test.dart
T
Rafhan Mazaya FathurrahmanandClaude Sonnet 5 ada6488592 feat(app): scan-mode sync, confirmation-gated documents, single-pass product classification
Fixes reported from APK field testing: DO/Product scan mode was inconsistent
between the camera drawer and documents screen (now one shared provider,
with an orange/green color cue); unconfirmed scans leaked into history with
placeholder data before the user tapped confirm (backend now gates
GET /documents on a new `confirmed` column, flipped only by PUT); and
Product Scan ran the GPU classifier twice, once at upload and again on
review (now a single pass at upload, persisted and read directly by the
editor). Also removes the unused "Hubungkan ke PO" field and fabricated
PO/SO/DO placeholder values from the Product Scan flow, closes out the
per-document-polling and save-recovery tasks (6.1/6.3), and splits several
touched files to stay under the repo's 256-line guideline.

Full detail in docs/iteration-log.md and backend/docs/iteration-log.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 15:19:32 +07:00

44 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:app_pfm_ocr_v2/features/auth/login_screen.dart';
void main() {
testWidgets('LoginScreen validation tests', (WidgetTester tester) async {
await tester.pumpWidget(
const ProviderScope(
child: MaterialApp(
home: LoginScreen(),
),
),
);
// Find the login button
final loginButtonFinder = find.byType(ElevatedButton);
expect(loginButtonFinder, findsOneWidget);
// Tap login button with empty inputs
await tester.tap(loginButtonFinder);
await tester.pumpAndSettle();
// Verify inline validation error text is displayed
expect(find.text('Username/ID tidak boleh kosong'), findsOneWidget);
expect(find.text('Kata sandi tidak boleh kosong'), findsOneWidget);
// Enter a username, and a short password (e.g. 5 chars)
final textFormFields = find.byType(TextFormField);
expect(textFormFields, findsNWidgets(2));
await tester.enterText(textFormFields.first, 'admin');
await tester.enterText(textFormFields.last, '12345');
// Tap the login button again
await tester.tap(loginButtonFinder);
await tester.pumpAndSettle();
// Verify username warning is gone, but password length warning appears
expect(find.text('Username/ID tidak boleh kosong'), findsNothing);
expect(find.text('Kata sandi minimal 6 karakter'), findsOneWidget);
});
}