[integration_test] Test drivers should end with `_test.dart` (#3063)
This makes globbing by tooling easier.
Also fix the documentation for running them natively with the Android and iOS tool.
diff --git a/.cirrus.yml b/.cirrus.yml
index 25396ea..872cfc2 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -59,7 +59,7 @@
- ./chromedriver/chromedriver --port=4444 &
test_script:
- cd $INTEGRATION_TEST_PATH/example/
- - flutter drive -v --driver=test_driver/integration_test_driver.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome
+ - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome
- name: build-apks+java-test+firebase-test-lab
env:
matrix:
diff --git a/packages/integration_test/README.md b/packages/integration_test/README.md
index a6b1726..be08a72 100644
--- a/packages/integration_test/README.md
+++ b/packages/integration_test/README.md
@@ -30,8 +30,8 @@
### Driver Entrypoint
An accompanying driver script will be needed that can be shared across all
-integration tests. Create a `integration_test_driver.dart` in the `test_driver/`
-directory with the following contents:
+integration tests. Create a file named `integration_test.dart` in the
+`test_driver/` directory with the following contents:
```dart
import 'package:integration_test/integration_test_driver.dart';
@@ -57,7 +57,7 @@
test/
# Other unit tests go here.
test_driver/
- integration_test_driver.dart
+ integration_test.dart
```
[Example](https://github.com/flutter/plugins/tree/master/packages/integration_test/example)
@@ -67,11 +67,11 @@
These tests can be launched with the `flutter drive` command.
To run the `integration_test/foo_test.dart` test with the
-`test_driver/integration_test_driver.dart` driver, use the following command:
+`test_driver/integration_test.dart` driver, use the following command:
```sh
flutter drive \
- --driver=test_driver/integration_test_driver.dart \
+ --driver=test_driver/integration_test.dart \
--target=integration_test/foo_test.dart
```
@@ -85,7 +85,7 @@
```sh
flutter drive \
- --driver=test_driver/integration_test_driver.dart \
+ --driver=test_driver/integration_test.dart \
--target=integration_test/foo_test.dart \
-d web-server
```
@@ -134,10 +134,11 @@
}
```
-To run a test on a local Android device (emulated or physical):
+To run `integration_test/foo_test.dart` on a local Android device (emulated or
+physical):
```sh
-./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_integration_test.dart
+./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../integration_test/foo_test.dart
```
## Firebase Test Lab
@@ -189,10 +190,12 @@
end
```
-To run a test on your iOS device (simulator or real), rebuild your iOS targets with Flutter tool.
+To run `integration_test/foo_test.dart` on your iOS device, rebuild your iOS
+targets with Flutter tool.
```sh
-flutter build ios -t test_driver/<package_name>_integration_test.dart (--simulator)
+# Pass --simulator if building for the simulator.
+flutter build ios integration_test/foo_test.dart
```
Open Xcode project (by default, it's `ios/Runner.xcodeproj`). Create a test target
diff --git a/packages/integration_test/example/README.md b/packages/integration_test/example/README.md
index 7e6317f..b5cc5d7 100644
--- a/packages/integration_test/example/README.md
+++ b/packages/integration_test/example/README.md
@@ -8,7 +8,7 @@
```sh
flutter drive \
- --driver=test_driver/integration_test_driver.dart \
+ --driver=test_driver/integration_test.dart \
--target=integration_test/example_test.dart
```
@@ -16,7 +16,7 @@
```sh
flutter drive \
- --driver=test_driver/integration_test_driver.dart \
+ --driver=test_driver/integration_test.dart \
--target=integration_test/example_test.dart \
-d web-server
```
diff --git a/packages/integration_test/example/test_driver/integration_test_extended_driver.dart b/packages/integration_test/example/test_driver/extended_integration_test.dart
similarity index 100%
rename from packages/integration_test/example/test_driver/integration_test_extended_driver.dart
rename to packages/integration_test/example/test_driver/extended_integration_test.dart
diff --git a/packages/integration_test/example/integration_test/failure_test.dart b/packages/integration_test/example/test_driver/failure.dart
similarity index 77%
rename from packages/integration_test/example/integration_test/failure_test.dart
rename to packages/integration_test/example/test_driver/failure.dart
index ffb569f..02fc55e 100644
--- a/packages/integration_test/example/integration_test/failure_test.dart
+++ b/packages/integration_test/example/test_driver/failure.dart
@@ -8,6 +8,12 @@
import 'package:integration_test_example/main.dart' as app;
+/// This file is placed in `test_driver/` instead of `integration_test/`, so
+/// that the CI tooling of flutter/plugins only uses this together with
+/// `failure_test.dart` as the driver. It is only used for testing of
+/// `package:integration_test` – do not follow the conventions here if you are a
+/// user of `package:integration_test`.
+
// Tests the failure behavior of the IntegrationTestWidgetsFlutterBinding
//
// This test fails intentionally! It should be run using a test runner that
diff --git a/packages/integration_test/example/test_driver/integration_test_failure_driver.dart b/packages/integration_test/example/test_driver/failure_test.dart
similarity index 76%
rename from packages/integration_test/example/test_driver/integration_test_failure_driver.dart
rename to packages/integration_test/example/test_driver/failure_test.dart
index 0b60e47..fce6adc 100644
--- a/packages/integration_test/example/test_driver/integration_test_failure_driver.dart
+++ b/packages/integration_test/example/test_driver/failure_test.dart
@@ -2,6 +2,9 @@
import 'package:integration_test/common.dart' as common;
import 'package:test/test.dart';
+/// This file is only used for testing of `package:integration_test` – do not
+/// follow the conventions here if you are a user of `package:integration_test`.
+
Future<void> main() async {
test('fails gracefully', () async {
final FlutterDriver driver = await FlutterDriver.connect();
diff --git a/packages/integration_test/example/test_driver/integration_test_driver.dart b/packages/integration_test/example/test_driver/integration_test.dart
similarity index 100%
rename from packages/integration_test/example/test_driver/integration_test_driver.dart
rename to packages/integration_test/example/test_driver/integration_test.dart