flutter/packages/integration_test/test
Matan Lurey 4cd0e33013
Implement golden-file matching for integration_test on Android and iOS devices (#160484)
Work towards https://github.com/flutter/flutter/issues/143299.
Work towards https://github.com/flutter/flutter/issues/160043.

---

This PR implements, end-to-end, support for `matchesGoldenFile` when (a)
running with `package:integration_test` (b) on a device, such as an
Android emulator, Android device, iOS simulator, or iOS device, where
the _runner_ of a test file does not have process and local-file system
access.

There are multiple parts to this PR; I could make it smaller than 1K
lines, but the bulk of that is tests, and it would mean landing PRs that
are incomplete and unused, which does not seem useful - so instead here
is a quick overview of the PR's contents - questions/feedback welcome,
and I am willing to break code out or land incremental refactors if
requested.

1. Augmented `flutter_platform.dart` (used for iOS and Android), similar
to
[`flutter_web_platform.dart`](1398dc7eec/packages/flutter_tools/lib/src/test/flutter_web_platform.dart (L117-L128)),
now creates and uses
[`test_golden_comparator.dart`](https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/test/test_golden_comparator.dart)
to proxy calls (coming from the VM service protocol) for golden-file
updates and comparisons to a `flutter_tester` process. A full
explanation of how (or why) it works this way is too hard to include
here, but see https://github.com/flutter/flutter/pull/160215 for more
details.
1. Added `VmServiceProxyGoldenFileComparator`, which is a currently
unused (outside of a single e2e test) comparator that forwards calls to
`compare` and `update` to the VM service protocol (of which, the other
side of this is implemented above, in `flutter_platform.dart`. The idea
is that this comparator would be used automatically when running in an
integration test on a device that requires it (similar to how web works
today), but that is **not** wired up yet and requires additional work in
`flutter_tools`.
1. Added two unit tests (of both the client and server), and a full
e2e-test using it to run `matchesGoldenFile`.
2024-12-28 19:48:20 +00:00
..
data Auto-format Framework (#160545) 2024-12-19 20:06:21 +00:00
_goldens_io.dart Add a simple golden-file test to package:integration_test. (#159233) 2024-12-09 20:00:26 +00:00
_goldens_web.dart Auto-format Framework (#160545) 2024-12-19 20:06:21 +00:00
binding_fail_test.dart Auto-format Framework (#160545) 2024-12-19 20:06:21 +00:00
binding_test.dart Auto-format Framework (#160545) 2024-12-19 20:06:21 +00:00
flutter_test_config.dart Add a simple golden-file test to package:integration_test. (#159233) 2024-12-09 20:00:26 +00:00
golden_screenshot_test.dart Auto-format Framework (#160545) 2024-12-19 20:06:21 +00:00
response_serialization_test.dart Reland integration_test NNBD (#75074) 2021-02-01 10:19:14 -08:00
socket_fail_test.dart Auto-format Framework (#160545) 2024-12-19 20:06:21 +00:00
vm_service_golden_client_test.dart Implement golden-file matching for integration_test on Android and iOS devices (#160484) 2024-12-28 19:48:20 +00:00
web_extension_test.dart Auto-format Framework (#160545) 2024-12-19 20:06:21 +00:00