@@ -83,6 +83,16 @@ const routes = [
8383 '/barrel-false-positive' ,
8484]
8585
86+ const routeReadyTestIds : Record < string , string > = {
87+ '/' : 'heading' ,
88+ '/leaky-server-import' : 'leaky-heading' ,
89+ '/client-only-violations' : 'client-only-heading' ,
90+ '/client-only-jsx' : 'client-only-jsx-heading' ,
91+ '/beforeload-leak' : 'beforeload-leak-heading' ,
92+ '/component-server-leak' : 'component-leak-heading' ,
93+ '/barrel-false-positive' : 'barrel-heading' ,
94+ }
95+
8696async function navigateAllRoutes (
8797 baseURL : string ,
8898 browser : Awaited < ReturnType < typeof chromium . launch > > ,
@@ -92,10 +102,27 @@ async function navigateAllRoutes(
92102
93103 for ( const route of routes ) {
94104 try {
95- await page . goto ( `${ baseURL } ${ route } ` , {
96- waitUntil : 'networkidle' ,
97- timeout : 15_000 ,
98- } )
105+ // Prefer 'networkidle' (ensures route chunks are actually fetched), but
106+ // fall back if it hangs in certain CI environments.
107+ try {
108+ await page . goto ( `${ baseURL } ${ route } ` , {
109+ waitUntil : 'networkidle' ,
110+ timeout : 15_000 ,
111+ } )
112+ } catch {
113+ await page . goto ( `${ baseURL } ${ route } ` , {
114+ waitUntil : 'load' ,
115+ timeout : 30_000 ,
116+ } )
117+ }
118+
119+ const testId = routeReadyTestIds [ route ]
120+ if ( testId ) {
121+ await page . getByTestId ( testId ) . waitFor ( { timeout : 10_000 } )
122+ }
123+
124+ // Allow any deferred transforms/logging to flush.
125+ await new Promise ( ( r ) => setTimeout ( r , 750 ) )
99126 } catch {
100127 // ignore navigation errors — we only care about server logs
101128 }
0 commit comments