flutter/dev/integration_tests/android_engine_test
auto-submit[bot] e0c42c6e38
Reverts "Use pub workspace (#168662)" (#169357)
<!-- start_original_pr_link -->
Reverts: flutter/flutter#168662
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Broke integration tests that do not run on
presubmit:

-
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64%20macos_chrome_dev_mode/8715/overview
-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20linux_chrome_dev_mode/7617/overview
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: mosuem
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {matanlurey}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
Switch Flutter to use pub workspaces as a preparation to unpin selected
packages.

Assumptions:

1. No packages in this repository are published to pub.dev --> We can
use `any` dependencies in most local pubspecs, as the global constraint
defines the version. An exception are the packages used outside of this
repo with an `sdk` dependency, namely `flutter_localizations`,
`flutter_test`, and `flutter`.
2. The "universes" `{flutter_tools}` and `{flutter,
flutter_localizations, flutter_goldens}` can use different packages
versions, as they are not resolved together. --> We do not need to
upgrade them in sync, we can first do one "universe", then the other.

Based on these assumptions, we use
https://github.com/mosuem/pubspec_merger.dart to merge all packages in
the `flutter` universe into a top-level pub workspace.

The `flutter` and `flutter_tools` workspaces being separate also ensures
that changes to `flutter` will not inadvertently break `flutter_tools`,
with not-so-nice consequences for our users which would be unable to run
`flutter upgrade`.

There is a third "top-level" pubspec besides `./pubspec.yaml` and
`packages/flutter_tools/pubspec.yaml`, namely
`packages/flutter_tools/.../widget_preview_scaffold/pubspec.yaml`. This
is an artifact due to it living under `flutter_tools`, so it can't be
part of the `./pubspec.yaml` workspace. Moving it would be a larger
change, and out of the scope of this PR.

This required a rewrite of the update-packages tool, but the main
functionality stays the same, as well as the argument names, to ensure a
seamless transition.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
2025-05-23 16:00:19 +00:00
..
android Reapply "[ Device Lab ] Upgrade Device Lab projects to Java 18" (#166016) (#166059) 2025-03-27 15:07:22 +00:00
lib Error when trying to use old HC mode when HCPP is enabled (#168027) 2025-05-12 18:53:16 +00:00
test_driver Error when trying to use old HC mode when HCPP is enabled (#168027) 2025-05-12 18:53:16 +00:00
tool Refactor android_engine_test, make it easier to debug/deflake locally. (#161534) 2025-01-15 01:05:31 +00:00
.metadata Rename native_driver to android_{driver_extensions|engine_test} (#161263) 2025-01-08 20:28:38 +00:00
pubspec.yaml Reverts "Use pub workspace (#168662)" (#169357) 2025-05-23 16:00:19 +00:00
README.md Force Impeller backend for android_engine_test, and test both OpenGLES and Vulkan (#162089) 2025-01-25 01:55:28 +00:00

android_engine_test

This directory contains a sample app and tests that demonstrate how to use the (experimental) native Flutter Driver API to drive Flutter apps that run on Android devices or emulators, interact with and capture screenshots of the app, and compare the screenshots against golden images.

Caution

This test suite is a very end-to-end suite that is testing a combination of the graphics backend, the Android embedder, the Flutter framework, and Flutter tools, and only useful when the documentation and naming stays up to date and is clearly actionable.

Please take extra care when updating the test suite to also update the REAMDE.

How it runs on CI (LUCI)

See dev/bots/suite_runners/run_android_engine_tests.dart, but tl;dr:

# TIP: If golden-files do not exist locally, this command will fail locally.
SHARD=android_engine_vulkan_tests bin/cache/dart-sdk/bin/dart dev/bots/test.dart
SHARD=android_engine_opengles_tests bin/cache/dart-sdk/bin/dart dev/bots/test.dart

Running the apps and tests

Each lib/{prefix}_main.dart file is a standalone Flutter app that you can run on an Android device or emulator.

flutter_rendered_blue_rectangle

This app displays a full screen blue rectangle. It mostly serves as a test that Flutter can run at all on the target device, and that the Flutter (native) driver can take a screenshot and compare it to a golden image. If this app or test fails, it's likely none of the other apps or tests will work either.

# Run the app
$ flutter run lib/flutter_rendered_blue_rectangle_main.dart

# Run the test
$ flutter drive lib/flutter_rendered_blue_rectangle_main.dart

external_texture/surface_producer_smiley_face

This app displays a full screen rectangular deformed smiley face with a yellow background. It tests the SurfaceProducer API end-to-end, including historic regression cases around backgrounding the app, trimming memory, and resuming the app.

# Run the app
$ flutter run lib/external_texture/surface_producer_smiley_face_main.dart

# Run the test
$ flutter drive lib/external_texture/surface_producer_smiley_face_main.dart

external_texture/surface_texture_smiley_face

This app displays a full screen rectangular deformed smiley face with a yellow background. It tests the SurfaceTexture API end-to-end.

# Run the app
$ flutter run lib/external_texture/surface_texture_smiley_face_main.dart

# Run the test
$ flutter drive lib/external_texture/surface_texture_smiley_face_main.dart

platform_view/hybrid_composition_platform_view

This app displays a blue orange gradient, the app is backgrounded, and then resumed. It tests the Hybrid Composition implementation.

# Run the app
$ flutter run lib/platform_view/hybrid_composition_platform_view_main.dart

# Run the test
$ flutter drive lib/platform_view/hybrid_composition_platform_view_main.dart

platform_view/texture_layer_hybrid_composition_platform_view

This app displays a blue orange gradient, the app is backgrounded, and then resumed. It tests the Texture Layer Hybrid Composition implementation.

# Run the app
$ flutter run lib/platform_view/texture_layer_hybrid_composition_platform_view_main.dart

# Run the test
$ flutter drive lib/platform_view/texture_layer_hybrid_composition_platform_view_main.dart

platform_view/virtual_display_platform_view

This app displays a blue orange gradient, the app is backgrounded, and then resumed. It tests the Virtual Display implementation.

# Run the app
$ flutter run lib/platform_view/virtual_display_platform_view_main.dart

# Run the test
$ flutter drive lib/platform_view/virtual_display_platform_view_main.dart

platform_view_tap_color_change

This app displays a blue rectangle, using platform views, which upon being tapped (natively, not by Flutter), changes from blue to red.

# Run the app
$ flutter run lib/platform_view_tap_color_change_main.dart

# Run the test
$ flutter drive lib/platform_view_tap_color_change_main_test.dart

Deflaking

Use tool/deflake.dart <path/to/lib/main.dart> to, in 1-command:

  • Build an APK.
  • Establish a baseline set of golden-files locally.
  • Run N tests (by default, 10) in the same state, asserting the same output.

For example:

dart tool/deflake.dart lib/flutter_rendered_blue_rectangle_main.dart

For more options, see dart tool/deflake.dart --help.