Skip to content

Instantly share code, notes, and snippets.

@albertusdev
Created February 27, 2019 16:50
Show Gist options
  • Save albertusdev/bd010d693338b2bfa7434eac3bbfbe63 to your computer and use it in GitHub Desktop.
Save albertusdev/bd010d693338b2bfa7434eac3bbfbe63 to your computer and use it in GitHub Desktop.
testWidgets('Bottom sheet should appear and show correct icon',
(WidgetTester tester) async {
BuildContext savedContext;
await tester
.pumpWidget(MaterialApp(home: Builder(builder: (BuildContext context) {
savedContext = context;
return Container();
})));
await tester.pump();
expect(find.byIcon(Icons.add_photo_alternate), findsNothing);
expect(find.byIcon(Icons.add_a_photo), findsNothing);
ImagePickerBottomSheet.showImagePickerBottomSheet(savedContext);
await tester.pump(); // Bottom sheet show animation starts
await tester.pump(const Duration(seconds: 2)); // animation done
expect(find.byIcon(Icons.add_photo_alternate), findsOneWidget);
expect(find.byIcon(Icons.add_a_photo), findsOneWidget);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment