Skip to content

Instantly share code, notes, and snippets.

@albertusdev
Created March 20, 2019 15:40
Show Gist options
  • Save albertusdev/a705cdc0b74f8c5bcfde07ac2af7716d to your computer and use it in GitHub Desktop.
Save albertusdev/a705cdc0b74f8c5bcfde07ac2af7716d to your computer and use it in GitHub Desktop.
Future<void> chooseImageFromImagePicker(WidgetTester tester, {bool shouldConfirm = true}) async {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
log.add(methodCall);
return './assets/images/pattern-bg.png';
});
await tester.tap(find.byKey(const Key('addPhotoLabel')));
await tester.pump();
await tester.pumpAndSettle();
expect(
find.byKey(const Key('chooseImageFromCameraListTile')), findsOneWidget);
await tester.tap(find.byKey(const Key('chooseImageFromCameraListTile')));
await tester.pump();
await tester.tap(find.byKey(shouldConfirm ? confirmImageButtonKey : rejectImageButtonKey));
await tester.pumpAndSettle();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment