Skip to content

test(e2e): Add pageload connection test for cache component apps - #24741

Merged
s1gr1d merged 3 commits into
developfrom
sig/cache-component-e2e-pageload
Sep 28, 2026
Merged

s1gr1d merged 3 commits into
developfrom
sig/cache-component-e2e-pageload

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Add a test for the pageload half of the complete-trace experience under cacheComponents: the browser pageload should share a trace with the runtime server (serving) request, even though the shell is prerendered.

Reference (stale-trace stitching): #18176
The trace context should not be added to the cachable HTML.

Currently in a "failed" state (test.fail()) as trace meta tags are disabled wholesale under cacheComponents and the pageload starts a fresh trace.

Today                                   Target
server  T1: GET /pageload-tracing        server  T1: GET /pageload-tracing (trace X)
browser T2: pageload  (unrelated)        browser     pageload              (trace X)

Note for the switch flip: the inverse assertion in cacheComponents.spec.ts ("Prerendered shell does not stitch the pageload onto a stale trace") documents today's behavior and must be removed when this test starts passing.

closes #24733
Linear https://linear.app/getsentry/issue/JS-3806/pageload-connection-test-for-cache-component-apps

@s1gr1d
s1gr1d requested a review from chargome September 25, 2026 12:15
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.24 kB - -
@sentry/browser - with treeshaking flags 27.5 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.4 kB - -
@sentry/browser (incl. Tracing) 51.15 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.17 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.18 kB - -
@sentry/browser (incl. Tracing, Replay) 90.76 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.86 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.46 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.41 kB - -
@sentry/browser (incl. Feedback) 46.76 kB - -
@sentry/browser (incl. sendFeedback) 34.3 kB - -
@sentry/browser (incl. FeedbackAsync) 39.41 kB - -
@sentry/browser (incl. Metrics) 30.25 kB - -
@sentry/browser (incl. Logs) 30.51 kB - -
@sentry/browser (incl. Metrics & Logs) 31.18 kB - -
@sentry/react 31 kB - -
@sentry/react (incl. Tracing) 53.45 kB - -
@sentry/vue 36.74 kB - -
@sentry/vue (incl. Tracing) 53.7 kB - -
@sentry/svelte 29.26 kB - -
CDN Bundle 30.93 kB - -
CDN Bundle (incl. Tracing) 51.69 kB - -
CDN Bundle (incl. Logs, Metrics) 33.2 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.92 kB - -
CDN Bundle (incl. Tracing, Replay) 89.28 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.25 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.45 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.42 kB - -
CDN Bundle - uncompressed 91.4 kB - -
CDN Bundle (incl. Tracing) - uncompressed 153.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 159.73 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.54 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 273.5 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 279.44 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.13 kB - -
@sentry/nextjs (client) 55.77 kB - -
@sentry/sveltekit (client) 51.59 kB - -
@sentry/core/server 39.95 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 136.74 kB +0.02% +14 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.74 kB - -
@sentry/node - without tracing 90.68 kB +0.02% +14 B 🔺
@sentry/node - without channel injection 115.09 kB +0.01% +9 B 🔺
@sentry/aws-serverless 98.94 kB +0.01% +4 B 🔺
@sentry/cloudflare (withSentry) - minified 206.62 kB - -
@sentry/cloudflare (withSentry) 514.02 kB - -

View base workflow run

test('connects the pageload trace to the live serving request', async ({ page }) => {
test.fail();

const serverTxPromise = waitForTransaction('nextjs-16-cacheComponents', transactionEvent => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking, if this is prerendered during the build, we get no tx here right? Can we reflect this in the test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, if it would be pre-rendered during build. This page is partially pre-rendered so a server transaction should exist.

import { expect, test } from '@playwright/test';
import { waitForTransaction } from '@sentry-internal/test-utils';

// The pageload should connect to the live serving request even though the shell is prerendered

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a live serving request?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The serving request is always the one which is creating the cache, in this case the server. I'll reword that :D

@s1gr1d
s1gr1d requested a review from chargome September 28, 2026 08:01
@s1gr1d
s1gr1d merged commit 9509c9d into develop Sep 28, 2026
45 checks passed
@s1gr1d
s1gr1d deleted the sig/cache-component-e2e-pageload branch September 28, 2026 08:31
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.

pageload connection test for cache component apps

2 participants