Skip to content
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

[webview_flutter_web] Migrate integration tests to package:web. #7115

Merged

Conversation

ditman
Copy link
Member

@ditman ditman commented Jul 13, 2024

This PR:

  • Fixes a DOM timing issue that was preventing the Legacy Widget from building.
  • Makes the integration_tests for the package less flaky, now that they seem to be timing out unexpectedly in CI.

Issues

Pre-launch Checklist

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

@ditman
Copy link
Member Author

ditman commented Jul 13, 2024

Now the non-legacy test should actually do something in CI. The legacy one is only left as a manual check. No coverage is lost, since neither of the tests were actually verifying anything earlier (the bug that is being fixed here should have been caught by a functional legacy test!)

This should also ease the Linux_web web_platform_tests_shard_3 flakes. In my machine this PR seems to not flake, unlike what's currently in the repo!

@ditman
Copy link
Member Author

ditman commented Jul 13, 2024

@ditman
Copy link
Member Author

ditman commented Jul 13, 2024

$ flutter --version
Flutter 3.22.2 • channel stable • [email protected]:flutter/flutter.git
Framework • revision 761747bfc5 (5 weeks ago) • 2024-06-05 22:15:13 +0200
Engine • revision edd8546116
Tools • Dart 3.4.3 • DevTools 2.34.3
$ flutter clean; run_integration_test.sh | ts -s
00:00:03 
00:00:03 ============================================================
00:00:03 || Running for packages/webview_flutter/webview_flutter_web
00:00:03 ============================================================
00:00:03 
00:00:03 Starting chromedriver on port 4444
00:00:03 Running command: "flutter drive -d web-server --web-port=7357 --browser-name=chrome --web-renderer=canvaskit --driver test_driver/integration_test.dart --target integration_test/webview_flutter_test.dart" in /work/flutter/packages/packages/webview_flutter/webview_flutter_web/example
00:00:03 Resolving dependencies...
00:00:04 Downloading packages...
00:00:04   collection 1.18.0 (1.19.0 available)
00:00:04   leak_tracker 10.0.4 (10.0.5 available)
00:00:04   leak_tracker_flutter_testing 3.0.3 (3.0.5 available)
00:00:04   material_color_utilities 0.8.0 (0.12.0 available)
00:00:04   meta 1.12.0 (1.15.0 available)
00:00:04   platform 3.1.4 (3.1.5 available)
00:00:04   string_scanner 1.2.0 (1.3.0 available)
00:00:04   test_api 0.7.0 (0.7.3 available)
00:00:04   vm_service 14.2.1 (14.2.4 available)
00:00:04 Got dependencies!
00:00:04 9 packages have newer versions incompatible with dependency constraints.
00:00:04 Try `flutter pub outdated` for more information.
00:00:04 Launching integration_test/webview_flutter_test.dart on Web Server in debug mode...
00:00:31 Waiting for connection from debug service on Web Server...         26.3s
00:00:31 integration_test/webview_flutter_test.dart is being served at http://localhost:7357
00:00:31 The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the Chrome or Edge devices for an improved development workflow.
00:00:38 All tests passed.
00:00:38 Application finished.
00:00:39 Stopping chromedriver
00:00:39 
00:00:39 
00:00:39 ------------------------------------------------------------
00:00:39 Run overview:
00:00:39   packages/webview_flutter/webview_flutter_web - ran
00:00:39 
00:00:39 Ran for 1 package(s)
00:00:39 
00:00:39 
00:00:39 No issues found!

vs CI. 🤷

@ditman
Copy link
Member Author

ditman commented Jul 13, 2024

The problem seems to stem from some DDC modules not being ready/available when the app starts. It doesn't always reproduce, but it can be seen when the app fails to start with --no-headless flag set:

Screenshot 2024-07-12 at 8 33 49 PM

