@@ -7,7 +7,13 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
7
7
// We use this to identify the transactions
8
8
const testTag = uuid4 ( ) ;
9
9
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
+ } ) ;
11
17
12
18
const pageLoadTransactionPromise = waitForTransaction ( 'create-remix-app-express-vite-dev' , transactionEvent => {
13
19
return (
@@ -20,16 +26,25 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
20
26
page . goto ( `/?tag=${ testTag } ` ) ;
21
27
22
28
const pageloadTransaction = await pageLoadTransactionPromise ;
29
+ const httpServerTransaction = await httpServerTransactionPromise ;
23
30
24
31
expect ( pageloadTransaction ) . toBeDefined ( ) ;
32
+ expect ( httpServerTransaction ) . toBeDefined ( ) ;
33
+
34
+ const httpServerTraceId = httpServerTransaction . contexts ?. trace ?. trace_id ;
35
+ const httpServerSpanId = httpServerTransaction . contexts ?. trace ?. span_id ;
25
36
26
37
const pageLoadTraceId = pageloadTransaction . contexts ?. trace ?. trace_id ;
27
38
const pageLoadSpanId = pageloadTransaction . contexts ?. trace ?. span_id ;
28
39
const pageLoadParentSpanId = pageloadTransaction . contexts ?. trace ?. parent_span_id ;
29
40
41
+ expect ( httpServerTransaction . transaction ) . toBe ( 'routes/_index' ) ;
30
42
expect ( pageloadTransaction . transaction ) . toBe ( 'routes/_index' ) ;
31
43
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 ) ;
35
50
} ) ;
0 commit comments