From 630180b5ec1d2023233d275bfde9313adee9fc51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Meneses=20Leo=CC=81n?= Date: Tue, 25 Aug 2026 11:38:54 -0600 Subject: [PATCH 1/2] [espresso] Adopt code-excerpts for README The excerpt validator only requires code-excerpt management for Dart code blocks, so the README's Java/Groovy/XML/sh snippets are untouched. The one Dart block (the test_driver script) used the deprecated flutter_driver enableFlutterDriverExtension() API, which no longer has a real, compilable counterpart in this repo now that the example app migrated to the integration_test package. Points the excerpt at the example's actual test_driver/integration_test.dart (integrationDriver()) instead, and updates the surrounding prose and gradle command to match. Also drops the package's ci_config.yaml, whose only purpose was opting it out of that validation. Part of https://github.com/flutter/flutter/issues/102679. FPOCTSMP-5 --- packages/espresso/CHANGELOG.md | 7 +++++++ packages/espresso/README.md | 20 +++++++++---------- packages/espresso/ci_config.yaml | 2 -- .../example/test_driver/integration_test.dart | 2 ++ 4 files changed, 18 insertions(+), 13 deletions(-) delete mode 100644 packages/espresso/ci_config.yaml diff --git a/packages/espresso/CHANGELOG.md b/packages/espresso/CHANGELOG.md index 50987aa3cefa..e8f56d7fb679 100644 --- a/packages/espresso/CHANGELOG.md +++ b/packages/espresso/CHANGELOG.md @@ -1,3 +1,10 @@ +## NEXT + +* 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. diff --git a/packages/espresso/README.md b/packages/espresso/README.md index d7c61dc9e407..65224f316a72 100644 --- a/packages/espresso/README.md +++ b/packages/espresso/README.md @@ -1,4 +1,5 @@ # espresso + Provides bindings for Espresso tests of Flutter Android apps. @@ -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 `` 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`: + ```dart -import 'package:flutter_driver/driver_extension.dart'; -import 'package:/main.dart' as app; +import 'package:integration_test/integration_test_driver.dart'; -void main() { - enableFlutterDriverExtension(); - app.main(); -} +Future 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): diff --git a/packages/espresso/ci_config.yaml b/packages/espresso/ci_config.yaml deleted file mode 100644 index b352e13e0dfa..000000000000 --- a/packages/espresso/ci_config.yaml +++ /dev/null @@ -1,2 +0,0 @@ -# TODO(stuartmorgan): Remove this; see https://github.com/flutter/flutter/issues/102679 -exempt_from_excerpts: true diff --git a/packages/espresso/example/test_driver/integration_test.dart b/packages/espresso/example/test_driver/integration_test.dart index fb3dec00bee9..4f400dec4449 100644 --- a/packages/espresso/example/test_driver/integration_test.dart +++ b/packages/espresso/example/test_driver/integration_test.dart @@ -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 main() => integrationDriver(); +// #enddocregion Driver From 36c41c50f2356d46c7fc5a18e3472561d83fe29e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Meneses=20Leo=CC=81n?= Date: Wed, 26 Aug 2026 18:24:10 -0600 Subject: [PATCH 2/2] [espresso] Bump to 0.4.0+26 for the code-excerpts README change Same issue flagged on #32/#34: these README changes need to be published, so they can't stay under `## NEXT`. FPOCTSMP-5 --- packages/espresso/CHANGELOG.md | 2 +- packages/espresso/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/espresso/CHANGELOG.md b/packages/espresso/CHANGELOG.md index e8f56d7fb679..341c39e69f85 100644 --- a/packages/espresso/CHANGELOG.md +++ b/packages/espresso/CHANGELOG.md @@ -1,4 +1,4 @@ -## NEXT +## 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 diff --git a/packages/espresso/pubspec.yaml b/packages/espresso/pubspec.yaml index b9a102fa1bdf..683cf3b160e2 100644 --- a/packages/espresso/pubspec.yaml +++ b/packages/espresso/pubspec.yaml @@ -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