@@ -105,3 +105,52 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
105
105
expect ( pageLoadParentSpanId ) . toEqual ( loaderSpanId ) ;
106
106
expect ( pageLoadSpanId ) . not . toEqual ( httpServerSpanId ) ;
107
107
} ) ;
108
+
109
+ test ( 'Propagates trace when ErrorBoundary is triggered' , async ( { page } ) => {
110
+ // We use this to identify the transactions
111
+ const testTag = uuid4 ( ) ;
112
+
113
+ const httpServerTransactionPromise = waitForTransaction ( 'create-remix-app-express' , transactionEvent => {
114
+ return (
115
+ transactionEvent . type === 'transaction' &&
116
+ transactionEvent . contexts ?. trace ?. op === 'http' &&
117
+ transactionEvent . tags ?. [ 'sentry_test' ] === testTag
118
+ ) ;
119
+ } ) ;
120
+
121
+ const pageLoadTransactionPromise = waitForTransaction ( 'create-remix-app-express' , transactionEvent => {
122
+ return (
123
+ transactionEvent . type === 'transaction' &&
124
+ transactionEvent . contexts ?. trace ?. op === 'pageload' &&
125
+ transactionEvent . tags ?. [ 'sentry_test' ] === testTag
126
+ ) ;
127
+ } ) ;
128
+
129
+ page . goto ( `/client-error?tag=${ testTag } ` ) ;
130
+
131
+ const pageloadTransaction = await pageLoadTransactionPromise ;
132
+ const httpServerTransaction = await httpServerTransactionPromise ;
133
+
134
+ expect ( pageloadTransaction ) . toBeDefined ( ) ;
135
+ expect ( httpServerTransaction ) . toBeDefined ( ) ;
136
+
137
+ const httpServerTraceId = httpServerTransaction . contexts ?. trace ?. trace_id ;
138
+ const httpServerSpanId = httpServerTransaction . contexts ?. trace ?. span_id ;
139
+ const loaderSpanId = httpServerTransaction . spans . find (
140
+ span => span . data && span . data [ 'code.function' ] === 'loader' ,
141
+ ) ?. span_id ;
142
+
143
+ const pageLoadTraceId = pageloadTransaction . contexts ?. trace ?. trace_id ;
144
+ const pageLoadSpanId = pageloadTransaction . contexts ?. trace ?. span_id ;
145
+ const pageLoadParentSpanId = pageloadTransaction . contexts ?. trace ?. parent_span_id ;
146
+
147
+ expect ( httpServerTransaction . transaction ) . toBe ( 'GET client-error' ) ;
148
+ expect ( pageloadTransaction . transaction ) . toBe ( 'routes/client-error' ) ;
149
+
150
+ expect ( httpServerTraceId ) . toBeDefined ( ) ;
151
+ expect ( httpServerSpanId ) . toBeDefined ( ) ;
152
+
153
+ expect ( pageLoadTraceId ) . toEqual ( httpServerTraceId ) ;
154
+ expect ( pageLoadParentSpanId ) . toEqual ( loaderSpanId ) ;
155
+ expect ( pageLoadSpanId ) . not . toEqual ( httpServerSpanId ) ;
156
+ } ) ;
0 commit comments