@@ -22,13 +22,14 @@ test.describe('Critical Paths @smoke', () => {
2222 test . skip ( isMobile , 'Desktop navigation test - skipping on mobile viewport' )
2323
2424 const page = await BasePage . init ( playwrightPage )
25-
26- // Import setupTestPage here to avoid unused import warnings on other tests
27- const { setupTestPage } = await import ( '../../helpers/cookieHelper' )
28- await setupTestPage ( playwrightPage , '/' )
29-
3025 for ( const { url : path } of page . navigationItems ) {
31- await page . click ( `a[href="${ path } "]` )
26+ await page . goto ( '/' )
27+ const navigationComplete = page . waitForPageLoad ( )
28+ await page . navigateToPage ( path )
29+ await navigationComplete
30+ await playwrightPage . waitForFunction ( ( ) => {
31+ return ! document . documentElement . hasAttribute ( 'data-astro-transition' )
32+ } )
3233 // eslint-disable-next-line security/detect-non-literal-regexp
3334 await page . expectUrl ( new RegExp ( path ) )
3435 }
@@ -41,21 +42,26 @@ test.describe('Critical Paths @smoke', () => {
4142 test . skip ( ! isMobile , 'Mobile navigation test - skipping on desktop viewport' )
4243
4344 const page = await BasePage . init ( playwrightPage )
44- await page . goto ( '/' )
4545
4646 const navItems = page . navigationItems
4747 for ( let i = 0 ; i < navItems . length ; i ++ ) {
4848 const item = navItems [ i ]
4949 if ( ! item ) continue
5050
5151 const { url : path } = item
52+ await page . goto ( '/' )
5253
5354 // Open mobile menu before each navigation
5455 await page . click ( 'button[aria-label="toggle menu"]' )
55- await playwrightPage . waitForTimeout ( 600 ) // Wait for mobile menu animation
56+ await playwrightPage . waitForSelector ( '.menu-visible' , { state : 'visible' } )
5657
5758 // Click navigation link
59+ const navigationComplete = page . waitForPageLoad ( )
5860 await page . click ( `a[href="${ path } "]` )
61+ await navigationComplete
62+ await playwrightPage . waitForFunction ( ( ) => {
63+ return ! document . documentElement . hasAttribute ( 'data-astro-transition' )
64+ } )
5965 // eslint-disable-next-line security/detect-non-literal-regexp
6066 await page . expectUrl ( new RegExp ( path ) )
6167 }
0 commit comments