File tree Expand file tree Collapse file tree 4 files changed +36
-0
lines changed
dev-packages/e2e-tests/test-applications/nextjs-turbo Expand file tree Collapse file tree 4 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 11/// <reference types="next" />
22/// <reference types="next/image-types/global" />
3+ /// <reference types="next/navigation-types/compat/navigation" />
34
45// NOTE: This file should not be edited
56// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
Original file line number Diff line number Diff line change 1+ export default function Page ( ) {
2+ < p > Hello World!</ p > ;
3+ }
4+
5+ // getServerSideProps makes this page dynamic and allows tracing data to be inserted
6+ export async function getServerSideProps ( ) {
7+ return {
8+ props : { } ,
9+ } ;
10+ }
File renamed without changes.
Original file line number Diff line number Diff line change 1+ import { expect , test } from '@playwright/test' ;
2+ import { waitForTransaction } from '@sentry-internal/test-utils' ;
3+ import { extractTraceparentData } from '@sentry/utils' ;
4+
5+ test ( 'Should propagate traces from server to client in pages router' , async ( { page } ) => {
6+ const serverTransactionPromise = waitForTransaction ( 'nextjs-turbo' , async transactionEvent => {
7+ return transactionEvent ?. transaction === 'GET /[param]/client-trace-propagation' ;
8+ } ) ;
9+
10+ await page . goto ( `/123/client-trace-propagation` ) ;
11+
12+ const sentryTraceLocator = await page . locator ( 'meta[name="sentry-trace"]' ) ;
13+ const sentryTraceValue = await sentryTraceLocator . getAttribute ( 'content' ) ;
14+ expect ( sentryTraceValue ) . toMatch ( / ^ [ a - f 0 - 9 ] { 32 } - [ a - f 0 - 9 ] { 16 } - [ 0 - 1 ] $ / ) ;
15+
16+ const baggageLocator = await page . locator ( 'meta[name="baggage"]' ) ;
17+ const baggageValue = await baggageLocator . getAttribute ( 'content' ) ;
18+ expect ( baggageValue ) . toMatch ( / s e n t r y - p u b l i c _ k e y = / ) ;
19+
20+ const traceparentData = extractTraceparentData ( sentryTraceValue ! ) ;
21+
22+ const serverTransaction = await serverTransactionPromise ;
23+
24+ expect ( serverTransaction . contexts ?. trace ?. trace_id ) . toBe ( traceparentData ?. traceId ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments