Skip to content

fix: Fix signal effect dispatching for test environments#24041

Merged
Legioth merged 4 commits intomainfrom
effect-test-dispatch
Mar 30, 2026
Merged

fix: Fix signal effect dispatching for test environments#24041
Legioth merged 4 commits intomainfrom
effect-test-dispatch

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented Mar 29, 2026

Add registerFirst() to SignalEnvironment so test environments can take priority over VaadinServiceEnvironment for effect dispatching.

Add inner UI.getCurrent() check in ElementEffect's dispatched effect lambda so effects run directly on the test thread (where UI.getCurrent() matches the target UI) instead of going through ui.access(), which would enqueue to the session's pending access queue without executing.

Add registerFirst() to SignalEnvironment so test environments can take
priority over VaadinServiceEnvironment for effect dispatching.

Add inner UI.getCurrent() check in ElementEffect's dispatched effect
lambda so effects run directly on the test thread (where UI.getCurrent()
matches the target UI) instead of going through ui.access(), which
would enqueue to the session's pending access queue without executing.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 29, 2026

Test Results

 1 386 files  ±0   1 386 suites  ±0   1h 24m 41s ⏱️ +24s
 9 928 tests ±0   9 857 ✅ +1  71 💤 ±0  0 ❌ ±0 
10 401 runs  ±0  10 321 ✅ +1  80 💤 ±0  0 ❌ ±0 

Results for commit d46d54f. ± Comparison against base commit 1f3769a.

♻️ This comment has been updated with latest results.

@Artur-
Copy link
Copy Markdown
Member Author

Artur- commented Mar 29, 2026

Related to vaadin/browserless-test#28

Artur- added a commit that referenced this pull request Mar 30, 2026
After calling getDriver().navigate().refresh(), the test immediately
queried for the element without waiting for the page to actually reload.
This caused a NoSuchElementException when the DOM was in a transitional
state. The fix waits for the old element to become stale (confirming the
page has started unloading) and then waits for the new element to appear
before asserting on it.

Fixes #24041
@Artur- Artur- marked this pull request as ready for review March 30, 2026 07:36
@sonarqubecloud
Copy link
Copy Markdown

@Legioth Legioth added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit f5a1a9a Mar 30, 2026
31 checks passed
@Legioth Legioth deleted the effect-test-dispatch branch March 30, 2026 08:30
vaadin-bot pushed a commit that referenced this pull request Mar 30, 2026
Add registerFirst() to SignalEnvironment so test environments can take
priority over VaadinServiceEnvironment for effect dispatching.

Add inner UI.getCurrent() check in ElementEffect's dispatched effect
lambda so effects run directly on the test thread (where UI.getCurrent()
matches the target UI) instead of going through ui.access(), which would
enqueue to the session's pending access queue without executing.
vaadin-bot added a commit that referenced this pull request Mar 30, 2026
…: 25.1) (#24046)

This PR cherry-picks changes from the original PR #24041 to branch 25.1.
---
#### Original PR description
> Add registerFirst() to SignalEnvironment so test environments can take
priority over VaadinServiceEnvironment for effect dispatching.
> 
> Add inner UI.getCurrent() check in ElementEffect's dispatched effect
lambda so effects run directly on the test thread (where UI.getCurrent()
matches the target UI) instead of going through ui.access(), which would
enqueue to the session's pending access queue without executing.
>

Co-authored-by: Artur Signell <artur@vaadin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants