[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
[e2e] update README (#2233)
Browse files Browse the repository at this point in the history
* Update README
  • Loading branch information
collinjackson committed Oct 28, 2019
1 parent bdd41e9 commit fe49a79
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
4 changes: 4 additions & 0 deletions packages/e2e/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.1+1

* Updated README.

## 0.2.1

* Support the v2 Android embedder.
Expand Down
28 changes: 22 additions & 6 deletions packages/e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# e2e

This package enables self-driving testing of Flutter code on devices and emulators.
It can adapt the test results in a format that is compatible with `flutter drive`
It adapts flutter_test results into a format that is compatible with `flutter drive`
and native Android instrumentation testing.

iOS support is not available yet, but is planned in the future.
Expand All @@ -27,12 +27,19 @@ void main() {
}
```

## Test locations

It is recommended to put e2e tests in the `test/` folder of the app or package.
For example apps, if the e2e test references example app code, it should go in
`example/test/`. It is also acceptable to put e2e tests in `test_driver/` folder
so that they're alongside the runner app (see below).

## Using Flutter driver to run tests

`E2EWidgetsTestBinding` supports launching the on-device tests with `flutter drive`.
Note that the tests don't use the `FlutterDriver` API, they use `testWidgets` instead.

Put the a file named `<package_name>_test.dart` in the app' `test_driver` directory:
Put the a file named `<package_name>_e2e_test.dart` in the app' `test_driver` directory:

```
import 'package:flutter_driver/flutter_driver.dart';
Expand Down Expand Up @@ -106,22 +113,27 @@ dependencies {
To e2e test on a local Android device (emulated or physical):

```
./gradlew connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_e2e.dart
./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_e2e.dart
```

## Firebase Test Lab

If this is you first time testing with Firebase Test Lab,
you'll need to follow the guides in the
[Firebase test lab documentation](https://firebase.google.com/docs/test-lab/?gclid=EAIaIQobChMIs5qVwqW25QIV8iCtBh3DrwyUEAAYASAAEgLFU_D_BwE)
to set up a project.

To run an e2e test on Android devices using Firebase Test Lab, use gradle commands to build an
instrumentation test for Android.

```
pushd android
./gradlew assembleAndroidTest
./gradlew assembleDebug -Ptarget=<path_to_test>.dart
./gradlew app:assembleAndroidTest
./gradlew app:assembleDebug -Ptarget=<path_to_test>.dart
popd
```

Upload to Firebase Test Lab, making sure to replace <PATH_TO_KEY_FILE>,
Upload the build apks Firebase Test Lab, making sure to replace <PATH_TO_KEY_FILE>,
<PROJECT_NAME>, <RESULTS_BUCKET>, and <RESULTS_DIRECTORY> with your values.

```
Expand All @@ -135,4 +147,8 @@ gcloud firebase test android run --type instrumentation \
--results-dir=<RESULTS_DIRECTORY>
```

You can pass additional parameters on the command line, such as the
devices you want to test on. See
[gcloud firebase test android run](https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run).

iOS support for Firebase Test Lab is not yet available, but is planned.
2 changes: 1 addition & 1 deletion packages/e2e/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: e2e
description: Runs tests that use the flutter_test API as integration tests.
version: 0.2.1
version: 0.2.1+1
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/e2e

Expand Down

0 comments on commit fe49a79

Please sign in to comment.