@@ -76,7 +76,7 @@ sentryTest('error during navigation has new navigation traceId', async ({ getLoc
7676
7777 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
7878
79- // ensure navigation transaction is finished
79+ // ensure pageload transaction is finished
8080 await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
8181
8282 const envelopeRequestsPromise = getMultipleSentryEnvelopeRequests < Event > ( page , 2 ) ;
@@ -112,7 +112,7 @@ sentryTest(
112112
113113 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
114114
115- // ensure navigation transaction is finished
115+ // ensure pageload transaction is finished
116116 await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
117117
118118 const navigationEvent = await getFirstSentryEnvelopeRequest < Event > ( page , `${ url } #foo` ) ;
@@ -148,7 +148,7 @@ sentryTest(
148148
149149 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
150150
151- // ensure navigation transaction is finished
151+ // ensure pageload transaction is finished
152152 await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
153153
154154 const navigationEventPromise = getFirstSentryEnvelopeRequest < Event > ( page ) ;
@@ -185,7 +185,7 @@ sentryTest(
185185
186186 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
187187
188- // ensure navigation transaction is finished
188+ // ensure pageload transaction is finished
189189 await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
190190
191191 const navigationEvent = await getFirstSentryEnvelopeRequest < Event > ( page , `${ url } #foo` ) ;
@@ -221,7 +221,7 @@ sentryTest(
221221
222222 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
223223
224- // ensure navigation transaction is finished
224+ // ensure pageload transaction is finished
225225 await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
226226
227227 const navigationEventPromise = getFirstSentryEnvelopeRequest < Event > ( page ) ;
@@ -247,3 +247,45 @@ sentryTest(
247247 ) ;
248248 } ,
249249) ;
250+
251+ sentryTest (
252+ 'user feedback event after navigation has navigation traceId in headers' ,
253+ async ( { getLocalTestPath, page } ) => {
254+ if ( shouldSkipTracingTest ( ) ) {
255+ sentryTest . skip ( ) ;
256+ }
257+
258+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
259+
260+ // ensure pageload transaction is finished
261+ await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
262+
263+ const navigationEvent = await getFirstSentryEnvelopeRequest < Event > ( page , `${ url } #foo` ) ;
264+
265+ const navigationTraceContext = navigationEvent . contexts ?. trace ;
266+ expect ( navigationTraceContext ) . toMatchObject ( {
267+ op : 'navigation' ,
268+ trace_id : expect . stringMatching ( / ^ [ 0 - 9 a - f ] { 32 } $ / ) ,
269+ span_id : expect . stringMatching ( / ^ [ 0 - 9 a - f ] { 16 } $ / ) ,
270+ } ) ;
271+ expect ( navigationTraceContext ) . not . toHaveProperty ( 'parent_span_id' ) ;
272+
273+ const feedbackEventPromise = getFirstSentryEnvelopeRequest < Event > ( page ) ;
274+
275+ await page . getByText ( 'Report a Bug' ) . click ( ) ;
276+ expect ( await page . locator ( ':visible:text-is("Report a Bug")' ) . count ( ) ) . toEqual ( 1 ) ;
277+ await page . locator ( '[name="name"]' ) . fill ( 'Jane Doe' ) ;
278+ await page . locator ( '[name="email"]' ) . fill ( '[email protected] ' ) ; 279+ await page . locator ( '[name="message"]' ) . fill ( 'my example feedback' ) ;
280+ await page . locator ( '[data-sentry-feedback] .btn--primary' ) . click ( ) ;
281+
282+ const feedbackEvent = await feedbackEventPromise ;
283+ const feedbackTraceContext = feedbackEvent . contexts ?. trace ;
284+
285+ expect ( feedbackTraceContext ) . toMatchObject ( {
286+ op : 'navigation' ,
287+ trace_id : navigationTraceContext ?. trace_id ,
288+ span_id : expect . stringMatching ( / ^ [ 0 - 9 a - f ] { 16 } $ / ) ,
289+ } ) ;
290+ } ,
291+ ) ;
0 commit comments