@@ -126,7 +126,7 @@ sentryTest('error during navigation has new navigation traceId', async ({ getLoc
126
126
127
127
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
128
128
129
- // ensure navigation transaction is finished
129
+ // ensure pageload transaction is finished
130
130
await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
131
131
132
132
const envelopeRequestsPromise = getMultipleSentryEnvelopeRequests < EventAndTraceHeader > (
@@ -191,7 +191,7 @@ sentryTest(
191
191
192
192
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
193
193
194
- // ensure navigation transaction is finished
194
+ // ensure pageload transaction is finished
195
195
await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
196
196
197
197
const [ navigationEvent , navigationTraceHeader ] = await getFirstSentryEnvelopeRequest < EventAndTraceHeader > (
@@ -239,7 +239,7 @@ sentryTest(
239
239
240
240
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
241
241
242
- // ensure navigation transaction is finished
242
+ // ensure pageload transaction is finished
243
243
await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
244
244
245
245
const navigationEventPromise = getFirstSentryEnvelopeRequest < EventAndTraceHeader > (
@@ -381,3 +381,45 @@ sentryTest(
381
381
) ;
382
382
} ,
383
383
) ;
384
+
385
+ sentryTest (
386
+ 'user feedback event after navigation has navigation traceId in headers' ,
387
+ async ( { getLocalTestPath, page } ) => {
388
+ if ( shouldSkipTracingTest ( ) ) {
389
+ sentryTest . skip ( ) ;
390
+ }
391
+
392
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
393
+
394
+ // ensure pageload transaction is finished
395
+ await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
396
+
397
+ const navigationEvent = await getFirstSentryEnvelopeRequest < Event > ( page , `${ url } #foo` ) ;
398
+
399
+ const navigationTraceContext = navigationEvent . contexts ?. trace ;
400
+ expect ( navigationTraceContext ) . toMatchObject ( {
401
+ op : 'navigation' ,
402
+ trace_id : expect . stringMatching ( / ^ [ 0 - 9 a - f ] { 32 } $ / ) ,
403
+ span_id : expect . stringMatching ( / ^ [ 0 - 9 a - f ] { 16 } $ / ) ,
404
+ } ) ;
405
+ expect ( navigationTraceContext ) . not . toHaveProperty ( 'parent_span_id' ) ;
406
+
407
+ const feedbackEventPromise = getFirstSentryEnvelopeRequest < Event > ( page ) ;
408
+
409
+ await page . getByText ( 'Report a Bug' ) . click ( ) ;
410
+ expect ( await page . locator ( ':visible:text-is("Report a Bug")' ) . count ( ) ) . toEqual ( 1 ) ;
411
+ await page . locator ( '[name="name"]' ) . fill ( 'Jane Doe' ) ;
412
+ await page . locator ( '[name="email"]' ) . fill ( '[email protected] ' ) ;
413
+ await page . locator ( '[name="message"]' ) . fill ( 'my example feedback' ) ;
414
+ await page . locator ( '[data-sentry-feedback] .btn--primary' ) . click ( ) ;
415
+
416
+ const feedbackEvent = await feedbackEventPromise ;
417
+ const feedbackTraceContext = feedbackEvent . contexts ?. trace ;
418
+
419
+ expect ( feedbackTraceContext ) . toMatchObject ( {
420
+ op : 'navigation' ,
421
+ trace_id : navigationTraceContext ?. trace_id ,
422
+ span_id : expect . stringMatching ( / ^ [ 0 - 9 a - f ] { 16 } $ / ) ,
423
+ } ) ;
424
+ } ,
425
+ ) ;
0 commit comments