51 lines
1.8 KiB
Dart
51 lines
1.8 KiB
Dart
// This is a basic Flutter widget test.
|
|
//
|
|
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
// utility in the flutter_test package. For example, you can send tap and scroll
|
|
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
// tree, read text, and verify that the values of widget properties are correct.
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:kochkomplize/main.dart';
|
|
import 'package:kochkomplize/menu.dart';
|
|
|
|
Widget buildMenu() {
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
body: Menu(onMenuItemSelected: (menuItem) {}),
|
|
),
|
|
);
|
|
}
|
|
|
|
void main() {
|
|
testWidgets('Check menu text', (WidgetTester tester) async {
|
|
await tester.pumpWidget(buildMenu());
|
|
expect(find.text('Meine Rezepte'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('Check number of list items', (WidgetTester tester) async {
|
|
await tester.pumpWidget(const MyApp());
|
|
expect(find.byType(GestureDetector), findsNWidgets(3));
|
|
});
|
|
|
|
// testWidgets('Check display of recipe titles', (WidgetTester tester) async {
|
|
// await tester.pumpWidget(const MyApp());
|
|
// expect(find.text('Rezept 1'), findsOneWidget);
|
|
// expect(find.text('Rezept 2'), findsOneWidget);
|
|
// });
|
|
//
|
|
// testWidgets('Check display of recipe images', (WidgetTester tester) async {
|
|
// await tester.pumpWidget(const MyApp());
|
|
// expect(find.byType(Image), findsNWidgets(2));
|
|
// });
|
|
//
|
|
// testWidgets('Check navigation to recipe detail page', (WidgetTester tester) async {
|
|
// await tester.pumpWidget(const MyApp());
|
|
// await tester.tap(find.text('Rezept 1'));
|
|
// await tester.pumpAndSettle(); // Warte darauf, dass die Navigation abgeschlossen ist
|
|
// expect(find.text('Details für Rezept 1'), findsOneWidget);
|
|
// });
|
|
}
|