(I've seen it also fail with a very similar trace, but complaining about IntegrationTestWidgetsFlutterBinding not being defined... Smells like a race condition! Are we attempting to start the app before the compilation is ready??)

I wonder if testing in --profile mode would yield better results (in general)

@ditman
Copy link
Member Author

ditman commented Jul 13, 2024

I wonder if testing in --profile mode would yield better results (in general)

It probably does, but we can't use that mode, because asserts don't work in --profile, and we have some tests that check that assertions are thrown.

@ditman ditman force-pushed the webview-web-rewrite-integration-tests branch from 94d9718 to 0f3ce22 Compare July 15, 2024 16:39
@ditman
Copy link
Member Author

ditman commented Jul 15, 2024

Try by inlining the bootstrap file.

@ditman
Copy link
Member Author

ditman commented Jul 15, 2024

master may have a solution for this. Updating branch.

@ditman
Copy link
Member Author

ditman commented Jul 15, 2024

(Updating master seems to have been beneficial!)

I'm going to try next to revert the inlining of the bootstrap, it might not be needed!

@ditman ditman force-pushed the webview-web-rewrite-integration-tests branch from fbb3007 to a7d9986 Compare July 15, 2024 17:43
@Rexios80
Copy link
Member

I wonder if testing in --profile mode would yield better results (in general)

It probably does, but we can't use that mode, because asserts don't work in --profile, and we have some tests that check that assertions are thrown.

@ditman Related to asserts with WASM integration tests: flutter/flutter#151426

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ditman
Copy link
Member Author

ditman commented Jul 15, 2024

Turns out the flakiness in --canvaskit mode is now fixed in master, but the fix won't be backported to the current stable (v3.22).

@stuartmorgan should I roll back the --canvaskit mode in tests until the fix lands in the next stable? Until then, web tests in stable are extra flaky. WDYT?

@ditman ditman added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 15, 2024
@auto-submit auto-submit bot merged commit 7022a44 into flutter:main Jul 15, 2024
76 checks passed
@ditman ditman deleted the webview-web-rewrite-integration-tests branch July 15, 2024 22:56
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 16, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 16, 2024
flutter/packages@4a4e63e...7022a44

2024-07-15 [email protected] [webview_flutter_web] Migrate integration tests to package:web. (flutter/packages#7115)
2024-07-15 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.10 to 3.25.12 (flutter/packages#7107)
2024-07-15 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.3.3 to 4.3.4 (flutter/packages#7071)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@stuartmorgan
Copy link
Contributor

Turns out the flakiness in --canvaskit mode is now fixed in master, but the fix won't be backported to the current stable (v3.22).

@stuartmorgan should I roll back the --canvaskit mode in tests until the fix lands in the next stable? Until then, web tests in stable are extra flaky. WDYT?

This is looking really bad on stable so far; we should make CI run canvaskit only on master ASAP.

@ditman
Copy link
Member Author

ditman commented Jul 16, 2024

Working on this right now.

@ditman
Copy link
Member Author

ditman commented Jul 17, 2024

This is looking really bad on stable so far; we should make CI run canvaskit only on master ASAP.

@stuartmorgan PR posted #7146

auto-submit bot pushed a commit that referenced this pull request Jul 17, 2024
Introduces a small fork in the `drive_examples_command` to run integration tests with `--web-renderer=html` in the `stable` channel (and `--web-renderer=canvaskit` in `master`).

This is supposed to be removed, once the current `master` rolls into `stable` (see clean-up issue referenced below).

## Issues

* Part of: flutter/flutter#143543
* Prevents flakes: #7115 (comment)
* Clean-up issue: flutter/flutter#151869
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
flutter/packages@4a4e63e...7022a44

2024-07-15 [email protected] [webview_flutter_web] Migrate integration tests to package:web. (flutter/packages#7115)
2024-07-15 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.10 to 3.25.12 (flutter/packages#7107)
2024-07-15 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.3.3 to 4.3.4 (flutter/packages#7071)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
flutter/packages@4a4e63e...7022a44

2024-07-15 [email protected] [webview_flutter_web] Migrate integration tests to package:web. (flutter/packages#7115)
2024-07-15 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.10 to 3.25.12 (flutter/packages#7107)
2024-07-15 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.3.3 to 4.3.4 (flutter/packages#7071)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: webview_flutter platform-web
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[webview_flutter_web] Legacy mode accessing DOM before it's ready.
3 participants