@@ -49,6 +49,7 @@ export const test = base.extend<TestAppFixtures, WorkerAppFixtures>({
4949
5050 mainPage : async ( { electronApp } , use , testInfo : TestInfo ) => {
5151 const page = await electronApp . firstWindow ( { timeout : PROCESS_READY_TIMEOUT } ) ;
52+ const rendererUrl = 'http://localhost:1212/index.html?logLevel=debug' ;
5253
5354 console . log ( `Window URL: ${ page . url ( ) } ` ) ;
5455 const onPageError = ( err : Error ) => console . error ( `Page error: ${ err . message } ` ) ;
@@ -58,21 +59,24 @@ export const test = base.extend<TestAppFixtures, WorkerAppFixtures>({
5859 page . on ( 'pageerror' , onPageError ) ;
5960 page . on ( 'console' , onConsoleMsg ) ;
6061
61- await page . waitForLoadState ( 'domcontentloaded' ) ;
62-
6362 const readyDeadline = Date . now ( ) + PROCESS_READY_TIMEOUT ;
6463 let rootAttached = false ;
6564
6665 while ( Date . now ( ) < readyDeadline ) {
6766 const currentUrl = page . url ( ) ;
6867
69- // CI can intermittently land on chrome-error://chromewebdata/ if the renderer dev server
70- // is still finishing compilation. Re-navigate and retry until React mounts or timeout.
71- if ( currentUrl . startsWith ( 'chrome-error://' ) || currentUrl === 'about:blank' ) {
68+ // CI can intermittently land on chrome-error://chromewebdata/ if Electron opens before the
69+ // renderer navigation has fully settled. Drive the page back to the actual renderer URL and
70+ // retry until React mounts or timeout.
71+ if (
72+ currentUrl . startsWith ( 'chrome-error://' ) ||
73+ currentUrl === 'about:blank' ||
74+ ! currentUrl . startsWith ( 'http://localhost:1212/' )
75+ ) {
7276 try {
73- await page . goto ( 'http://127.0.0.1:1212/' , {
77+ await page . goto ( rendererUrl , {
7478 waitUntil : 'domcontentloaded' ,
75- timeout : 10_000 ,
79+ timeout : 15_000 ,
7680 } ) ;
7781 } catch {
7882 // Retry loop handles transient dev-server unavailability.
@@ -83,6 +87,7 @@ export const test = base.extend<TestAppFixtures, WorkerAppFixtures>({
8387 if ( remaining <= 0 ) break ;
8488
8589 try {
90+ await page . waitForLoadState ( 'domcontentloaded' ) ;
8691 await page . waitForSelector ( '#root' , {
8792 state : 'attached' ,
8893 timeout : Math . min ( 5_000 , remaining ) ,
@@ -100,6 +105,8 @@ export const test = base.extend<TestAppFixtures, WorkerAppFixtures>({
100105 ) ;
101106 }
102107
108+ console . log ( `Window URL: ${ page . url ( ) } ` ) ;
109+
103110 await use ( page ) ;
104111
105112 page . off ( 'pageerror' , onPageError ) ;
0 commit comments