From 27fe55040dd127b1e7430dfdd7fc93e862ae32a0 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Tue, 1 Sep 2026 17:04:21 +0200 Subject: [PATCH] test(e2e): Port nextjs-15-t3 to span streaming Removes the `traceLifecycle: 'static'` pins and rewrites the two tRPC route assertions onto streamed spans. The tRPC error context assertions are unchanged, since streaming does not affect error events. Ref #23802 Co-Authored-By: Claude Opus 5 (1M context) --- .../nextjs-15-t3/sentry.client.config.ts | 1 - .../nextjs-15-t3/sentry.edge.config.ts | 1 - .../nextjs-15-t3/sentry.server.config.ts | 1 - .../nextjs-15-t3/tests/trpc-error.test.ts | 12 ++++++------ .../nextjs-15-t3/tests/trpc-mutation.test.ts | 12 ++++++------ 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.client.config.ts b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.client.config.ts index 8fcea2ae148a..6d63ba9325fe 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.client.config.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.client.config.ts @@ -3,7 +3,6 @@ import * as Sentry from '@sentry/nextjs'; Sentry.init({ - traceLifecycle: 'static', dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.edge.config.ts b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.edge.config.ts index d95683585c16..4f1cb3e93e9c 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.edge.config.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.edge.config.ts @@ -6,7 +6,6 @@ import * as Sentry from '@sentry/nextjs'; Sentry.init({ - traceLifecycle: 'static', environment: 'qa', // dynamic sampling bias to keep transactions dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, tunnel: `http://localhost:3031/`, // proxy server diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.server.config.ts b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.server.config.ts index ee00e6481622..ad780407a5b7 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.server.config.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/sentry.server.config.ts @@ -1,7 +1,6 @@ import * as Sentry from '@sentry/nextjs'; Sentry.init({ - traceLifecycle: 'static', environment: 'qa', // dynamic sampling bias to keep transactions dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, tunnel: `http://localhost:3031/`, // proxy server diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/tests/trpc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/tests/trpc-error.test.ts index 0e2b2769df36..2d28d2ebfc18 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/tests/trpc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/tests/trpc-error.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; +import { getSpanOp, waitForError, waitForStreamedSpan } from '@sentry-internal/test-utils'; test('should capture error with trpc context', async ({ page }) => { const errorEventPromise = waitForError('nextjs-15-t3', errorEvent => { @@ -35,14 +35,14 @@ test('should capture error with trpc context', async ({ page }) => { }); }); -test('should create transaction with trpc input for error', async ({ page }) => { - const trpcTransactionPromise = waitForTransaction('nextjs-15-t3', async transactionEvent => { - return transactionEvent?.transaction === 'POST /api/trpc/[trpc]'; +test('should create span with trpc input for error', async ({ page }) => { + const trpcSpanPromise = waitForStreamedSpan('nextjs-15-t3', span => { + return span.name === 'POST /api/trpc/[trpc]' && getSpanOp(span) === 'http.server' && span.is_segment; }); await page.goto('/'); await page.click('#error-button'); - const trpcTransaction = await trpcTransactionPromise; - expect(trpcTransaction).toBeDefined(); + const trpcSpan = await trpcSpanPromise; + expect(trpcSpan).toBeDefined(); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/tests/trpc-mutation.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/tests/trpc-mutation.test.ts index 1cb71e14d1a6..e853ea4e1755 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/tests/trpc-mutation.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/tests/trpc-mutation.test.ts @@ -1,16 +1,16 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/test-utils'; +import { getSpanOp, waitForStreamedSpan } from '@sentry-internal/test-utils'; -test('should create transaction with trpc input for mutation', async ({ page }) => { - const trpcTransactionPromise = waitForTransaction('nextjs-15-t3', async transactionEvent => { - return transactionEvent?.transaction === 'POST /api/trpc/[trpc]'; +test('should create span with trpc input for mutation', async ({ page }) => { + const trpcSpanPromise = waitForStreamedSpan('nextjs-15-t3', span => { + return span.name === 'POST /api/trpc/[trpc]' && getSpanOp(span) === 'http.server' && span.is_segment; }); await page.goto('/'); await page.locator('#createInput').fill('I love dogs'); await page.click('#createButton'); - const trpcTransaction = await trpcTransactionPromise; + const trpcSpan = await trpcSpanPromise; - expect(trpcTransaction).toBeDefined(); + expect(trpcSpan).toBeDefined(); });