57f522e3a2
- update_service_test: il fake HttpClientResponse tipizza lo stream come Stream<List<int>> (utf8.encode ritorna Uint8List) - guide/info_bottom_sheet test: i titoli delle _DocCard sono resi con toUpperCase(), i finder ora cercano il testo maiuscolo - converter_page_test e app_test: loadDb()/load() dei provider spostati nel setUp — chiamarli nel body di testWidgets (zona FakeAsync) bloccava la suite fino al timeout di 10 minuti Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
42 lines
1.3 KiB
Dart
42 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:biteplan/core/constants/app_constants.dart';
|
|
import 'package:biteplan/features/guide/presentation/widgets/info_bottom_sheet.dart';
|
|
import '../../../helpers/pump_app.dart';
|
|
|
|
Future<void> _openSheet(WidgetTester tester) async {
|
|
await tester.pumpApp(Scaffold(
|
|
body: Builder(
|
|
builder: (context) => Center(
|
|
child: FilledButton(
|
|
onPressed: () => showInfoBottomSheet(context),
|
|
child: const Text('apri'),
|
|
),
|
|
),
|
|
),
|
|
));
|
|
await tester.tap(find.text('apri'));
|
|
await tester.pumpAndSettle();
|
|
}
|
|
|
|
void main() {
|
|
group('InfoBottomSheet', () {
|
|
testWidgets('mostra nome app, versione, autore e licenza',
|
|
(tester) async {
|
|
await _openSheet(tester);
|
|
expect(find.text('BitePlan'), findsOneWidget);
|
|
expect(find.text('Versione $kAppVersion'), findsOneWidget);
|
|
expect(find.text('Autore'), findsOneWidget);
|
|
expect(find.text('Licenza'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('"Apri" sulla riga Guida naviga alla GuidePage',
|
|
(tester) async {
|
|
await _openSheet(tester);
|
|
await tester.tap(find.text('Apri'));
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('AGGIUNGERE UN ALIMENTO'), findsOneWidget);
|
|
});
|
|
});
|
|
}
|