Ordner Struktur

main
Kai Mannweiler 2023-03-06 19:12:31 +01:00
parent 999aa8fc42
commit fb287fdb23
6 changed files with 6 additions and 35 deletions

View File

@ -1,30 +0,0 @@
// 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:smoke_cess_app/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}

View File

@ -5,7 +5,8 @@ import 'package:smoke_cess_app/providers/input_provider.dart';
import 'package:smoke_cess_app/widgets/drop_down.dart'; import 'package:smoke_cess_app/widgets/drop_down.dart';
void main() { void main() {
testWidgets('DropDown should display items and update input model', (WidgetTester tester) async { testWidgets('DropDown should display items and update input model',
(WidgetTester tester) async {
// Define the list of items // Define the list of items
final items = ['Item 1', 'Item 2', 'Item 3']; final items = ['Item 1', 'Item 2', 'Item 3'];
@ -28,16 +29,16 @@ void main() {
expect(find.text(items[0]), findsOneWidget); expect(find.text(items[0]), findsOneWidget);
// Tap the DropDown to open the menu // Tap the DropDown to open the menu
await tester.tap(find.byType(DropdownButtonFormField)); await tester.tap(find.byType(DropDown));
await tester.pump(); await tester.pump();
// Verify that the menu displays the correct items // Verify that the menu displays the correct items
for (final item in items) { for (final item in items) {
expect(find.text(item), findsOneWidget); expect(find.text(item).first, findsOneWidget);
} }
// Select the second item // Select the second item
await tester.tap(find.text(items[1])); await tester.tap(find.text(items[1]).last);
await tester.pump(); await tester.pump();
// Verify that the input model was updated with the selected item // Verify that the input model was updated with the selected item

View File

@ -48,7 +48,7 @@ void main() {
final titleWidget = tester.widget<Text>(titleFinder); final titleWidget = tester.widget<Text>(titleFinder);
// Assert // Assert
expect(titleWidget.style?.fontSize, equals(20.0)); expect(titleWidget.style?.fontSize, equals(16.0));
expect(titleWidget.style?.fontWeight, equals(FontWeight.bold)); expect(titleWidget.style?.fontWeight, equals(FontWeight.bold));
}); });