widget_test.dart 990 B

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