Ei kuvausta

widget_test.dart 1.0KB

123456789101112131415161718192021222324252627282930
  1. // This is a basic Flutter widget test.
  2. // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
  3. // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
  4. // find child widgets in the widget tree, read text, and verify that the values of widget properties
  5. // are correct.
  6. import 'package:flutter/material.dart';
  7. import 'package:flutter_test/flutter_test.dart';
  8. import '../lib/main.dart';
  9. void main() {
  10. testWidgets('Counter increments smoke test', (WidgetTester tester) async {
  11. // Build our app and trigger a frame.
  12. await tester.pumpWidget(new MyApp());
  13. // Verify that our counter starts at 0.
  14. expect(find.text('0'), findsOneWidget);
  15. expect(find.text('1'), findsNothing);
  16. // Tap the '+' icon and trigger a frame.
  17. await tester.tap(find.byIcon(Icons.add));
  18. await tester.pump();
  19. // Verify that our counter has incremented.
  20. expect(find.text('0'), findsNothing);
  21. expect(find.text('1'), findsOneWidget);
  22. });
  23. }