@@ -7,7 +7,13 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
77 // We use this to identify the transactions
88 const testTag = uuid4 ( ) ;
99
10- // no server span here!
10+ const httpServerTransactionPromise = waitForTransaction ( 'create-remix-app-express-vite-dev' , transactionEvent => {
11+ return (
12+ transactionEvent . type === 'transaction' &&
13+ transactionEvent . contexts ?. trace ?. op === 'http.server' &&
14+ transactionEvent . tags ?. [ 'sentry_test' ] === testTag
15+ ) ;
16+ } ) ;
1117
1218 const pageLoadTransactionPromise = waitForTransaction ( 'create-remix-app-express-vite-dev' , transactionEvent => {
1319 return (
@@ -20,16 +26,25 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
2026 page . goto ( `/?tag=${ testTag } ` ) ;
2127
2228 const pageloadTransaction = await pageLoadTransactionPromise ;
29+ const httpServerTransaction = await httpServerTransactionPromise ;
2330
2431 expect ( pageloadTransaction ) . toBeDefined ( ) ;
32+ expect ( httpServerTransaction ) . toBeDefined ( ) ;
33+
34+ const httpServerTraceId = httpServerTransaction . contexts ?. trace ?. trace_id ;
35+ const httpServerSpanId = httpServerTransaction . contexts ?. trace ?. span_id ;
2536
2637 const pageLoadTraceId = pageloadTransaction . contexts ?. trace ?. trace_id ;
2738 const pageLoadSpanId = pageloadTransaction . contexts ?. trace ?. span_id ;
2839 const pageLoadParentSpanId = pageloadTransaction . contexts ?. trace ?. parent_span_id ;
2940
41+ expect ( httpServerTransaction . transaction ) . toBe ( 'routes/_index' ) ;
3042 expect ( pageloadTransaction . transaction ) . toBe ( 'routes/_index' ) ;
3143
32- expect ( pageLoadTraceId ) . toBeDefined ( ) ;
33- expect ( pageLoadParentSpanId ) . toBeUndefined ( ) ;
34- expect ( pageLoadSpanId ) . toBeDefined ( ) ;
44+ expect ( httpServerTraceId ) . toBeDefined ( ) ;
45+ expect ( httpServerSpanId ) . toBeDefined ( ) ;
46+
47+ expect ( pageLoadTraceId ) . toEqual ( httpServerTraceId ) ;
48+ expect ( pageLoadParentSpanId ) . toEqual ( httpServerSpanId ) ;
49+ expect ( pageLoadSpanId ) . not . toEqual ( httpServerSpanId ) ;
3550} ) ;
0 commit comments