Repository navigation
test(nuxt): Wait for hydration before clicking in error tests - #25520
Open
sentry-junior[bot] wants to merge 1 commit into
Open
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
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>
nicohrubec
approved these changes
Oct 19, 2026
This branch has not been deployed
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.
The Nuxt
errors.clientanderrors.serverE2E 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-errorrequest. The race exists because the Sentry client config is loaded through a dynamicimport()in a Nuxt plugin.page.gotoresolves onload, 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 === falsebefore 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 innuxt-3-dynamic-import. I checked the race with a minimal Nuxt app whose plugin awaits a delayed dynamic chunk: clicking right aftergotowas 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]