@@ -15,8 +15,8 @@ const {
1515 getCiVisEvpProxyConfig
1616} = require ( '../helpers' )
1717const { FakeCiVisIntake } = require ( '../ci-visibility-intake' )
18- const webAppServer = require ( '../ci-visibility/web-app-server' )
19- const webAppServerWithRedirect = require ( '../ci-visibility/web-app-server-with-redirect' )
18+ const { createWebAppServer } = require ( '../ci-visibility/web-app-server' )
19+ const { createWebAppServerWithRedirect } = require ( '../ci-visibility/web-app-server-with-redirect' )
2020const {
2121 TEST_STATUS ,
2222 TEST_SOURCE_START ,
@@ -78,22 +78,38 @@ versions.forEach((version) => {
7878 }
7979
8080 describe ( `playwright@${ version } ` , function ( ) {
81- let cwd , receiver , childProcess , webAppPort , webPortWithRedirect
81+ let cwd , receiver , childProcess , webAppPort , webPortWithRedirect , webAppServer , webAppServerWithRedirect
8282
8383 this . retries ( 2 )
8484 this . timeout ( 80000 )
8585
8686 useSandbox ( [ `@playwright/test@${ version } ` , 'typescript' ] , true )
8787
8888 before ( function ( done ) {
89+ // Increase timeout for this hook specifically to account for slow chromium installation in CI
90+ this . timeout ( 120000 )
91+
8992 cwd = sandboxCwd ( )
9093 const { NODE_OPTIONS , ...restOfEnv } = process . env
9194 // Install chromium (configured in integration-tests/playwright.config.js)
9295 // *Be advised*: this means that we'll only be using chromium for this test suite
96+ // This will use cached browsers if available, otherwise download
9397 execSync ( 'npx playwright install chromium' , { cwd, env : restOfEnv , stdio : 'inherit' } )
94- webAppServer . listen ( 0 , ( ) => {
98+
99+ // Create fresh server instances to avoid issues with retries
100+ webAppServer = createWebAppServer ( )
101+ webAppServerWithRedirect = createWebAppServerWithRedirect ( )
102+
103+ webAppServer . listen ( 0 , ( err ) => {
104+ if ( err ) {
105+ return done ( err )
106+ }
95107 webAppPort = webAppServer . address ( ) . port
96- webAppServerWithRedirect . listen ( 0 , ( ) => {
108+
109+ webAppServerWithRedirect . listen ( 0 , ( err ) => {
110+ if ( err ) {
111+ return done ( err )
112+ }
97113 webPortWithRedirect = webAppServerWithRedirect . address ( ) . port
98114 done ( )
99115 } )
0 commit comments