Skip to content

Instantly share code, notes, and snippets.

@LH-CDT

LH-CDT/widget_test.dart

Last active Jun 8, 2018
Embed
What would you like to do?
Flutter demo app
import 'package:flutter_test/flutter_test.dart';
import 'package:demo/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());
// Verify that our counter starts at 0.
expect(find.text('Button tapped 0 times.'), findsOneWidget);
expect(find.text('Button tapped 1 times.'), findsNothing);
// Tap the button and trigger a frame.
await tester.tap(find.text("Tap me"));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('Button tapped 0 times.'), findsNothing);
expect(find.text('Button tapped 1 times.'), findsOneWidget);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.