Skip to content

Commit

Permalink
chore: Adding integration testing chrome driver. #1
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Sep 4, 2023
1 parent bdc7181 commit dc862fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 51 deletions.
52 changes: 1 addition & 51 deletions integration_test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,7 @@ import 'widget_test.mocks.dart';

@GenerateMocks([PlatformService])
void main() {
testWidgets('Normal setup', (WidgetTester tester) async {
final platformServiceMock = MockPlatformService();
// Platform is mobile
when(platformServiceMock.isWebPlatform()).thenAnswer((_) => false);

// Build our app and trigger a frame.
await tester.pumpWidget(
App(
platformService: platformServiceMock,
),
);
await tester.pumpAndSettle();

// Expect to find the normal page setup
expect(find.text('Flutter Quill'), findsOneWidget);

// Enter 'hi' into Quill Editor.
await tester.tap(find.byType(QuillEditor));
await tester.quillEnterText(find.byType(QuillEditor), 'hi\n');
await tester.pumpAndSettle();
});

testWidgets('Select image', (WidgetTester tester) async {
final platformServiceMock = MockPlatformService();

// Platform is mobile
when(platformServiceMock.isWebPlatform()).thenAnswer((_) => false);

// Build our app and trigger a frame.
await tester.pumpWidget(
App(
platformService: platformServiceMock,
),
);
await tester.pumpAndSettle();

// Expect to find the normal page setup
expect(find.text('Flutter Quill'), findsOneWidget);

// Enter 'hi' into Quill Editor.
await tester.tap(find.byType(QuillEditor));
await tester.quillEnterText(find.byType(QuillEditor), 'hi\n');
await tester.pumpAndSettle();

final imageButton = find.byType(ImageButton);
await tester.tap(imageButton);
await tester.pumpAndSettle();

//TODO add image picker
//https://github.com/dwyl/flutter-image-upload-demo/blob/main/test/widget_test.dart
});
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

testWidgets('Normal setup (web version)', (WidgetTester tester) async {
tester.view.physicalSize = const Size(400, 600);
Expand Down
5 changes: 5 additions & 0 deletions test_driver/integration_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// Check this link for context: https://docs.flutter.dev/testing/integration-tests#running-in-a-browser
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();

0 comments on commit dc862fc

Please sign in to comment.