feat: implement window.Vaadin.Flow.whenReady(callback) for TestBench async waiting#23739
Draft
feat: implement window.Vaadin.Flow.whenReady(callback) for TestBench async waiting#23739
Conversation
…async waiting Add a whenReady function that polls until the document is fully loaded, the dev server is available, and all Flow clients are idle, then invokes the callback. This gives TestBench a reliable async signal for waitForVaadin. The function is defined in a single resource file (whenReady.js) and injected into both bootstrap paths via placeholder replacement. Module files (Flow.ts, FlowBootstrap.js) do not include it since they load after the inline scripts. The dev-mode-not-ready page sets whenReady to false so TestBench can distinguish "not ready yet" from "not supported" and poll until the real page loads.
|
Test Results1 255 files 1 255 suites 1h 23m 27s ⏱️ For more details on these failures, see this check. Results for commit 597eb10. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



TestBench needs a way to know when a Flow application is fully
initialized and idle before interacting with it. Previously there was
no standard async mechanism — TestBench had to poll internal state
directly, which required repeated round-trips between the test and
the browser.
Add a whenReady function that polls until the document is fully loaded
and all Flow clients are idle, then invokes the callback. This gives
TestBench a reliable async signal for waitForVaadin, avoiding the
polling overhead.
The function is defined in a single resource file (whenReady.js) and
injected into both bootstrap paths via placeholder replacement. Module
files (Flow.ts, FlowBootstrap.js) do not include it since they load
after the inline scripts.
The dev-mode-not-ready page sets whenReady to false so TestBench can
distinguish "not ready yet" from "not supported" and poll until the
real page loads.