Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
23 changes: 13 additions & 10 deletions packages/integration_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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)
Expand All @@ -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
```

Expand All @@ -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
```
Expand Down Expand Up @@ -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/<package_name>_integration_test.dart
./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../integration_test/foo_test.dart
```

## Firebase Test Lab
Expand Down Expand Up @@ -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/<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
Expand Down
4 changes: 2 additions & 2 deletions packages/integration_test/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Android / iOS:

```sh
flutter drive \
--driver=test_driver/integration_test_driver.dart \
--driver=test_driver/integration_test.dart \
--target=integration_test/example_test.dart
```

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
```
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> main() async {
test('fails gracefully', () async {
final FlutterDriver driver = await FlutterDriver.connect();
Expand Down