Created
February 27, 2019 16:41
-
-
Save albertusdev/500baba1d153ad8b30a89ab8e4bf1727 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:frontend/image_picker_bottom_sheet.dart' | |
as ImagePickerBottomSheet; | |
void main() { | |
testWidgets( | |
'Bottom sheet should appear and show choose from gallery or take a new picture text', | |
(WidgetTester tester) async { | |
BuildContext savedContext; | |
await tester | |
.pumpWidget(MaterialApp(home: Builder(builder: (BuildContext context) { | |
savedContext = context; | |
return Container(); | |
}))); | |
await tester.pump(); | |
expect( | |
find.text(ImagePickerBottomSheet.kTakeANewPictureText), findsNothing); | |
expect( | |
find.text(ImagePickerBottomSheet.kChooseFromGalleryText), findsNothing); | |
ImagePickerBottomSheet.showImagePickerBottomSheet(savedContext); | |
await tester.pump(); // Bottom sheet show animation starts | |
await tester.pump(const Duration(seconds: 2)); // animation done | |
expect(find.text(ImagePickerBottomSheet.kChooseFromGalleryText), | |
findsOneWidget); | |
expect( | |
find.text(ImagePickerBottomSheet.kTakeANewPictureText), findsOneWidget); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment