@@ -87,7 +87,7 @@ test('Creates a navigation transaction inside a lazy route', async ({ page }) =>
8787} ) ;
8888
8989test ( 'Creates navigation transactions between two different lazy routes' , async ( { page } ) => {
90- // First, navigate to the "another-lazy" route
90+ // Set up transaction listeners for both navigations
9191 const firstTransactionPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
9292 return (
9393 ! ! transactionEvent ?. transaction &&
@@ -96,6 +96,14 @@ test('Creates navigation transactions between two different lazy routes', async
9696 ) ;
9797 } ) ;
9898
99+ const secondTransactionPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
100+ return (
101+ ! ! transactionEvent ?. transaction &&
102+ transactionEvent . contexts ?. trace ?. op === 'navigation' &&
103+ transactionEvent . transaction === '/lazy/inner/:id/:anotherId/:someAnotherId'
104+ ) ;
105+ } ) ;
106+
99107 await page . goto ( '/' ) ;
100108
101109 // Navigate to another lazy route first
@@ -115,14 +123,6 @@ test('Creates navigation transactions between two different lazy routes', async
115123 expect ( firstEvent . contexts ?. trace ?. op ) . toBe ( 'navigation' ) ;
116124
117125 // Now navigate from the first lazy route to the second lazy route
118- const secondTransactionPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
119- return (
120- ! ! transactionEvent ?. transaction &&
121- transactionEvent . contexts ?. trace ?. op === 'navigation' &&
122- transactionEvent . transaction === '/lazy/inner/:id/:anotherId/:someAnotherId'
123- ) ;
124- } ) ;
125-
126126 // Click the navigation link from within the first lazy route to the second lazy route
127127 const navigationToInnerFromDeep = page . locator ( 'id=navigate-to-inner-from-deep' ) ;
128128 await expect ( navigationToInnerFromDeep ) . toBeVisible ( ) ;
@@ -255,7 +255,7 @@ test('Does not send any duplicate navigation transaction names browsing between
255255
256256 // Go to root page
257257 await page . goto ( '/' ) ;
258- page . waitForTimeout ( 1000 ) ;
258+ await page . waitForTimeout ( 1000 ) ;
259259
260260 // Navigate to inner lazy route
261261 const navigationToInner = page . locator ( 'id=navigation' ) ;
@@ -339,6 +339,7 @@ test('Allows legitimate POP navigation (back/forward) after pageload completes',
339339 const navigationToLongRunning = page . locator ( 'id=navigation-to-long-running' ) ;
340340 await expect ( navigationToLongRunning ) . toBeVisible ( ) ;
341341
342+ // Set up transaction listeners for both navigations
342343 const firstNavigationPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
343344 return (
344345 ! ! transactionEvent ?. transaction &&
@@ -347,6 +348,14 @@ test('Allows legitimate POP navigation (back/forward) after pageload completes',
347348 ) ;
348349 } ) ;
349350
351+ const backNavigationPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
352+ return (
353+ ! ! transactionEvent ?. transaction &&
354+ transactionEvent . contexts ?. trace ?. op === 'navigation' &&
355+ transactionEvent . transaction === '/'
356+ ) ;
357+ } ) ;
358+
350359 await navigationToLongRunning . click ( ) ;
351360
352361 const slowLoadingContent = page . locator ( 'id=slow-loading-content' ) ;
@@ -359,14 +368,6 @@ test('Allows legitimate POP navigation (back/forward) after pageload completes',
359368
360369 // Now navigate back using browser back button (POP event)
361370 // This should create a navigation transaction since pageload is complete
362- const backNavigationPromise = waitForTransaction ( 'react-router-7-lazy-routes' , async transactionEvent => {
363- return (
364- ! ! transactionEvent ?. transaction &&
365- transactionEvent . contexts ?. trace ?. op === 'navigation' &&
366- transactionEvent . transaction === '/'
367- ) ;
368- } ) ;
369-
370371 await page . goBack ( ) ;
371372
372373 // Verify we're back at home
0 commit comments