diff --git a/.cirrus.yml b/.cirrus.yml index 25396ea3faf4..872cfc2316fa 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -59,7 +59,7 @@ task: - ./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 a6b1726475e2..be08a722bc75 100644 --- a/packages/integration_test/README.md +++ b/packages/integration_test/README.md @@ -30,8 +30,8 @@ void main() { ### 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 @@ integration_test/ 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 @@ test_driver/ 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 @@ Use following command to execute the tests: ```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 @@ dependencies { } ``` -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/_integration_test.dart +./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../integration_test/foo_test.dart ``` ## Firebase Test Lab @@ -189,10 +190,12 @@ target 'Runner' do 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/_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 7e6317fcf96f..b5cc5d77e46f 100644 --- a/packages/integration_test/example/README.md +++ b/packages/integration_test/example/README.md @@ -8,7 +8,7 @@ Android / iOS: ```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 @@ Web: ```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 ffb569f75fbb..02fc55e94a53 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/integration_test.dart'; 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 77% 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 0b60e471d711..fce6adc42c92 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:flutter_driver/flutter_driver.dart'; 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 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