-
Notifications
You must be signed in to change notification settings - Fork 28.6k
Fix screenshot testing for flutter web integration_test #117114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@yjbanov @Piinks This is ready for review. Please let me know what needs to be changed, and Kate, Yegor mentioned you might be able to help me move this PR over to using Skia Gold instead of the manual .png storage I have done here. Eager to get the changes to package:integration_test landed so we can use them in DevTools 👍 Thanks! |
Yeah, we can't check image files into this repo. Unfortunately, I can't set up integration tests to send images to Gold right now. Someone did wire them up for tests in exmaples/api though, you may be able to use #99298 as a guide. :) |
@Piinks do you know of any usages of flutter_goldens in integration tests? |
I followed the pattern in #99298 and added this to the test: await expectLater(
find.byType(MaterialApp),
matchesGoldenFile('platform_name.png'),
); When running the test: this is what was output: |
List<int> screenshotBytes, [ | ||
Map<String, Object?>? args, | ||
]) async { | ||
// Here is an example of what updating a golden image might look like. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionally, I can also remove this example and just leave the changes in this PR that are outside the example/
directory. We will do something like this for DevTools, since it looks like Skia Gold has not been hooked up yet for web integration tests (#86120). I'd like to unblock screenshot testing in integration tests for DevTools (even without skia gold support), so let me know what you think. Thanks.
Did you push those changes? It won't work locally, it needs to be authenticated in CI. |
Ah okay. Pushed them up now, so we'll see if it worked 👍 |
I'm not sure if Alternatively, we can keep it simple for now and instead of integrating with Skia Gold, use package:image to decode the PNG and spot check a few pixels. |
Isn't the problem that we can't check PNGs into the codebase? how would we be able to use package:image to compare images without checking goldens in? |
Sorry, by "PNG" I meant the screenshot that the test takes and passes to the |
How would we get the "known" pixels? This sounds a bit hand wavy. Would we expect the average flutter developer to know how to parse out image "hot spots" from byte code and store those as constants to compare the new Could we possibly separate this PR into two tasks:
I would like to shift this PR to address task 1 and leave task 2 for a later day when this user journey is better addressed. |
24d1349
to
79a39da
Compare
30b2225
to
2dc553c
Compare
#117496 contains the same changes to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 95ff839 Roll Plugins from 54fc206 to 2dd85ec (3 revisions) (flutter/flutter#117535) * b8d5d9c Revert "Remove single-view assumption from widgets library (#117480)" (flutter/flutter#117545) * bd482eb fixes android_semantics_integration_test to expect long press for tooltip (flutter/flutter#117547) * 725c141 Fix screenshot testing for flutter web integration_test (flutter/flutter#117114) * 999356b Remove single-view assumption from ScrollPhysics (flutter/flutter#117503) * 6eb002a Reland "Remove single-view assumption from widgets library (#117480)" (flutter/flutter#117549) * 08209b7 Explain how to test onSubmitted in its docs (flutter/flutter#117550) * 20bc2ba Roll Flutter Engine from a90c45db3f13 to 234ab4c1e9c4 (1 revision) (flutter/flutter#117555) * abd5217 Bump ossf/scorecard-action from 2.1.1 to 2.1.2 (flutter/flutter#117554) * 6781576 Reland iOS 16 context menu (flutter/flutter#117234) * daa2ecf Roll Flutter Engine from 234ab4c1e9c4 to ca0c843bf75f (11 revisions) (flutter/flutter#117563) * 6441a7d Roll Flutter Engine from ca0c843bf75f to 12badb54598d (2 revisions) (flutter/flutter#117566) * a0cecbe 3b5fb86a5 delete unused lib/src/engine/canvaskit/viewport_metrics.dart (flutter/engine#38474) (flutter/flutter#117572) * fbfda23 Roll Flutter Engine from 3b5fb86a5982 to 6295d9198da1 (3 revisions) (flutter/flutter#117576) * 3eca29b f2a071692 Roll Skia from 3e39affa3e1d to 45466d04ca49 (1 revision) (flutter/engine#38480) (flutter/flutter#117579) * 05914e7 948d0bffa Roll Dart SDK from 47f192463696 to 442614a6c1bb (1 revision) (flutter/engine#38481) (flutter/flutter#117581) * a34dec2 00995b7b9 Roll Skia from 45466d04ca49 to e206aa0c44f0 (4 revisions) (flutter/engine#38482) (flutter/flutter#117585) * 4ef24cf 238f40bb9 Roll Fuchsia Mac SDK from W0GUdjHi4gI48optN... to 9w7QDlttR9f7Gu7U6... (flutter/engine#38483) (flutter/flutter#117587) * a45a2f3 ad042d863 Roll Skia from e206aa0c44f0 to a8b7ce3b6391 (1 revision) (flutter/engine#38484) (flutter/flutter#117589)
* 95ff839 Roll Plugins from 54fc206 to 2dd85ec (3 revisions) (flutter/flutter#117535) * b8d5d9c Revert "Remove single-view assumption from widgets library (#117480)" (flutter/flutter#117545) * bd482eb fixes android_semantics_integration_test to expect long press for tooltip (flutter/flutter#117547) * 725c141 Fix screenshot testing for flutter web integration_test (flutter/flutter#117114) * 999356b Remove single-view assumption from ScrollPhysics (flutter/flutter#117503) * 6eb002a Reland "Remove single-view assumption from widgets library (#117480)" (flutter/flutter#117549) * 08209b7 Explain how to test onSubmitted in its docs (flutter/flutter#117550) * 20bc2ba Roll Flutter Engine from a90c45db3f13 to 234ab4c1e9c4 (1 revision) (flutter/flutter#117555) * abd5217 Bump ossf/scorecard-action from 2.1.1 to 2.1.2 (flutter/flutter#117554) * 6781576 Reland iOS 16 context menu (flutter/flutter#117234) * daa2ecf Roll Flutter Engine from 234ab4c1e9c4 to ca0c843bf75f (11 revisions) (flutter/flutter#117563) * 6441a7d Roll Flutter Engine from ca0c843bf75f to 12badb54598d (2 revisions) (flutter/flutter#117566) * a0cecbe 3b5fb86a5 delete unused lib/src/engine/canvaskit/viewport_metrics.dart (flutter/engine#38474) (flutter/flutter#117572) * fbfda23 Roll Flutter Engine from 3b5fb86a5982 to 6295d9198da1 (3 revisions) (flutter/flutter#117576) * 3eca29b f2a071692 Roll Skia from 3e39affa3e1d to 45466d04ca49 (1 revision) (flutter/engine#38480) (flutter/flutter#117579) * 05914e7 948d0bffa Roll Dart SDK from 47f192463696 to 442614a6c1bb (1 revision) (flutter/engine#38481) (flutter/flutter#117581) * a34dec2 00995b7b9 Roll Skia from 45466d04ca49 to e206aa0c44f0 (4 revisions) (flutter/engine#38482) (flutter/flutter#117585) * 4ef24cf 238f40bb9 Roll Fuchsia Mac SDK from W0GUdjHi4gI48optN... to 9w7QDlttR9f7Gu7U6... (flutter/engine#38483) (flutter/flutter#117587) * a45a2f3 ad042d863 Roll Skia from e206aa0c44f0 to a8b7ce3b6391 (1 revision) (flutter/engine#38484) (flutter/flutter#117589)
* Fix screenshot testing for flutter web integration_test * update packages * fix method signature and todo * Run tests on CI * fix type * remove silences * Add docs * fix comment * fix whitespace * review comments
* Fix screenshot testing for flutter web integration_test * update packages * fix method signature and todo * Run tests on CI * fix type * remove silences * Add docs * fix comment * fix whitespace * review comments
* 95ff839 Roll Plugins from 54fc206 to 2dd85ec (3 revisions) (flutter/flutter#117535) * b8d5d9c Revert "Remove single-view assumption from widgets library (#117480)" (flutter/flutter#117545) * bd482eb fixes android_semantics_integration_test to expect long press for tooltip (flutter/flutter#117547) * 725c141 Fix screenshot testing for flutter web integration_test (flutter/flutter#117114) * 999356b Remove single-view assumption from ScrollPhysics (flutter/flutter#117503) * 6eb002a Reland "Remove single-view assumption from widgets library (#117480)" (flutter/flutter#117549) * 08209b7 Explain how to test onSubmitted in its docs (flutter/flutter#117550) * 20bc2ba Roll Flutter Engine from a90c45db3f13 to 234ab4c1e9c4 (1 revision) (flutter/flutter#117555) * abd5217 Bump ossf/scorecard-action from 2.1.1 to 2.1.2 (flutter/flutter#117554) * 6781576 Reland iOS 16 context menu (flutter/flutter#117234) * daa2ecf Roll Flutter Engine from 234ab4c1e9c4 to ca0c843bf75f (11 revisions) (flutter/flutter#117563) * 6441a7d Roll Flutter Engine from ca0c843bf75f to 12badb54598d (2 revisions) (flutter/flutter#117566) * a0cecbe 3b5fb86a5 delete unused lib/src/engine/canvaskit/viewport_metrics.dart (flutter/engine#38474) (flutter/flutter#117572) * fbfda23 Roll Flutter Engine from 3b5fb86a5982 to 6295d9198da1 (3 revisions) (flutter/flutter#117576) * 3eca29b f2a071692 Roll Skia from 3e39affa3e1d to 45466d04ca49 (1 revision) (flutter/engine#38480) (flutter/flutter#117579) * 05914e7 948d0bffa Roll Dart SDK from 47f192463696 to 442614a6c1bb (1 revision) (flutter/engine#38481) (flutter/flutter#117581) * a34dec2 00995b7b9 Roll Skia from 45466d04ca49 to e206aa0c44f0 (4 revisions) (flutter/engine#38482) (flutter/flutter#117585) * 4ef24cf 238f40bb9 Roll Fuchsia Mac SDK from W0GUdjHi4gI48optN... to 9w7QDlttR9f7Gu7U6... (flutter/engine#38483) (flutter/flutter#117587) * a45a2f3 ad042d863 Roll Skia from e206aa0c44f0 to a8b7ce3b6391 (1 revision) (flutter/engine#38484) (flutter/flutter#117589)
Fixes #117077.
A complete example of screenshot testing still needs to be provided. This is better to be done once the screenshot testing workflow for integration tests is better thought out for web. Issue tracked at #86120.