@@ -85,7 +85,7 @@ test('Creates a navigation transaction inside a lazy route', async ({ page }) =>
8585} ) ;
8686
8787test ( 'Creates navigation transactions between two different lazy routes' , async ( { page } ) => {
88- // First, navigate to the "another-lazy" route
88+ // Set up transaction listeners for both navigations
8989 const firstTransactionPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
9090 return (
9191 ! ! transactionEvent ?. transaction &&
@@ -94,6 +94,14 @@ test('Creates navigation transactions between two different lazy routes', async
9494 ) ;
9595 } ) ;
9696
97+ const secondTransactionPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
98+ return (
99+ ! ! transactionEvent ?. transaction &&
100+ transactionEvent . contexts ?. trace ?. op === 'navigation' &&
101+ transactionEvent . transaction === '/lazy/inner/:id/:anotherId/:someAnotherId'
102+ ) ;
103+ } ) ;
104+
97105 await page . goto ( '/' ) ;
98106
99107 // Navigate to another lazy route first
@@ -113,14 +121,6 @@ test('Creates navigation transactions between two different lazy routes', async
113121 expect ( firstEvent . contexts ?. trace ?. op ) . toBe ( 'navigation' ) ;
114122
115123 // Now navigate from the first lazy route to the second lazy route
116- const secondTransactionPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
117- return (
118- ! ! transactionEvent ?. transaction &&
119- transactionEvent . contexts ?. trace ?. op === 'navigation' &&
120- transactionEvent . transaction === '/lazy/inner/:id/:anotherId/:someAnotherId'
121- ) ;
122- } ) ;
123-
124124 // Click the navigation link from within the first lazy route to the second lazy route
125125 const navigationToInnerFromDeep = page . locator ( 'id=navigate-to-inner-from-deep' ) ;
126126 await expect ( navigationToInnerFromDeep ) . toBeVisible ( ) ;
@@ -253,7 +253,7 @@ test('Does not send any duplicate navigation transaction names browsing between
253253
254254 // Go to root page
255255 await page . goto ( '/' ) ;
256- page . waitForTimeout ( 1000 ) ;
256+ await page . waitForTimeout ( 1000 ) ;
257257
258258 // Navigate to inner lazy route
259259 const navigationToInner = page . locator ( 'id=navigation' ) ;
@@ -337,6 +337,7 @@ test('Allows legitimate POP navigation (back/forward) after pageload completes',
337337 const navigationToLongRunning = page . locator ( 'id=navigation-to-long-running' ) ;
338338 await expect ( navigationToLongRunning ) . toBeVisible ( ) ;
339339
340+ // Set up transaction listeners for both navigations
340341 const firstNavigationPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
341342 return (
342343 ! ! transactionEvent ?. transaction &&
@@ -345,6 +346,14 @@ test('Allows legitimate POP navigation (back/forward) after pageload completes',
345346 ) ;
346347 } ) ;
347348
349+ const backNavigationPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
350+ return (
351+ ! ! transactionEvent ?. transaction &&
352+ transactionEvent . contexts ?. trace ?. op === 'navigation' &&
353+ transactionEvent . transaction === '/'
354+ ) ;
355+ } ) ;
356+
348357 await navigationToLongRunning . click ( ) ;
349358
350359 const slowLoadingContent = page . locator ( 'id=slow-loading-content' ) ;
@@ -357,14 +366,6 @@ test('Allows legitimate POP navigation (back/forward) after pageload completes',
357366
358367 // Now navigate back using browser back button (POP event)
359368 // This should create a navigation transaction since pageload is complete
360- const backNavigationPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
361- return (
362- ! ! transactionEvent ?. transaction &&
363- transactionEvent . contexts ?. trace ?. op === 'navigation' &&
364- transactionEvent . transaction === '/'
365- ) ;
366- } ) ;
367-
368369 await page . goBack ( ) ;
369370
370371 // Verify we're back at home
0 commit comments