@@ -152,7 +152,7 @@ describe('browserTracingIntegration', () => {
152
152
expect ( spanIsSampled ( span ! ) ) . toBe ( false ) ;
153
153
} ) ;
154
154
155
- it ( 'starts navigation when URL changes' , ( ) => {
155
+ it ( 'starts navigation when URL changes' , async ( ) => {
156
156
const client = new BrowserClient (
157
157
getDefaultBrowserClientOptions ( {
158
158
tracesSampleRate : 1 ,
@@ -187,6 +187,9 @@ describe('browserTracingIntegration', () => {
187
187
188
188
WINDOW . history . pushState ( { } , '' , '/test' ) ;
189
189
190
+ // wait a tick to ensure everything settled
191
+ await new Promise ( resolve => setTimeout ( resolve , 1 ) ) ;
192
+
190
193
expect ( span ! . isRecording ( ) ) . toBe ( false ) ;
191
194
192
195
const span2 = getActiveSpan ( ) ;
@@ -225,6 +228,9 @@ describe('browserTracingIntegration', () => {
225
228
226
229
WINDOW . history . pushState ( { } , '' , '/test2' ) ;
227
230
231
+ // wait a tick to ensure everything settled
232
+ await new Promise ( resolve => setTimeout ( resolve , 1 ) ) ;
233
+
228
234
expect ( span2 ! . isRecording ( ) ) . toBe ( false ) ;
229
235
230
236
const span3 = getActiveSpan ( ) ;
@@ -861,7 +867,7 @@ describe('browserTracingIntegration', () => {
861
867
expect ( propagationContext . parentSpanId ) . toEqual ( '1121201211212012' ) ;
862
868
} ) ;
863
869
864
- it ( 'ignores the meta tag data for navigation spans' , ( ) => {
870
+ it ( 'ignores the meta tag data for navigation spans' , async ( ) => {
865
871
document . head . innerHTML =
866
872
'<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-0">' +
867
873
'<meta name="baggage" content="sentry-release=2.1.14">' ;
@@ -883,6 +889,9 @@ describe('browserTracingIntegration', () => {
883
889
884
890
WINDOW . history . pushState ( { } , '' , '/navigation-test' ) ;
885
891
892
+ // wait a tick to ensure everything settled
893
+ await new Promise ( resolve => setTimeout ( resolve , 1 ) ) ;
894
+
886
895
const idleSpan = getActiveSpan ( ) ! ;
887
896
expect ( idleSpan ) . toBeDefined ( ) ;
888
897
0 commit comments