Skip to content

test(nuxt): Wait for hydration before clicking in error tests - #25520

Open
sentry-junior[bot] wants to merge 1 commit into
developfrom
test/nuxt-flaky-hydration-clicks
Open

sentry-junior[bot] wants to merge 1 commit into
developfrom
test/nuxt-flaky-hydration-clicks

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

The Nuxt errors.client and errors.server E2E tests sometimes time out because they click server-rendered buttons before Vue has hydrated and attached the handlers. The click gets dropped, so no request or error happens. In the failed runs, the server never even logged the /api/server-error request. The race exists because the Sentry client config is loaded through a dynamic import() in a Nuxt plugin. page.goto resolves on load, which doesn't wait for that chunk, and Nuxt doesn't mount the app until its plugins finish.

The tests now wait until #__nuxt.__vue_app__.$nuxt.isHydrating === false before clicking. That is the flag Nuxt clears once the root Suspense resolves after hydration, so it shows the handlers are attached. typeof window.__SENTRY__ === 'object' only shows that the SDK loaded, which can happen before mount. The helper replaces the one existing __SENTRY__ wait in nuxt-3-dynamic-import. I checked the race with a minimal Nuxt app whose plugin awaits a delayed dynamic chunk: clicking right after goto was a no-op, and clicking after this wait worked.

The helper is copied into each Nuxt test app because each app is a standalone package.

via Francesco Gringl-Novy.

--

View Junior Session [Sentry]

The Sentry client config is loaded through a dynamic import in a Nuxt
plugin, so Vue hydration can finish after `page.goto` resolves. Clicks on
server-rendered buttons before hydration are dropped, which made the error
tests time out waiting for an event.

Co-Authored-By: Francesco Gringl-Novy <francesco.novy@sentry.io>
@mydea
mydea marked this pull request as ready for review October 19, 2026 14:09
@mydea
mydea requested review from nicohrubec and s1gr1d October 19, 2026 14:09
@mydea mydea self-assigned this Oct 19, 2026

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants