File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,28 @@ sentryTest('should create a new trace on each navigation', async ({ getLocalTest
24
24
expect ( navigation2TraceId ) . toMatch ( / ^ [ 0 - 9 a - f ] { 32 } $ / ) ;
25
25
expect ( navigation1TraceId ) . not . toEqual ( navigation2TraceId ) ;
26
26
} ) ;
27
+
28
+ sentryTest ( 'error after navigation has navigation traceId' , async ( { getLocalTestPath, page } ) => {
29
+ if ( shouldSkipTracingTest ( ) ) {
30
+ sentryTest . skip ( ) ;
31
+ }
32
+
33
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
34
+
35
+ // ensure navigation transaction is finished
36
+ await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
37
+
38
+ const navigationEvent1 = await getFirstSentryEnvelopeRequest < Event > ( page , `${ url } #foo` ) ;
39
+ expect ( navigationEvent1 . contexts ?. trace ?. op ) . toBe ( 'navigation' ) ;
40
+
41
+ const navigationTraceId = navigationEvent1 . contexts ?. trace ?. trace_id ;
42
+ expect ( navigationTraceId ) . toMatch ( / ^ [ 0 - 9 a - f ] { 32 } $ / ) ;
43
+
44
+ const [ , errorEvent ] = await Promise . all ( [
45
+ page . locator ( '#errorBtn' ) . click ( ) ,
46
+ getFirstSentryEnvelopeRequest < Event > ( page ) ,
47
+ ] ) ;
48
+
49
+ const errorTraceId = errorEvent . contexts ?. trace ?. trace_id ;
50
+ expect ( errorTraceId ) . toBe ( navigationTraceId ) ;
51
+ } ) ;
You can’t perform that action at this time.
0 commit comments