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

Commit bc2374f

Browse files
committed
Update README
1 parent bb5c3eb commit bc2374f

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

packages/e2e/README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# e2e
22

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

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

30+
## Test locations
31+
32+
It is recommended to put e2e tests in the `test/` folder of the app or package.
33+
For example apps, if the e2e test references example app code, it should go in
34+
`example/test/`. It is also acceptable to put e2e tests in `test_driver/` folder
35+
so that they're alongside the runner app (see below).
36+
3037
## Using Flutter driver to run tests
3138

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

35-
Put the a file named `<package_name>_test.dart` in the app' `test_driver` directory:
42+
Put the a file named `<package_name>_e2e_test.dart` in the app' `test_driver` directory:
3643

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

108115
```
109-
./gradlew connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_e2e.dart
116+
./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_e2e.dart
110117
```
111118

112119
## Firebase Test Lab
113120

121+
If this is you first time testing with Firebase Test Lab,
122+
you'll need to follow the guides in the
123+
[Firebase test lab documentation](https://firebase.google.com/docs/test-lab/?gclid=EAIaIQobChMIs5qVwqW25QIV8iCtBh3DrwyUEAAYASAAEgLFU_D_BwE)
124+
to set up a project.
125+
114126
To run an e2e test on Android devices using Firebase Test Lab, use gradle commands to build an
115127
instrumentation test for Android.
116128

117129
```
118130
pushd android
119-
./gradlew assembleAndroidTest
120-
./gradlew assembleDebug -Ptarget=<path_to_test>.dart
131+
./gradlew app:assembleAndroidTest
132+
./gradlew app:assembleDebug -Ptarget=<path_to_test>.dart
121133
popd
122134
```
123135

124-
Upload to Firebase Test Lab, making sure to replace <PATH_TO_KEY_FILE>,
136+
Upload the build apks Firebase Test Lab, making sure to replace <PATH_TO_KEY_FILE>,
125137
<PROJECT_NAME>, <RESULTS_BUCKET>, and <RESULTS_DIRECTORY> with your values.
126138

127139
```
@@ -135,4 +147,8 @@ gcloud firebase test android run --type instrumentation \
135147
--results-dir=<RESULTS_DIRECTORY>
136148
```
137149

150+
You can pass additional parameters on the command line, such as the
151+
devices you want to test on. See
152+
[gcloud firebase test android run](https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run).
153+
138154
iOS support for Firebase Test Lab is not yet available, but is planned.

0 commit comments

Comments
 (0)