Skip to content
Draft
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
7 changes: 7 additions & 0 deletions packages/espresso/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.4.0+26

* Adopts `code-excerpt` for the README's Dart driver snippet so it is
validated against compilable, analyzed source, and updates it to use
`integration_test`'s driver instead of the deprecated `flutter_driver`
extension.

## 0.4.0+25

* Bumps com.google.guava:guava from 33.5.0-android to 33.6.0-android.
Expand Down
20 changes: 9 additions & 11 deletions packages/espresso/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# espresso
<?code-excerpt path-base="example"?>

Provides bindings for Espresso tests of Flutter Android apps.

Expand Down Expand Up @@ -86,25 +87,22 @@ public class MainActivityTest {
}
```

You'll need to create a test app that enables the Flutter driver extension.
You can put this in your test_driver/ folder, e.g. test_driver/example.dart.
Replace `<app_package_name>` with the package name of your app. If you're
developing a plugin, this will be the package name of the example app.
You'll need to create a driver script that hands off to the
[`integration_test`](https://pub.dev/packages/integration_test) package so
`flutter drive`/Espresso can run your Dart integration tests. Put this in your
`test_driver/` folder, e.g. `test_driver/integration_test.dart`:

<?code-excerpt "test_driver/integration_test.dart (Driver)"?>
```dart
import 'package:flutter_driver/driver_extension.dart';
import 'package:<app_package_name>/main.dart' as app;
import 'package:integration_test/integration_test_driver.dart';

void main() {
enableFlutterDriverExtension();
app.main();
}
Future<void> main() => integrationDriver();
```

The following command line command runs the test locally:

```sh
./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/example.dart
./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/integration_test.dart
```

Espresso tests can also be run on [Firebase Test Lab](https://firebase.google.com/docs/test-lab):
Expand Down
2 changes: 0 additions & 2 deletions packages/espresso/ci_config.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions packages/espresso/example/test_driver/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// #docregion Driver
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
// #enddocregion Driver
2 changes: 1 addition & 1 deletion packages/espresso/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Java classes for testing Flutter apps using Espresso.
Allows driving Flutter widgets from a native Espresso test.
repository: https://github.com/flutter/packages/tree/main/packages/espresso
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+espresso%22
version: 0.4.0+25
version: 0.4.0+26

environment:
sdk: ^3.10.0
Expand Down