Skip to content

feat: implement window.Vaadin.Flow.whenReady(callback) for TestBench async waiting#23739

Draft
Artur- wants to merge 1 commit intomainfrom
wait-for-vaadin-in-flow
Draft

feat: implement window.Vaadin.Flow.whenReady(callback) for TestBench async waiting#23739
Artur- wants to merge 1 commit intomainfrom
wait-for-vaadin-in-flow

Conversation

@Artur-
Copy link
Member

@Artur- Artur- commented Mar 3, 2026

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.

…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.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2026

@github-actions github-actions bot added the +0.0.1 label Mar 3, 2026
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Test Results

1 255 files  1 255 suites   1h 23m 27s ⏱️
8 518 tests 8 468 ✅ 48 💤 2 ❌
8 991 runs  8 932 ✅ 57 💤 2 ❌

For more details on these failures, see this check.

Results for commit 597eb10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant