@@ -152,7 +152,7 @@ describe('browserTracingIntegration', () => {
152152 expect ( spanIsSampled ( span ! ) ) . toBe ( false ) ;
153153 } ) ;
154154
155- it ( 'starts navigation when URL changes' , ( ) => {
155+ it ( 'starts navigation when URL changes' , async ( ) => {
156156 const client = new BrowserClient (
157157 getDefaultBrowserClientOptions ( {
158158 tracesSampleRate : 1 ,
@@ -187,6 +187,9 @@ describe('browserTracingIntegration', () => {
187187
188188 WINDOW . history . pushState ( { } , '' , '/test' ) ;
189189
190+ // wait a tick to ensure everything settled
191+ await new Promise ( resolve => setTimeout ( resolve , 1 ) ) ;
192+
190193 expect ( span ! . isRecording ( ) ) . toBe ( false ) ;
191194
192195 const span2 = getActiveSpan ( ) ;
@@ -225,6 +228,9 @@ describe('browserTracingIntegration', () => {
225228
226229 WINDOW . history . pushState ( { } , '' , '/test2' ) ;
227230
231+ // wait a tick to ensure everything settled
232+ await new Promise ( resolve => setTimeout ( resolve , 1 ) ) ;
233+
228234 expect ( span2 ! . isRecording ( ) ) . toBe ( false ) ;
229235
230236 const span3 = getActiveSpan ( ) ;
@@ -861,7 +867,7 @@ describe('browserTracingIntegration', () => {
861867 expect ( propagationContext . parentSpanId ) . toEqual ( '1121201211212012' ) ;
862868 } ) ;
863869
864- it ( 'ignores the meta tag data for navigation spans' , ( ) => {
870+ it ( 'ignores the meta tag data for navigation spans' , async ( ) => {
865871 document . head . innerHTML =
866872 '<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-0">' +
867873 '<meta name="baggage" content="sentry-release=2.1.14">' ;
@@ -883,6 +889,9 @@ describe('browserTracingIntegration', () => {
883889
884890 WINDOW . history . pushState ( { } , '' , '/navigation-test' ) ;
885891
892+ // wait a tick to ensure everything settled
893+ await new Promise ( resolve => setTimeout ( resolve , 1 ) ) ;
894+
886895 const idleSpan = getActiveSpan ( ) ! ;
887896 expect ( idleSpan ) . toBeDefined ( ) ;
888897
0 commit comments