Migrate plugins to use e2e tests. (#2282)
diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md
index 6ea0469..0bf3943 100644
--- a/packages/google_maps_flutter/CHANGELOG.md
+++ b/packages/google_maps_flutter/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.5.21+12
+
+* Update driver tests in the example app to e2e tests.
+
## 0.5.21+11
* Define clang module for iOS, fix analyzer warnings.
diff --git a/packages/google_maps_flutter/android/build.gradle b/packages/google_maps_flutter/android/build.gradle
index f13de0b..9baaea8 100644
--- a/packages/google_maps_flutter/android/build.gradle
+++ b/packages/google_maps_flutter/android/build.gradle
@@ -36,3 +36,29 @@
implementation 'com.google.android.gms:play-services-maps:17.0.0'
}
}
+
+// TODO(cyanglaz): Remove this hack once androidx.lifecycle is included on stable. https://github.com/flutter/flutter/issues/42348
+afterEvaluate {
+ def containsEmbeddingDependencies = false
+ for (def configuration : configurations.all) {
+ for (def dependency : configuration.dependencies) {
+ if (dependency.group == 'io.flutter' &&
+ dependency.name.startsWith('flutter_embedding') &&
+ dependency.isTransitive())
+ {
+ containsEmbeddingDependencies = true
+ break
+ }
+ }
+ }
+ if (!containsEmbeddingDependencies) {
+ android {
+ dependencies {
+ def lifecycle_version = "1.1.1"
+ compileOnly "android.arch.lifecycle:runtime:$lifecycle_version"
+ compileOnly "android.arch.lifecycle:common:$lifecycle_version"
+ compileOnly "android.arch.lifecycle:common-java8:$lifecycle_version"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/packages/google_maps_flutter/example/pubspec.yaml b/packages/google_maps_flutter/example/pubspec.yaml
index 799d80e..7e533a8 100644
--- a/packages/google_maps_flutter/example/pubspec.yaml
+++ b/packages/google_maps_flutter/example/pubspec.yaml
@@ -15,6 +15,7 @@
flutter_driver:
sdk: flutter
test: ^1.6.0
+ e2e: ^0.2.1
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
diff --git a/packages/google_maps_flutter/example/test_driver/google_maps.dart b/packages/google_maps_flutter/example/test_driver/google_maps_e2e.dart
similarity index 86%
rename from packages/google_maps_flutter/example/test_driver/google_maps.dart
rename to packages/google_maps_flutter/example/test_driver/google_maps_e2e.dart
index 90d065f..53d0c90 100644
--- a/packages/google_maps_flutter/example/test_driver/google_maps.dart
+++ b/packages/google_maps_flutter/example/test_driver/google_maps_e2e.dart
@@ -7,29 +7,25 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
+import 'package:e2e/e2e.dart';
import 'google_map_inspector.dart';
-import 'test_widgets.dart';
const LatLng _kInitialMapCenter = LatLng(0, 0);
+const double _kInitialZoomLevel = 5;
const CameraPosition _kInitialCameraPosition =
- CameraPosition(target: _kInitialMapCenter);
+ CameraPosition(target: _kInitialMapCenter, zoom: _kInitialZoomLevel);
void main() {
- final Completer<String> allTestsCompleter = Completer<String>();
- enableFlutterDriverExtension(handler: (_) => allTestsCompleter.future);
+ E2EWidgetsFlutterBinding.ensureInitialized();
- tearDownAll(() => allTestsCompleter.complete(null));
-
- test('testCompassToggle', () async {
+ testWidgets('testCompassToggle', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
-
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -48,7 +44,7 @@
bool compassEnabled = await inspector.isCompassEnabled();
expect(compassEnabled, false);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -64,12 +60,12 @@
expect(compassEnabled, true);
});
- test('testMapToolbarToggle', () async {
+ testWidgets('testMapToolbarToggle', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -88,7 +84,7 @@
bool mapToolbarEnabled = await inspector.isMapToolbarEnabled();
expect(mapToolbarEnabled, false);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -104,7 +100,7 @@
expect(mapToolbarEnabled, Platform.isAndroid);
});
- test('updateMinMaxZoomLevels', () async {
+ testWidgets('updateMinMaxZoomLevels', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
@@ -112,7 +108,7 @@
const MinMaxZoomPreference initialZoomLevel = MinMaxZoomPreference(2, 4);
const MinMaxZoomPreference finalZoomLevel = MinMaxZoomPreference(3, 8);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -131,7 +127,7 @@
MinMaxZoomPreference zoomLevel = await inspector.getMinMaxZoomLevels();
expect(zoomLevel, equals(initialZoomLevel));
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -147,12 +143,12 @@
expect(zoomLevel, equals(finalZoomLevel));
});
- test('testZoomGesturesEnabled', () async {
+ testWidgets('testZoomGesturesEnabled', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -171,7 +167,7 @@
bool zoomGesturesEnabled = await inspector.isZoomGesturesEnabled();
expect(zoomGesturesEnabled, false);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -187,12 +183,12 @@
expect(zoomGesturesEnabled, true);
});
- test('testRotateGesturesEnabled', () async {
+ testWidgets('testRotateGesturesEnabled', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -211,7 +207,7 @@
bool rotateGesturesEnabled = await inspector.isRotateGesturesEnabled();
expect(rotateGesturesEnabled, false);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -227,12 +223,12 @@
expect(rotateGesturesEnabled, true);
});
- test('testTiltGesturesEnabled', () async {
+ testWidgets('testTiltGesturesEnabled', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -251,7 +247,7 @@
bool tiltGesturesEnabled = await inspector.isTiltGesturesEnabled();
expect(tiltGesturesEnabled, false);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -267,12 +263,12 @@
expect(tiltGesturesEnabled, true);
});
- test('testScrollGesturesEnabled', () async {
+ testWidgets('testScrollGesturesEnabled', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -291,7 +287,7 @@
bool scrollGesturesEnabled = await inspector.isScrollGesturesEnabled();
expect(scrollGesturesEnabled, false);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -307,7 +303,7 @@
expect(scrollGesturesEnabled, true);
});
- test('testGetVisibleRegion', () async {
+ testWidgets('testGetVisibleRegion', (WidgetTester tester) async {
final Key key = GlobalKey();
final LatLngBounds zeroLatLngBounds = LatLngBounds(
southwest: const LatLng(0, 0), northeast: const LatLng(0, 0));
@@ -315,7 +311,7 @@
final Completer<GoogleMapController> mapControllerCompleter =
Completer<GoogleMapController>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -325,16 +321,15 @@
},
),
));
- final GoogleMapController mapController =
- await mapControllerCompleter.future;
-
// We suspected a bug in the iOS Google Maps SDK caused the camera is not properly positioned at
// initialization. https://github.com/flutter/flutter/issues/24806
// This temporary workaround fix is provided while the actual fix in the Google Maps SDK is
// still being investigated.
// TODO(cyanglaz): Remove this temporary fix once the Maps SDK issue is resolved.
// https://github.com/flutter/flutter/issues/27550
- await Future<dynamic>.delayed(const Duration(seconds: 3));
+ await tester.pumpAndSettle(const Duration(seconds: 3));
+ final GoogleMapController mapController =
+ await mapControllerCompleter.future;
final LatLngBounds firstVisibleRegion =
await mapController.getVisibleRegion();
@@ -345,8 +340,12 @@
expect(firstVisibleRegion, isNot(zeroLatLngBounds));
expect(firstVisibleRegion.contains(_kInitialMapCenter), isTrue);
- const LatLng southWest = LatLng(60, 75);
- const LatLng northEast = LatLng(65, 80);
+ // Making a new `LatLngBounds` about (10, 10) distance south west to the `firstVisibleRegion`.
+ // The size of the `LatLngBounds` is 10 by 10.
+ final LatLng southWest = LatLng(firstVisibleRegion.southwest.latitude - 20,
+ firstVisibleRegion.southwest.longitude - 20);
+ final LatLng northEast = LatLng(firstVisibleRegion.southwest.latitude - 10,
+ firstVisibleRegion.southwest.longitude - 10);
final LatLng newCenter = LatLng(
(northEast.latitude + southWest.latitude) / 2,
(northEast.longitude + southWest.longitude) / 2,
@@ -363,6 +362,7 @@
final double padding = 0;
await mapController
.moveCamera(CameraUpdate.newLatLngBounds(latLngBounds, padding));
+ await tester.pumpAndSettle(const Duration(seconds: 3));
final LatLngBounds secondVisibleRegion =
await mapController.getVisibleRegion();
@@ -376,12 +376,12 @@
expect(secondVisibleRegion.contains(newCenter), isTrue);
});
- test('testTraffic', () async {
+ testWidgets('testTraffic', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -401,12 +401,12 @@
expect(isTrafficEnabled, true);
});
- test('testMyLocationButtonToggle', () async {
+ testWidgets('testMyLocationButtonToggle', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -426,7 +426,7 @@
bool myLocationButtonEnabled = await inspector.isMyLocationButtonEnabled();
expect(myLocationButtonEnabled, true);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -443,12 +443,13 @@
expect(myLocationButtonEnabled, false);
});
- test('testMyLocationButton initial value false', () async {
+ testWidgets('testMyLocationButton initial value false',
+ (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -470,12 +471,13 @@
expect(myLocationButtonEnabled, false);
});
- test('testMyLocationButton initial value true', () async {
+ testWidgets('testMyLocationButton initial value true',
+ (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapInspector> inspectorCompleter =
Completer<GoogleMapInspector>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -497,12 +499,12 @@
expect(myLocationButtonEnabled, true);
});
- test('testSetMapStyle valid Json String', () async {
+ testWidgets('testSetMapStyle valid Json String', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapController> controllerCompleter =
Completer<GoogleMapController>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -519,12 +521,13 @@
await controller.setMapStyle(mapStyle);
});
- test('testSetMapStyle invalid Json String', () async {
+ testWidgets('testSetMapStyle invalid Json String',
+ (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapController> controllerCompleter =
Completer<GoogleMapController>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -546,12 +549,12 @@
}
});
- test('testSetMapStyle null string', () async {
+ testWidgets('testSetMapStyle null string', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapController> controllerCompleter =
Completer<GoogleMapController>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -566,12 +569,12 @@
await controller.setMapStyle(null);
});
- test('testGetLatLng', () async {
+ testWidgets('testGetLatLng', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapController> controllerCompleter =
Completer<GoogleMapController>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -590,7 +593,7 @@
// still being investigated.
// TODO(cyanglaz): Remove this temporary fix once the Maps SDK issue is resolved.
// https://github.com/flutter/flutter/issues/27550
- await Future<dynamic>.delayed(const Duration(seconds: 3));
+ await tester.pumpAndSettle(const Duration(seconds: 3));
final LatLngBounds visibleRegion = await controller.getVisibleRegion();
final LatLng topLeft =
@@ -603,12 +606,12 @@
expect(topLeft, northWest);
});
- test('testScreenCoordinate', () async {
+ testWidgets('testScreenCoordinate', (WidgetTester tester) async {
final Key key = GlobalKey();
final Completer<GoogleMapController> controllerCompleter =
Completer<GoogleMapController>();
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
key: key,
@@ -618,7 +621,6 @@
},
),
));
-
final GoogleMapController controller = await controllerCompleter.future;
// We suspected a bug in the iOS Google Maps SDK caused the camera is not properly positioned at
@@ -627,7 +629,7 @@
// still being investigated.
// TODO(cyanglaz): Remove this temporary fix once the Maps SDK issue is resolved.
// https://github.com/flutter/flutter/issues/27550
- await Future<dynamic>.delayed(const Duration(seconds: 3));
+ await tester.pumpAndSettle(const Duration(seconds: 3));
final LatLngBounds visibleRegion = await controller.getVisibleRegion();
final LatLng northWest = LatLng(
@@ -636,11 +638,10 @@
);
final ScreenCoordinate topLeft =
await controller.getScreenCoordinate(northWest);
-
expect(topLeft, const ScreenCoordinate(x: 0, y: 0));
});
- test('testResizeWidget', () async {
+ testWidgets('testResizeWidget', (WidgetTester tester) async {
final Completer<GoogleMapController> controllerCompleter =
Completer<GoogleMapController>();
final GoogleMap map = GoogleMap(
@@ -649,14 +650,14 @@
controllerCompleter.complete(controller);
},
);
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: MaterialApp(
home: Scaffold(
body: SizedBox(height: 100, width: 100, child: map)))));
final GoogleMapController controller = await controllerCompleter.future;
- await pumpWidget(Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: MaterialApp(
home: Scaffold(
@@ -668,7 +669,7 @@
// still being investigated.
// TODO(cyanglaz): Remove this temporary fix once the Maps SDK issue is resolved.
// https://github.com/flutter/flutter/issues/27550
- await Future<dynamic>.delayed(const Duration(seconds: 3));
+ await tester.pumpAndSettle(const Duration(seconds: 3));
// Simple call to make sure that the app hasn't crashed.
final LatLngBounds bounds1 = await controller.getVisibleRegion();
diff --git a/packages/google_maps_flutter/example/test_driver/google_maps_test.dart b/packages/google_maps_flutter/example/test_driver/google_maps_e2e_test.dart
similarity index 72%
rename from packages/google_maps_flutter/example/test_driver/google_maps_test.dart
rename to packages/google_maps_flutter/example/test_driver/google_maps_e2e_test.dart
index b0d3305..ff6e9ce 100644
--- a/packages/google_maps_flutter/example/test_driver/google_maps_test.dart
+++ b/packages/google_maps_flutter/example/test_driver/google_maps_e2e_test.dart
@@ -3,11 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-
+import 'dart:io';
import 'package:flutter_driver/flutter_driver.dart';
Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
- await driver.requestData(null, timeout: const Duration(minutes: 1));
+ final String result =
+ await driver.requestData(null, timeout: const Duration(minutes: 1));
driver.close();
+ exit(result == 'pass' ? 0 : 1);
}
diff --git a/packages/google_maps_flutter/example/test_driver/test_widgets.dart b/packages/google_maps_flutter/example/test_driver/test_widgets.dart
deleted file mode 100644
index 5656c9f..0000000
--- a/packages/google_maps_flutter/example/test_driver/test_widgets.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2019, the Chromium project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-
-import 'package:flutter/widgets.dart';
-
-Future<void> pumpWidget(Widget widget) {
- runApp(widget);
- return WidgetsBinding.instance.endOfFrame;
-}
diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml
index fc683bb..320e942 100644
--- a/packages/google_maps_flutter/pubspec.yaml
+++ b/packages/google_maps_flutter/pubspec.yaml
@@ -2,7 +2,7 @@
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
-version: 0.5.21+11
+version: 0.5.21+12
dependencies:
flutter:
diff --git a/packages/path_provider/CHANGELOG.md b/packages/path_provider/CHANGELOG.md
index a8c91a2..27dde42 100644
--- a/packages/path_provider/CHANGELOG.md
+++ b/packages/path_provider/CHANGELOG.md
@@ -1,5 +1,10 @@
+## 1.4.4
+
+* Update driver tests in the example app to e2e tests.
+
## 1.4.3
+* Update driver tests in the example app to e2e tests.
* Add missing DartDocs and a lint to prevent further regressions.
## 1.4.2
diff --git a/packages/path_provider/android/build.gradle b/packages/path_provider/android/build.gradle
index 93460e7..71ea49b 100644
--- a/packages/path_provider/android/build.gradle
+++ b/packages/path_provider/android/build.gradle
@@ -37,3 +37,29 @@
implementation 'androidx.annotation:annotation:1.1.0'
testImplementation 'junit:junit:4.12'
}
+
+// TODO(cyanglaz): Remove this hack once androidx.lifecycle is included on stable. https://github.com/flutter/flutter/issues/42348
+afterEvaluate {
+ def containsEmbeddingDependencies = false
+ for (def configuration : configurations.all) {
+ for (def dependency : configuration.dependencies) {
+ if (dependency.group == 'io.flutter' &&
+ dependency.name.startsWith('flutter_embedding') &&
+ dependency.isTransitive())
+ {
+ containsEmbeddingDependencies = true
+ break
+ }
+ }
+ }
+ if (!containsEmbeddingDependencies) {
+ android {
+ dependencies {
+ def lifecycle_version = "1.1.1"
+ compileOnly "android.arch.lifecycle:runtime:$lifecycle_version"
+ compileOnly "android.arch.lifecycle:common:$lifecycle_version"
+ compileOnly "android.arch.lifecycle:common-java8:$lifecycle_version"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/packages/path_provider/example/android/gradle.properties b/packages/path_provider/example/android/gradle.properties
index 7be3d8b..38c8d45 100644
--- a/packages/path_provider/example/android/gradle.properties
+++ b/packages/path_provider/example/android/gradle.properties
@@ -1,2 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/packages/path_provider/example/pubspec.yaml b/packages/path_provider/example/pubspec.yaml
index 015a4fb..279a913 100644
--- a/packages/path_provider/example/pubspec.yaml
+++ b/packages/path_provider/example/pubspec.yaml
@@ -11,6 +11,7 @@
flutter_driver:
sdk: flutter
test: any
+ e2e: ^0.2.1
flutter:
uses-material-design: true
diff --git a/packages/path_provider/example/test_driver/path_provider.dart b/packages/path_provider/example/test_driver/path_provider_e2e.dart
similarity index 85%
rename from packages/path_provider/example/test_driver/path_provider.dart
rename to packages/path_provider/example/test_driver/path_provider_e2e.dart
index ccbc625..d3a1019 100644
--- a/packages/path_provider/example/test_driver/path_provider.dart
+++ b/packages/path_provider/example/test_driver/path_provider_e2e.dart
@@ -5,31 +5,29 @@
import 'dart:async';
import 'dart:io';
-import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path_provider/path_provider.dart';
+import 'package:e2e/e2e.dart';
void main() {
- final Completer<String> allTestsCompleter = Completer<String>();
- enableFlutterDriverExtension(handler: (_) => allTestsCompleter.future);
- tearDownAll(() => allTestsCompleter.complete(null));
+ E2EWidgetsFlutterBinding.ensureInitialized();
- test('getTemporaryDirectory', () async {
+ testWidgets('getTemporaryDirectory', (WidgetTester tester) async {
final Directory result = await getTemporaryDirectory();
_verifySampleFile(result, 'temporaryDirectory');
});
- test('getApplicationDocumentsDirectory', () async {
+ testWidgets('getApplicationDocumentsDirectory', (WidgetTester tester) async {
final Directory result = await getApplicationDocumentsDirectory();
_verifySampleFile(result, 'applicationDocuments');
});
- test('getApplicationSupportDirectory', () async {
+ testWidgets('getApplicationSupportDirectory', (WidgetTester tester) async {
final Directory result = await getApplicationSupportDirectory();
_verifySampleFile(result, 'applicationSupport');
});
- test('getLibraryDirectory', () async {
+ testWidgets('getLibraryDirectory', (WidgetTester tester) async {
if (Platform.isIOS) {
final Directory result = await getLibraryDirectory();
_verifySampleFile(result, 'library');
@@ -39,7 +37,7 @@
}
});
- test('getExternalStorageDirectory', () async {
+ testWidgets('getExternalStorageDirectory', (WidgetTester tester) async {
if (Platform.isIOS) {
final Future<Directory> result = getExternalStorageDirectory();
expect(result, throwsA(isInstanceOf<UnsupportedError>()));
@@ -49,7 +47,7 @@
}
});
- test('getExternalCacheDirectories', () async {
+ testWidgets('getExternalCacheDirectories', (WidgetTester tester) async {
if (Platform.isIOS) {
final Future<List<Directory>> result = getExternalCacheDirectories();
expect(result, throwsA(isInstanceOf<UnsupportedError>()));
diff --git a/packages/google_maps_flutter/example/test_driver/google_maps_test.dart b/packages/path_provider/example/test_driver/path_provider_e2e_test.dart
similarity index 72%
copy from packages/google_maps_flutter/example/test_driver/google_maps_test.dart
copy to packages/path_provider/example/test_driver/path_provider_e2e_test.dart
index b0d3305..ff6e9ce 100644
--- a/packages/google_maps_flutter/example/test_driver/google_maps_test.dart
+++ b/packages/path_provider/example/test_driver/path_provider_e2e_test.dart
@@ -3,11 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-
+import 'dart:io';
import 'package:flutter_driver/flutter_driver.dart';
Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
- await driver.requestData(null, timeout: const Duration(minutes: 1));
+ final String result =
+ await driver.requestData(null, timeout: const Duration(minutes: 1));
driver.close();
+ exit(result == 'pass' ? 0 : 1);
}
diff --git a/packages/path_provider/example/test_driver/path_provider_test.dart b/packages/path_provider/example/test_driver/path_provider_test.dart
deleted file mode 100644
index b0d3305..0000000
--- a/packages/path_provider/example/test_driver/path_provider_test.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2019, the Chromium project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-
-import 'package:flutter_driver/flutter_driver.dart';
-
-Future<void> main() async {
- final FlutterDriver driver = await FlutterDriver.connect();
- await driver.requestData(null, timeout: const Duration(minutes: 1));
- driver.close();
-}
diff --git a/packages/path_provider/pubspec.yaml b/packages/path_provider/pubspec.yaml
index d9d3940..15aa1a0 100644
--- a/packages/path_provider/pubspec.yaml
+++ b/packages/path_provider/pubspec.yaml
@@ -3,7 +3,7 @@
iOS file systems, such as the temp and app data directories.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider
-version: 1.4.3
+version: 1.4.4
flutter:
plugin: