test: widget test per il layer di presentazione

Prima era esercitato solo dall'integration test su emulatore:

- converter_page: ricerca, stati vuoti, selezione, calcolo, swap, reset
- shopping_list_page: aggiunta, contatore, sezione completati, dialog svuota
- meal_planner_page: 7 card, giorno espanso, genera lista, dialog svuota,
  stato del pulsante Condividi
- qr_share_sheet: QR per piano valido, errore oltre il limite, chiusura
- app (BitePlanApp): navigazione fra i tab, bottom sheet informazioni
- guide_page e info_bottom_sheet: contenuti e navigazione alla guida
- empty_state: icona, titolo, sottotitolo opzionale
- coverage_helper: importa tutta lib/ così lcov include anche i file
  non toccati da alcun test

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 20:08:49 +02:00
parent 9384bd6117
commit d94bd5fdf7
9 changed files with 623 additions and 0 deletions
@@ -0,0 +1,36 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:biteplan/features/guide/presentation/pages/guide_page.dart';
import '../../../helpers/pump_app.dart';
void main() {
group('GuidePage', () {
testWidgets('mostra titolo e le tre tab', (tester) async {
await tester.pumpApp(const GuidePage());
expect(find.text('Guida'), findsOneWidget);
expect(find.text('Pasti'), findsOneWidget);
expect(find.text('Converti'), findsOneWidget);
expect(find.text('Spesa'), findsOneWidget);
});
testWidgets('la tab iniziale è Pasti', (tester) async {
await tester.pumpApp(const GuidePage());
expect(find.text('Aggiungere un alimento'), findsOneWidget);
});
testWidgets('la tab Converti mostra i suoi contenuti', (tester) async {
await tester.pumpApp(const GuidePage());
await tester.tap(find.text('Converti'));
await tester.pumpAndSettle();
expect(find.text('Come usarlo'), findsOneWidget);
expect(find.text('Alimenti disponibili'), findsOneWidget);
});
testWidgets('la tab Spesa mostra i suoi contenuti', (tester) async {
await tester.pumpApp(const GuidePage());
await tester.tap(find.text('Spesa'));
await tester.pumpAndSettle();
expect(find.text('Aggiungere un elemento'), findsOneWidget);
expect(find.text('Spuntare un elemento'), findsOneWidget);
});
});
}