@@ -68,6 +68,7 @@ sentryTest('captures a "GOOD" CLS vital with its source as a standalone span', a
68
68
'sentry.origin' : 'auto.http.browser.cls' ,
69
69
transaction : expect . stringContaining ( 'index.html' ) ,
70
70
'user_agent.original' : expect . stringContaining ( 'Chrome' ) ,
71
+ 'sentry.pageload.span_id' : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
71
72
} ,
72
73
description : expect . stringContaining ( 'body > div#content > p' ) ,
73
74
exclusive_time : 0 ,
@@ -134,6 +135,7 @@ sentryTest('captures a "MEH" CLS vital with its source as a standalone span', as
134
135
'sentry.origin' : 'auto.http.browser.cls' ,
135
136
transaction : expect . stringContaining ( 'index.html' ) ,
136
137
'user_agent.original' : expect . stringContaining ( 'Chrome' ) ,
138
+ 'sentry.pageload.span_id' : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
137
139
} ,
138
140
description : expect . stringContaining ( 'body > div#content > p' ) ,
139
141
exclusive_time : 0 ,
@@ -198,6 +200,7 @@ sentryTest('captures a "POOR" CLS vital with its source as a standalone span.',
198
200
'sentry.origin' : 'auto.http.browser.cls' ,
199
201
transaction : expect . stringContaining ( 'index.html' ) ,
200
202
'user_agent.original' : expect . stringContaining ( 'Chrome' ) ,
203
+ 'sentry.pageload.span_id' : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
201
204
} ,
202
205
description : expect . stringContaining ( 'body > div#content > p' ) ,
203
206
exclusive_time : 0 ,
@@ -263,6 +266,7 @@ sentryTest(
263
266
'sentry.origin' : 'auto.http.browser.cls' ,
264
267
transaction : expect . stringContaining ( 'index.html' ) ,
265
268
'user_agent.original' : expect . stringContaining ( 'Chrome' ) ,
269
+ 'sentry.pageload.span_id' : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
266
270
} ,
267
271
description : 'Layout shift' ,
268
272
exclusive_time : 0 ,
@@ -306,6 +310,12 @@ sentryTest(
306
310
expect ( eventData . type ) . toBe ( 'transaction' ) ;
307
311
expect ( eventData . contexts ?. trace ?. op ) . toBe ( 'pageload' ) ;
308
312
313
+ const pageloadSpanId = eventData . contexts ?. trace ?. span_id ;
314
+ const pageloadTraceId = eventData . contexts ?. trace ?. trace_id ;
315
+
316
+ expect ( pageloadSpanId ) . toMatch ( / [ a - f 0 - 9 ] { 16 } / ) ;
317
+ expect ( pageloadTraceId ) . toMatch ( / [ a - f 0 - 9 ] { 32 } / ) ;
318
+
309
319
const spanEnvelopePromise = getMultipleSentryEnvelopeRequests < SpanEnvelope > (
310
320
page ,
311
321
1 ,
@@ -322,6 +332,10 @@ sentryTest(
322
332
// Flakey value dependent on timings -> we check for a range
323
333
expect ( spanEnvelopeItem . measurements ?. cls ?. value ) . toBeGreaterThan ( 0.05 ) ;
324
334
expect ( spanEnvelopeItem . measurements ?. cls ?. value ) . toBeLessThan ( 0.15 ) ;
335
+
336
+ // Ensure the CLS span is connected to the pageload span and trace
337
+ expect ( spanEnvelopeItem . data ?. [ 'sentry.pageload.span_id' ] ) . toBe ( pageloadSpanId ) ;
338
+ expect ( spanEnvelopeItem . trace_id ) . toEqual ( pageloadTraceId ) ;
325
339
} ,
326
340
) ;
327
341
@@ -349,6 +363,7 @@ sentryTest('sends CLS of the initial page when soft-navigating to a new page', a
349
363
// Flakey value dependent on timings -> we check for a range
350
364
expect ( spanEnvelopeItem . measurements ?. cls ?. value ) . toBeGreaterThan ( 0.05 ) ;
351
365
expect ( spanEnvelopeItem . measurements ?. cls ?. value ) . toBeLessThan ( 0.15 ) ;
366
+ expect ( spanEnvelopeItem . data ?. [ 'sentry.pageload.span_id' ] ) . toMatch ( / [ a - f 0 - 9 ] { 16 } / ) ;
352
367
} ) ;
353
368
354
369
sentryTest ( "doesn't send further CLS after the first navigation" , async ( { getLocalTestPath, page } ) => {
0 commit comments