@@ -159,7 +159,7 @@ export class PlaywrightTunnel {
159159 terminal . writeLine ( `keepRunning: ${ this . #keepRunning} ` ) ;
160160 while ( this . #keepRunning) {
161161 if ( ! this . #initWsPromise) {
162- this . #initWsPromise = this . _initPlaywrightBrowserTunnelAsync ( ) ;
162+ this . #initWsPromise = this . #initPlaywrightBrowserTunnelAsync ( ) ;
163163 } else {
164164 terminal . writeLine ( `Tunnel is already running with status: ${ this . status } ` ) ;
165165 }
@@ -197,7 +197,7 @@ export class PlaywrightTunnel {
197197 // TODO: We should implement an uninstall command to remove installed Playwright browsers
198198 // public async uninstallPlaywrightBrowsersAsync(): Promise<void> {}
199199
200- private async _runCommandAsync ( command : string , args : string [ ] ) : Promise < void > {
200+ async #runCommandAsync ( command : string , args : string [ ] ) : Promise < void > {
201201 const tmpPath : string = this . #playwrightInstallPath;
202202 await FileSystem . ensureFolderAsync ( tmpPath ) ;
203203 this . #terminal. writeLine ( `Running command: ${ command } ${ args . join ( ' ' ) } in ${ tmpPath } ` ) ;
@@ -227,30 +227,30 @@ export class PlaywrightTunnel {
227227 await Executable . waitForExitAsync ( cp , { throwOnNonZeroExitCode : true , throwOnSignal : true } ) ;
228228 }
229229
230- private async _installPlaywrightCoreAsync ( {
230+ async #installPlaywrightCoreAsync ( {
231231 playwrightVersion
232232 } : Pick < IHandshake , 'playwrightVersion' > ) : Promise < void > {
233233 this . #terminal. writeLine ( `Installing playwright-core version ${ playwrightVersion } ` ) ;
234- await this . _runCommandAsync ( 'npm' , [
234+ await this . #runCommandAsync ( 'npm' , [
235235 'install' ,
236236 `playwright-core-${ playwrightVersion } @npm:playwright-core@${ playwrightVersion } `
237237 ] ) ;
238238 }
239239
240- private async _installPlaywrightBrowsersAsync ( {
240+ async #installPlaywrightBrowsersAsync ( {
241241 playwrightVersion,
242242 browserName
243243 } : Pick < IHandshake , 'playwrightVersion' | 'browserName' > ) : Promise < void > {
244- await this . _installPlaywrightCoreAsync ( { playwrightVersion } ) ;
244+ await this . #installPlaywrightCoreAsync ( { playwrightVersion } ) ;
245245 this . #terminal. writeLine ( `Executing playwright-core version ${ playwrightVersion } ` ) ;
246- await this . _runCommandAsync ( 'node' , [
246+ await this . #runCommandAsync ( 'node' , [
247247 `node_modules/playwright-core-${ playwrightVersion } /cli.js` ,
248248 'install' ,
249249 browserName
250250 ] ) ;
251251 }
252252
253- private async _tryConnectAsync ( ) : Promise < WebSocket > {
253+ async #tryConnectAsync ( ) : Promise < WebSocket > {
254254 const wsEndpoint : string | undefined = this . #wsEndpoint;
255255 if ( ! wsEndpoint ) {
256256 throw new Error ( 'WebSocket endpoint is not defined' ) ;
@@ -269,14 +269,14 @@ export class PlaywrightTunnel {
269269
270270 // TODO: Only supporting one test at a time.
271271 // Need to support multiple simultaneous connections for parallel tests.
272- private async _pollConnectionAsync ( ) : Promise < WebSocket > {
272+ async #pollConnectionAsync ( ) : Promise < WebSocket > {
273273 this . #terminal. writeLine ( `Waiting for WebSocket connection` ) ;
274274 return await new Promise ( ( resolve , reject ) => {
275275 this . #pollInterval = setInterval ( ( ) => {
276276 if ( this . #pendingConnectionAttempt) {
277277 return ; // Skip if a connection attempt is already in progress
278278 }
279- const connectionPromise : Promise < WebSocket > = this . _tryConnectAsync ( ) ;
279+ const connectionPromise : Promise < WebSocket > = this . #tryConnectAsync ( ) ;
280280 this . #pendingConnectionAttempt = connectionPromise ;
281281 connectionPromise
282282 . then ( ( ws : WebSocket ) => {
@@ -294,7 +294,7 @@ export class PlaywrightTunnel {
294294 } ) ;
295295 }
296296
297- private async _waitForIncomingConnectionAsync ( ) : Promise < WebSocket > {
297+ async #waitForIncomingConnectionAsync ( ) : Promise < WebSocket > {
298298 this . #terminal. writeLine ( 'Waiting for incoming WebSocket connection' ) ;
299299
300300 return await new Promise < WebSocket > ( ( resolve , reject ) => {
@@ -334,7 +334,7 @@ export class PlaywrightTunnel {
334334 // TODO: If a user runs this for the first time, `this._playwrightBrowsersInstalled` will be empty
335335 // and it will try to install the browsers every time. We should persist this information. Maybe a cache file with text per
336336 // machine instance?
337- private async _setupPlaywrightAsync ( {
337+ async #setupPlaywrightAsync ( {
338338 playwrightVersion,
339339 browserName
340340 } : Pick < IHandshake , 'playwrightVersion' | 'browserName' > ) : Promise < typeof import ( 'playwright-core' ) > {
@@ -344,15 +344,15 @@ export class PlaywrightTunnel {
344344 this . #terminal. writeLine (
345345 `Playwright browser not found. Installing playwright-core version ${ playwrightVersion } `
346346 ) ;
347- await this . _installPlaywrightBrowsersAsync ( { playwrightVersion, browserName } ) ;
347+ await this . #installPlaywrightBrowsersAsync ( { playwrightVersion, browserName } ) ;
348348 this . #playwrightBrowsersInstalled. add ( browserKey ) ;
349349 }
350350
351351 this . #terminal. writeLine ( `Using playwright-core version ${ playwrightVersion } for browser server` ) ;
352352 return await import ( `${ this . #playwrightInstallPath} /node_modules/playwright-core-${ playwrightVersion } ` ) ;
353353 }
354354
355- private async _getPlaywrightBrowserServerProxyAsync ( {
355+ async #getPlaywrightBrowserServerProxyAsync ( {
356356 browserName,
357357 playwrightVersion,
358358 launchOptions
@@ -385,7 +385,7 @@ export class PlaywrightTunnel {
385385 `Launch options after validation: ${ JSON . stringify ( logOptions ) } (headless: false enforced)`
386386 ) ;
387387
388- const playwright : typeof import ( 'playwright-core' ) = await this . _setupPlaywrightAsync ( {
388+ const playwright : typeof import ( 'playwright-core' ) = await this . #setupPlaywrightAsync ( {
389389 playwrightVersion,
390390 browserName
391391 } ) ;
@@ -410,7 +410,7 @@ export class PlaywrightTunnel {
410410 } ;
411411 }
412412
413- private _validateHandshake ( rawHandshake : unknown ) : IHandshake {
413+ #validateHandshake ( rawHandshake : unknown ) : IHandshake {
414414 if (
415415 typeof rawHandshake !== 'object' ||
416416 rawHandshake === null ||
@@ -447,7 +447,7 @@ export class PlaywrightTunnel {
447447 }
448448
449449 // ws1 is the tunnel websocket, ws2 is the browser server websocket
450- private async _setupForwardingAsync ( ws1 : WebSocket , ws2 : WebSocket ) : Promise < void > {
450+ async #setupForwardingAsync ( ws1 : WebSocket , ws2 : WebSocket ) : Promise < void > {
451451 this . #terminal. writeLine ( 'Setting up message forwarding between ws1 and ws2' ) ;
452452 this . #terminal. writeLine ( ` ws1 (tunnel) readyState: ${ getWebSocketReadyStateString ( ws1 . readyState ) } ` ) ;
453453 this . #terminal. writeLine ( ` ws2 (browser) readyState: ${ getWebSocketReadyStateString ( ws2 . readyState ) } ` ) ;
@@ -519,16 +519,16 @@ export class PlaywrightTunnel {
519519 * and setting up the browser server.
520520 * Returns when the handshake is complete and the browser server is running.
521521 */
522- private async _initPlaywrightBrowserTunnelAsync ( ) : Promise < WebSocket > {
522+ async #initPlaywrightBrowserTunnelAsync ( ) : Promise < WebSocket > {
523523 let handshake : IHandshake | undefined = undefined ;
524524 let client : WebSocket | undefined = undefined ;
525525 let browserServer : BrowserServer | undefined = undefined ;
526526
527527 this . status = 'waiting-for-connection' ;
528528 const ws : WebSocket =
529529 this . #mode === 'poll-connection'
530- ? await this . _pollConnectionAsync ( )
531- : await this . _waitForIncomingConnectionAsync ( ) ;
530+ ? await this . #pollConnectionAsync ( )
531+ : await this . #waitForIncomingConnectionAsync ( ) ;
532532
533533 ws . on ( 'open' , ( ) => {
534534 this . #terminal. writeLine ( `WebSocket connection established` ) ;
@@ -564,7 +564,7 @@ export class PlaywrightTunnel {
564564 const rawHandshakeString : string = data . toString ( ) ;
565565 const rawHandshake : unknown = JSON . parse ( rawHandshakeString ) ;
566566 terminal . writeLine ( `Received handshake: ${ rawHandshakeString } ` ) ;
567- handshake = this . _validateHandshake ( rawHandshake ) ;
567+ handshake = this . #validateHandshake ( rawHandshake ) ;
568568
569569 // Call the onBeforeLaunch callback if provided
570570 if ( this . #onBeforeLaunch) {
@@ -582,7 +582,7 @@ export class PlaywrightTunnel {
582582
583583 this . status = 'setting-up-browser-server' ;
584584 const browserServerProxy : IBrowserServerProxy =
585- await this . _getPlaywrightBrowserServerProxyAsync ( handshake ) ;
585+ await this . #getPlaywrightBrowserServerProxyAsync ( handshake ) ;
586586 client = browserServerProxy . client ;
587587 browserServer = browserServerProxy . browserServer ;
588588
@@ -616,7 +616,7 @@ export class PlaywrightTunnel {
616616 await Async . sleepAsync ( 2000 ) ;
617617
618618 ws . send ( JSON . stringify ( { action : 'handshakeAck' } ) ) ;
619- await this . _setupForwardingAsync ( ws , client ) ;
619+ await this . #setupForwardingAsync ( ws , client ) ;
620620
621621 // Clean up message handler after successful handshake
622622 ws . off ( 'message' , onMessageHandler ) ;
0 commit comments