Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: move utils that are user in server to server/utils (2) (#34736)
Pavel Feldmanbd74fc496461
diff --git a/packages/playwright-core/package.json b/packages/playwright-core/package.jsonindex 9acacd9f12..04633f5948 100644--- a/packages/playwright-core/package.json+++ b/packages/playwright-core/package.json@@ -31,7 +31,7 @@"./lib/server/utils/image_tools/imageChannel": "./lib/server/utils/image_tools/imageChannel.js","./lib/server/utils/image_tools/colorUtils": "./lib/server/utils/image_tools/colorUtils.js","./lib/server/registry/index": "./lib/server/registry/index.js",- "./lib/utils": "./lib/utils/index.js",+ "./lib/utils": "./lib/utils.js","./lib/utilsBundle": "./lib/utilsBundle.js","./lib/zipBundle": "./lib/zipBundle.js","./types/protocol": "./types/protocol.d.ts",diff --git a/packages/playwright-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.tsindex f76f852bed..3c5244b7b0 100644--- a/packages/playwright-core/src/browserServerImpl.ts+++ b/packages/playwright-core/src/browserServerImpl.ts@@ -15,7 +15,7 @@*/import { envObjectToArray } from './client/clientHelper';-import { SocksProxy } from './common/socksProxy';+import { SocksProxy } from './server/utils/socksProxy';import { PlaywrightServer } from './remote/playwrightServer';import { helper } from './server/helper';import { serverSideCallMetadata } from './server/instrumentation';diff --git a/packages/playwright-core/src/cli/program.ts b/packages/playwright-core/src/cli/program.tsindex b79f09eb35..360ab4726f 100644--- a/packages/playwright-core/src/cli/program.ts+++ b/packages/playwright-core/src/cli/program.ts@@ -23,7 +23,8 @@ import * as path from 'path';import * as playwright from '../..';import { launchBrowserServer, printApiJson, runDriver, runServer } from './driver';import { isTargetClosedError } from '../client/errors';-import { gracefullyProcessExitDoNotHang, registry, writeDockerVersion } from '../server';+import { registry, writeDockerVersion } from '../server';+import { gracefullyProcessExitDoNotHang } from '../utils';import { runTraceInBrowser, runTraceViewerApp } from '../server/trace/viewer/traceViewer';import { assert, getPackageManagerExecCommand, isLikelyNpxGlobal } from '../utils';import { wrapInASCIIBox } from '../server/utils/ascii';diff --git a/packages/playwright-core/src/cli/programWithTestStub.ts b/packages/playwright-core/src/cli/programWithTestStub.tsindex 08a306f2f0..29b5d87ed1 100644--- a/packages/playwright-core/src/cli/programWithTestStub.ts+++ b/packages/playwright-core/src/cli/programWithTestStub.ts@@ -16,7 +16,7 @@/* eslint-disable no-console */-import { gracefullyProcessExitDoNotHang } from '../server';+import { gracefullyProcessExitDoNotHang } from '../server/utils/processLauncher';import { getPackageManager } from '../utils';import { program } from './program';export { program } from './program';diff --git a/packages/playwright-core/src/remote/playwrightConnection.ts b/packages/playwright-core/src/remote/playwrightConnection.tsindex 9817f8d295..e276873668 100644--- a/packages/playwright-core/src/remote/playwrightConnection.ts+++ b/packages/playwright-core/src/remote/playwrightConnection.ts@@ -14,14 +14,14 @@* limitations under the License.*/-import { SocksProxy } from '../common/socksProxy';+import { SocksProxy } from '../server/utils/socksProxy';import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from '../server';import { AndroidDevice } from '../server/android/android';import { Browser } from '../server/browser';import { DebugControllerDispatcher } from '../server/dispatchers/debugControllerDispatcher';import { serverSideCallMetadata } from '../server/instrumentation';import { assert, isUnderTest } from '../utils';-import { startProfiling, stopProfiling } from '../utils';+import { startProfiling, stopProfiling } from '../server/utils/profiler';import { monotonicTime } from '../utils';import { debugLogger } from '../utils/debugLogger';diff --git a/packages/playwright-core/src/remote/playwrightServer.ts b/packages/playwright-core/src/remote/playwrightServer.tsindex d3c8c0d745..06193a618a 100644--- a/packages/playwright-core/src/remote/playwrightServer.ts+++ b/packages/playwright-core/src/remote/playwrightServer.ts@@ -18,12 +18,12 @@ import { PlaywrightConnection } from './playwrightConnection';import { createPlaywright } from '../server/playwright';import { debugLogger } from '../utils/debugLogger';import { Semaphore } from '../utils/semaphore';-import { WSServer } from '../utils/wsServer';+import { WSServer } from '../server/utils/wsServer';import { wrapInASCIIBox } from '../server/utils/ascii';import { getPlaywrightVersion } from '../utils/userAgent';import type { ClientType } from './playwrightConnection';-import type { SocksProxy } from '../common/socksProxy';+import type { SocksProxy } from '../server/utils/socksProxy';import type { AndroidDevice } from '../server/android/android';import type { Browser } from '../server/browser';import type { Playwright } from '../server/playwright';diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.tsindex 9b0d81e6ab..ff5c4a826c 100644--- a/packages/playwright-core/src/server/chromium/chromium.ts+++ b/packages/playwright-core/src/server/chromium/chromium.ts@@ -27,7 +27,7 @@ import { debugMode, headersArrayToObject, headersObjectToArray, } from '../../utimport { wrapInASCIIBox } from '../utils/ascii';import { RecentLogsCollector } from '../../utils/debugLogger';import { ManualPromise } from '../../utils/manualPromise';-import { fetchData } from '../../utils/network';+import { fetchData } from '../utils/network';import { getUserAgent } from '../../utils/userAgent';import { validateBrowserContextOptions } from '../browserContext';import { BrowserType, kNoXServerRunningError } from '../browserType';@@ -41,7 +41,7 @@ import { removeFolders } from '../utils/fileUtils';import { gracefullyCloseSet } from '../utils/processLauncher';import { ProgressController } from '../progress';-import type { HTTPRequestParams } from '../../utils/network';+import type { HTTPRequestParams } from '../utils/network';import type { BrowserOptions, BrowserProcess } from '../browser';import type { CallMetadata, SdkObject } from '../instrumentation';import type { Env } from '../utils/processLauncher';diff --git a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.tsindex 1d2859af59..1b8301a1ac 100644--- a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts@@ -21,15 +21,18 @@ import { nodePlatform } from '../../utils/platform';import { getUserAgent } from '../../utils/userAgent';import { deviceDescriptors as descriptors } from '../deviceDescriptors';import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';-import { ProgressController } from '../progress';+import { Progress, ProgressController } from '../progress';import { SocksInterceptor } from '../socksInterceptor';import { WebSocketTransport } from '../transport';+import { fetchData } from '../utils/network';import type { HarBackend } from '../../utils/harBackend';import type { CallMetadata } from '../instrumentation';import type { Playwright } from '../playwright';import type { RootDispatcher } from './dispatcher';import type * as channels from '@protocol/channels';+import type * as http from 'http';+import type { HTTPRequestParams } from '../utils/network';export class LocalUtilsDispatcher extends Dispatcher<{ guid: string }, channels.LocalUtilsChannel, RootDispatcher> implements channels.LocalUtilsChannel {_type_LocalUtils: boolean;@@ -87,7 +90,7 @@ export class LocalUtilsDispatcher extends Dispatcher<{ guid: string }, channels.'x-playwright-proxy': params.exposeNetwork ?? '',...params.headers,};- const wsEndpoint = await localUtils.urlToWSEndpoint(progress, params.wsEndpoint);+ const wsEndpoint = await urlToWSEndpoint(progress, params.wsEndpoint);const transport = await WebSocketTransport.connect(progress, wsEndpoint, wsHeaders, true, 'x-playwright-debug-log');const socksInterceptor = new SocksInterceptor(transport, params.exposeNetwork, params.socksProxyRedirectPortForTest);@@ -119,3 +122,34 @@ export class LocalUtilsDispatcher extends Dispatcher<{ guid: string }, channels.}, params.timeout || 0);}}++async function urlToWSEndpoint(progress: Progress | undefined, endpointURL: string): Promise<string> {+ if (endpointURL.startsWith('ws'))+ return endpointURL;++ progress?.log(`<ws preparing> retrieving websocket url from ${endpointURL}`);+ const fetchUrl = new URL(endpointURL);+ if (!fetchUrl.pathname.endsWith('/'))+ fetchUrl.pathname += '/';+ fetchUrl.pathname += 'json';+ const json = await fetchData({+ url: fetchUrl.toString(),+ method: 'GET',+ timeout: progress?.timeUntilDeadline() ?? 30_000,+ headers: { 'User-Agent': getUserAgent() },+ }, async (params: HTTPRequestParams, response: http.IncomingMessage) => {+ return new Error(`Unexpected status ${response.statusCode} when connecting to ${fetchUrl.toString()}.\n` ++ `This does not look like a Playwright server, try connecting via ws://.`);+ });+ progress?.throwIfAborted();++ const wsUrl = new URL(endpointURL);+ let wsEndpointPath = JSON.parse(json).wsEndpointPath;+ if (wsEndpointPath.startsWith('/'))+ wsEndpointPath = wsEndpointPath.substring(1);+ if (!wsUrl.pathname.endsWith('/'))+ wsUrl.pathname += '/';+ wsUrl.pathname += wsEndpointPath;+ wsUrl.protocol = wsUrl.protocol === 'https:' ? 'wss:' : 'ws:';+ return wsUrl.toString();+}diff --git a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.tsindex d8c2081981..80a1f6a696 100644--- a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { SocksProxy } from '../../common/socksProxy';+import { SocksProxy } from '../utils/socksProxy';import { GlobalAPIRequestContext } from '../fetch';import { AndroidDispatcher } from './androidDispatcher';import { AndroidDeviceDispatcher } from './androidDispatcher';@@ -29,7 +29,7 @@ import { createGuid } from '../../utils';import { eventsHelper } from '../../utils/eventsHelper';import type { RootDispatcher } from './dispatcher';-import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../../common/socksProxy';+import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';import type { RegisteredListener } from '../../utils/eventsHelper';import type { AndroidDevice } from '../android/android';import type { Browser } from '../browser';diff --git a/packages/playwright-core/src/server/fetch.ts b/packages/playwright-core/src/server/fetch.tsindex efd67f66b1..13358856d9 100644--- a/packages/playwright-core/src/server/fetch.ts+++ b/packages/playwright-core/src/server/fetch.ts@@ -31,7 +31,7 @@ import { MultipartFormData } from './formData';import { SdkObject } from './instrumentation';import { ProgressController } from './progress';import { getMatchingTLSOptionsForOrigin, rewriteOpenSSLErrorIfNeeded } from './socksClientCertificatesInterceptor';-import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent, timingForSocket } from '../utils/happy-eyeballs';+import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent, timingForSocket } from './utils/happyEyeballs';import { Tracing } from './trace/recorder/tracing';import type { CallMetadata } from './instrumentation';diff --git a/packages/playwright-core/src/server/fileUploadUtils.ts b/packages/playwright-core/src/server/fileUploadUtils.tsindex 9ec4e76ad3..1c53812a0a 100644--- a/packages/playwright-core/src/server/fileUploadUtils.ts+++ b/packages/playwright-core/src/server/fileUploadUtils.ts@@ -17,7 +17,8 @@import * as fs from 'fs';import * as path from 'path';-import { assert, fileUploadSizeLimit } from '../utils';+import { assert } from '../utils/debug';+import { fileUploadSizeLimit } from '../utils/fileUtils';import { mime } from '../utilsBundle';import type { WritableStreamDispatcher } from './dispatchers/writableStreamDispatcher';diff --git a/packages/playwright-core/src/server/index.ts b/packages/playwright-core/src/server/index.tsindex c35615e40c..7b4033228a 100644--- a/packages/playwright-core/src/server/index.ts+++ b/packages/playwright-core/src/server/index.ts@@ -30,8 +30,3 @@ export type { DispatcherScope } from './dispatchers/dispatcher';export type { Playwright } from './playwright';export { installRootRedirect, openTraceInBrowser, openTraceViewerApp, runTraceViewerApp, startTraceViewerServer } from './trace/viewer/traceViewer';export { serverSideCallMetadata } from './instrumentation';-export { SocksProxy } from '../common/socksProxy';-export * from './utils/processLauncher';-export * from './utils/ascii';-export * from './utils/comparators';-export * from './utils/fileUtils';diff --git a/packages/playwright-core/src/server/registry/dependencies.ts b/packages/playwright-core/src/server/registry/dependencies.tsindex 8a077e5c6a..e405d75c6f 100644--- a/packages/playwright-core/src/server/registry/dependencies.ts+++ b/packages/playwright-core/src/server/registry/dependencies.ts@@ -22,7 +22,7 @@ import * as path from 'path';import { deps } from './nativeDeps';import { wrapInASCIIBox } from '../utils/ascii';import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';-import { spawnAsync } from '../../utils/spawnAsync';+import { spawnAsync } from '../utils/spawnAsync';import { getPlaywrightVersion } from '../../utils/userAgent';import { buildPlaywrightCLICommand, registry } from '.';diff --git a/packages/playwright-core/src/server/registry/index.ts b/packages/playwright-core/src/server/registry/index.tsindex 3986e152b0..87804f06dd 100644--- a/packages/playwright-core/src/server/registry/index.ts+++ b/packages/playwright-core/src/server/registry/index.ts@@ -27,8 +27,8 @@ import { calculateSha1, getAsBooleanFromENV, getFromENV, getPackageManagerExecCoimport { wrapInASCIIBox } from '../utils/ascii';import { debugLogger } from '../../utils/debugLogger';import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';-import { fetchData } from '../../utils/network';-import { spawnAsync } from '../../utils/spawnAsync';+import { fetchData } from '../utils/network';+import { spawnAsync } from '../utils/spawnAsync';import { getEmbedderName } from '../../utils/userAgent';import { lockfile } from '../../utilsBundle';import { canAccessFile, existsAsync, removeFolders } from '../utils/fileUtils';diff --git a/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts b/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.tsindex 765e5b89a8..ef6348aab2 100644--- a/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts+++ b/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts@@ -18,7 +18,7 @@ import * as fs from 'fs';import * as path from 'path';import { ManualPromise } from '../../utils/manualPromise';-import { httpRequest } from '../../utils/network';+import { httpRequest } from '../utils/network';import { extract } from '../../zipBundle';export type DownloadParams = {diff --git a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.tsindex 05e6b374c9..b1943ca123 100644--- a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts+++ b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts@@ -20,15 +20,15 @@ import * as net from 'net';import * as stream from 'stream';import * as tls from 'tls';-import { SocksProxy } from '../common/socksProxy';+import { SocksProxy } from './utils/socksProxy';import { ManualPromise, escapeHTML, generateSelfSignedCertificate, rewriteErrorMessage } from '../utils';import { verifyClientCertificates } from './browserContext';import { createProxyAgent } from './fetch';import { debugLogger } from '../utils/debugLogger';-import { createSocket, createTLSSocket } from '../utils/happy-eyeballs';+import { createSocket, createTLSSocket } from './utils/happyEyeballs';import type * as types from './types';-import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../common/socksProxy';+import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from './utils/socksProxy';import type https from 'https';let dummyServerTlsOptions: tls.TlsOptions | undefined = undefined;diff --git a/packages/playwright-core/src/server/socksInterceptor.ts b/packages/playwright-core/src/server/socksInterceptor.tsindex 61309ab11d..044c1d826a 100644--- a/packages/playwright-core/src/server/socksInterceptor.ts+++ b/packages/playwright-core/src/server/socksInterceptor.ts@@ -16,7 +16,7 @@import EventEmitter from 'events';-import * as socks from '../common/socksProxy';+import * as socks from './utils/socksProxy';import { ValidationError, findValidator } from '../protocol/validator';import type { WebSocketTransport } from './transport';diff --git a/packages/playwright-core/src/server/trace/viewer/DEPS.list b/packages/playwright-core/src/server/trace/viewer/DEPS.listindex df8177e951..cd0ac02b8a 100644--- a/packages/playwright-core/src/server/trace/viewer/DEPS.list+++ b/packages/playwright-core/src/server/trace/viewer/DEPS.list@@ -1,5 +1,6 @@[*]../../+../../utils/../../registry/../../../generated/../../../utils/diff --git a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts b/packages/playwright-core/src/server/trace/viewer/traceViewer.tsindex e380625957..e0f05bac41 100644--- a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts+++ b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts@@ -17,9 +17,9 @@import * as fs from 'fs';import * as path from 'path';-import { gracefullyProcessExitDoNotHang } from '../../../server';+import { gracefullyProcessExitDoNotHang } from '../../../utils';import { isUnderTest } from '../../../utils';-import { HttpServer } from '../../../utils/httpServer';+import { HttpServer } from '../../utils/httpServer';import { open } from '../../../utilsBundle';import { serverSideCallMetadata } from '../../instrumentation';import { syncLocalStorageWithSettings } from '../../launchApp';@@ -27,7 +27,7 @@ import { launchApp } from '../../launchApp';import { createPlaywright } from '../../playwright';import { ProgressController } from '../../progress';-import type { Transport } from '../../../utils/httpServer';+import type { Transport } from '../../utils/httpServer';import type { BrowserType } from '../../browserType';import type { Page } from '../../page';diff --git a/packages/playwright-core/src/server/transport.ts b/packages/playwright-core/src/server/transport.tsindex 6de9f9ca8e..ec2caec0c5 100644--- a/packages/playwright-core/src/server/transport.ts+++ b/packages/playwright-core/src/server/transport.ts@@ -16,7 +16,7 @@*/import { makeWaitForNextTask } from '../utils';-import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent } from '../utils/happy-eyeballs';+import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent } from './utils/happyEyeballs';import { ws } from '../utilsBundle';import type { WebSocket } from '../utilsBundle';diff --git a/packages/playwright-core/src/utils/happy-eyeballs.ts b/packages/playwright-core/src/server/utils/happyEyeballs.tssimilarity index 97%rename from packages/playwright-core/src/utils/happy-eyeballs.tsrename to packages/playwright-core/src/server/utils/happyEyeballs.tsindex 48e1909371..ba6188f97c 100644--- a/packages/playwright-core/src/utils/happy-eyeballs.ts+++ b/packages/playwright-core/src/server/utils/happyEyeballs.ts@@ -20,9 +20,9 @@ import * as https from 'https';import * as net from 'net';import * as tls from 'tls';-import { assert } from './debug';-import { ManualPromise } from './manualPromise';-import { monotonicTime } from './time';+import { assert } from '../../utils/debug';+import { ManualPromise } from '../../utils/manualPromise';+import { monotonicTime } from '../../utils/time';// Implementation(partial) of Happy Eyeballs 2 algorithm described in// https://www.rfc-editor.org/rfc/rfc8305diff --git a/packages/playwright-core/src/utils/httpServer.ts b/packages/playwright-core/src/server/utils/httpServer.tssimilarity index 97%rename from packages/playwright-core/src/utils/httpServer.tsrename to packages/playwright-core/src/server/utils/httpServer.tsindex 71b0754b8f..ee170eca33 100644--- a/packages/playwright-core/src/utils/httpServer.ts+++ b/packages/playwright-core/src/server/utils/httpServer.ts@@ -17,10 +17,10 @@import * as fs from 'fs';import * as path from 'path';-import { mime, wsServer } from '../utilsBundle';-import { createGuid } from './crypto';-import { assert } from './debug';-import { ManualPromise } from './manualPromise';+import { mime, wsServer } from '../../utilsBundle';+import { createGuid } from '../../utils/crypto';+import { assert } from '../../utils/debug';+import { ManualPromise } from '../../utils/manualPromise';import { createHttpServer } from './network';import type http from 'http';diff --git a/packages/playwright-core/src/utils/network.ts b/packages/playwright-core/src/server/utils/network.tssimilarity index 98%rename from packages/playwright-core/src/utils/network.tsrename to packages/playwright-core/src/server/utils/network.tsindex 5c5b851705..3b9d0ccfad 100644--- a/packages/playwright-core/src/utils/network.ts+++ b/packages/playwright-core/src/server/utils/network.ts@@ -20,9 +20,8 @@ import * as http2 from 'http2';import * as https from 'https';import * as url from 'url';-import { getProxyForUrl } from '../utilsBundle';-import { HttpsProxyAgent } from '../utilsBundle';-import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent } from './happy-eyeballs';+import { HttpsProxyAgent, getProxyForUrl } from '../../utilsBundle';+import { httpHappyEyeballsAgent, httpsHappyEyeballsAgent } from './happyEyeballs';import type net from 'net';diff --git a/packages/playwright-core/src/utils/profiler.ts b/packages/playwright-core/src/server/utils/profiler.tssimilarity index 100%rename from packages/playwright-core/src/utils/profiler.tsrename to packages/playwright-core/src/server/utils/profiler.tsdiff --git a/packages/playwright-core/src/common/socksProxy.ts b/packages/playwright-core/src/server/utils/socksProxy.tssimilarity index 99%rename from packages/playwright-core/src/common/socksProxy.tsrename to packages/playwright-core/src/server/utils/socksProxy.tsindex 632e698dc2..f5eb9eec1a 100644--- a/packages/playwright-core/src/common/socksProxy.ts+++ b/packages/playwright-core/src/server/utils/socksProxy.ts@@ -17,9 +17,9 @@import EventEmitter from 'events';import * as net from 'net';-import { assert, createGuid, } from '../utils';-import { debugLogger } from '../utils/debugLogger';-import { createSocket } from '../utils/happy-eyeballs';+import { assert, createGuid, } from '../../utils';+import { debugLogger } from '../../utils/debugLogger';+import { createSocket } from './happyEyeballs';import type { AddressInfo } from 'net';diff --git a/packages/playwright-core/src/utils/spawnAsync.ts b/packages/playwright-core/src/server/utils/spawnAsync.tssimilarity index 100%rename from packages/playwright-core/src/utils/spawnAsync.tsrename to packages/playwright-core/src/server/utils/spawnAsync.tsdiff --git a/packages/playwright-core/src/utils/wsServer.ts b/packages/playwright-core/src/server/utils/wsServer.tssimilarity index 95%rename from packages/playwright-core/src/utils/wsServer.tsrename to packages/playwright-core/src/server/utils/wsServer.tsindex f6ba7f6b1b..b223802a1b 100644--- a/packages/playwright-core/src/utils/wsServer.ts+++ b/packages/playwright-core/src/server/utils/wsServer.ts@@ -14,11 +14,11 @@* limitations under the License.*/-import { createHttpServer } from '../utils';-import { wsServer } from '../utilsBundle';-import { debugLogger } from './debugLogger';+import { createHttpServer } from './network';+import { wsServer } from '../../utilsBundle';+import { debugLogger } from '../../utils/debugLogger';-import type { WebSocket, WebSocketServer } from '../utilsBundle';+import type { WebSocket, WebSocketServer } from '../../utilsBundle';import type http from 'http';import type stream from 'stream';diff --git a/packages/playwright-core/src/utils.ts b/packages/playwright-core/src/utils.tsnew file mode 100644index 0000000000..930acae092--- /dev/null+++ b/packages/playwright-core/src/utils.ts@@ -0,0 +1,51 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++export * from './utils/crypto';+export * from './utils/debug';+export * from './utils/debugLogger';+export * from './utils/env';+export * from './utils/eventsHelper';+export * from './utils/expectUtils';+export * from './utils/headers';+export * from './utils/hostPlatform';+export * from './utils/manualPromise';+export * from './utils/isomorphic/locatorGenerators';+export * from './utils/isomorphic/mimeType';+export * from './utils/isomorphic/stringUtils';+export * from './utils/isomorphic/urlMatch';+export * from './utils/multimap';+export * from './utils/rtti';+export * from './utils/semaphore';+export * from './utils/stackTrace';+export * from './utils/task';+export * from './utils/time';+export * from './utils/timeoutRunner';+export * from './utils/traceUtils';+export * from './utils/userAgent';+export * from './utils/zipFile';+export * from './utils/zones';++export * from './server/utils/socksProxy';+export * from './server/utils/processLauncher';+export * from './server/utils/ascii';+export * from './server/utils/comparators';+export * from './server/utils/fileUtils';+export * from './server/utils/httpServer';+export * from './server/utils/network';+export * from './server/utils/profiler';+export * from './server/utils/wsServer';+export * from './server/utils/spawnAsync';diff --git a/packages/playwright-core/src/utils/index.ts b/packages/playwright-core/src/utils/index.tsdeleted file mode 100644index 70ec0e450b..0000000000--- a/packages/playwright-core/src/utils/index.ts+++ /dev/null@@ -1,46 +0,0 @@-/**- * Copyright (c) Microsoft Corporation.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--export * from './crypto';-export * from './debug';-export * from './debugLogger';-export * from './env';-export * from './eventsHelper';-export * from './expectUtils';-export * from './fileUtils';-export * from './headers';-export * from './hostPlatform';-export * from './httpServer';-export * from './manualPromise';-export * from './isomorphic/locatorGenerators';-export * from './isomorphic/mimeType';-export * from './isomorphic/stringUtils';-export * from './isomorphic/urlMatch';-export * from './multimap';-export * from './network';-export * from './profiler';-export * from './rtti';-export * from './semaphore';-export * from './spawnAsync';-export * from './stackTrace';-export * from './task';-export * from './time';-export * from './timeoutRunner';-export * from './traceUtils';-export * from './userAgent';-export * from './wsServer';-export * from './zipFile';-export * from './zones';diff --git a/packages/playwright-core/src/utils/localUtils.ts b/packages/playwright-core/src/utils/localUtils.tsindex 0a895dd3e7..d94a7da27e 100644--- a/packages/playwright-core/src/utils/localUtils.ts+++ b/packages/playwright-core/src/utils/localUtils.ts@@ -21,21 +21,15 @@ import * as path from 'path';import { removeFolders } from './fileUtils';import { HarBackend } from './harBackend';import { ManualPromise } from './manualPromise';-import { fetchData } from './network';-import { getUserAgent } from './userAgent';import { ZipFile } from './zipFile';import { yauzl, yazl } from '../zipBundle';+import { serializeClientSideCallMetadata } from '../utils';+import { assert, calculateSha1 } from '../utils';-import { serializeClientSideCallMetadata } from '.';-import { assert, calculateSha1 } from '.';--import type { HTTPRequestParams } from './network';import type { Platform } from './platform';-import type { Progress } from '../common/progress';import type * as channels from '@protocol/channels';import type * as har from '@trace/har';import type EventEmitter from 'events';-import type http from 'http';export type StackSession = {@@ -215,34 +209,3 @@ export async function addStackToTracingNoReply(stackSessions: Map<string, StackS}}}--export async function urlToWSEndpoint(progress: Progress | undefined, endpointURL: string): Promise<string> {- if (endpointURL.startsWith('ws'))- return endpointURL;-- progress?.log(`<ws preparing> retrieving websocket url from ${endpointURL}`);- const fetchUrl = new URL(endpointURL);- if (!fetchUrl.pathname.endsWith('/'))- fetchUrl.pathname += '/';- fetchUrl.pathname += 'json';- const json = await fetchData({- url: fetchUrl.toString(),- method: 'GET',- timeout: progress?.timeUntilDeadline() ?? 30_000,- headers: { 'User-Agent': getUserAgent() },- }, async (params: HTTPRequestParams, response: http.IncomingMessage) => {- return new Error(`Unexpected status ${response.statusCode} when connecting to ${fetchUrl.toString()}.\n` +- `This does not look like a Playwright server, try connecting via ws://.`);- });- progress?.throwIfAborted();-- const wsUrl = new URL(endpointURL);- let wsEndpointPath = JSON.parse(json).wsEndpointPath;- if (wsEndpointPath.startsWith('/'))- wsEndpointPath = wsEndpointPath.substring(1);- if (!wsUrl.pathname.endsWith('/'))- wsUrl.pathname += '/';- wsUrl.pathname += wsEndpointPath;- wsUrl.protocol = wsUrl.protocol === 'https:' ? 'wss:' : 'ws:';- return wsUrl.toString();-}diff --git a/packages/playwright-core/src/utils/timeoutRunner.ts b/packages/playwright-core/src/utils/timeoutRunner.tsindex 622019565a..e8f128b9f8 100644--- a/packages/playwright-core/src/utils/timeoutRunner.ts+++ b/packages/playwright-core/src/utils/timeoutRunner.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { monotonicTime } from './';+import { monotonicTime } from '../utils';export async function raceAgainstDeadline<T>(cb: () => Promise<T>, deadline: number): Promise<{ result: T, timedOut: false } | { timedOut: true }> {let timer: NodeJS.Timeout | undefined;diff --git a/packages/playwright-ct-core/src/vitePlugin.ts b/packages/playwright-ct-core/src/vitePlugin.tsindex 038143cdb8..0e2091b928 100644--- a/packages/playwright-ct-core/src/vitePlugin.ts+++ b/packages/playwright-ct-core/src/vitePlugin.ts@@ -21,7 +21,8 @@ import { setExternalDependencies } from 'playwright/lib/transform/compilationCacimport { resolveHook } from 'playwright/lib/transform/transform';import { removeDirAndLogToConsole } from 'playwright/lib/util';import { stoppable } from 'playwright/lib/utilsBundle';-import { assert, calculateSha1, getPlaywrightVersion, isURLAvailable } from 'playwright-core/lib/utils';+import { isURLAvailable } from 'playwright-core/lib/utils';+import { assert, calculateSha1, getPlaywrightVersion } from 'playwright-core/lib/utils';import { debug } from 'playwright-core/lib/utilsBundle';import { runDevServer } from './devServer';diff --git a/packages/playwright/src/common/configLoader.ts b/packages/playwright/src/common/configLoader.tsindex 31f5ffc269..440bf083fb 100644--- a/packages/playwright/src/common/configLoader.ts+++ b/packages/playwright/src/common/configLoader.ts@@ -17,7 +17,7 @@import * as fs from 'fs';import * as path from 'path';-import { gracefullyProcessExitDoNotHang } from 'playwright-core/lib/server';+import { gracefullyProcessExitDoNotHang } from 'playwright-core/lib/utils';import { isRegExp } from 'playwright-core/lib/utils';import { requireOrImport, setSingleTSConfig, setTransformConfig } from '../transform/transform';diff --git a/packages/playwright/src/common/suiteUtils.ts b/packages/playwright/src/common/suiteUtils.tsindex 1422494b91..d229e62732 100644--- a/packages/playwright/src/common/suiteUtils.ts+++ b/packages/playwright/src/common/suiteUtils.ts@@ -16,8 +16,7 @@import * as path from 'path';-import { toPosixPath } from 'playwright-core/lib/server';-import { calculateSha1 } from 'playwright-core/lib/utils';+import { calculateSha1, toPosixPath } from 'playwright-core/lib/utils';import { createFileMatcher } from '../util';diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.tsindex 313c548c62..9b0fb456ab 100644--- a/packages/playwright/src/index.ts+++ b/packages/playwright/src/index.ts@@ -18,8 +18,7 @@ import * as fs from 'fs';import * as path from 'path';import * as playwrightLibrary from 'playwright-core';-import { jsonStringifyForceASCII } from 'playwright-core/lib/server';-import { addInternalStackPrefix, asLocator, createGuid, debugMode, isString, zones } from 'playwright-core/lib/utils';+import { addInternalStackPrefix, asLocator, createGuid, debugMode, isString, jsonStringifyForceASCII, zones } from 'playwright-core/lib/utils';import { currentTestInfo } from './common/globals';import { rootTestType } from './common/testType';diff --git a/packages/playwright/src/matchers/toMatchAriaSnapshot.ts b/packages/playwright/src/matchers/toMatchAriaSnapshot.tsindex fdc791d073..1ad5777871 100644--- a/packages/playwright/src/matchers/toMatchAriaSnapshot.ts+++ b/packages/playwright/src/matchers/toMatchAriaSnapshot.ts@@ -18,8 +18,7 @@import * as fs from 'fs';import * as path from 'path';-import { sanitizeForFilePath } from 'playwright-core/lib/server';-import { escapeTemplateString, isString } from 'playwright-core/lib/utils';+import { escapeTemplateString, isString, sanitizeForFilePath } from 'playwright-core/lib/utils';import { kNoElementsFoundError, matcherHint } from './matcherHint';import { EXPECTED_COLOR } from '../common/expectBundle';diff --git a/packages/playwright/src/matchers/toMatchSnapshot.ts b/packages/playwright/src/matchers/toMatchSnapshot.tsindex 42d210b8f2..220c948887 100644--- a/packages/playwright/src/matchers/toMatchSnapshot.ts+++ b/packages/playwright/src/matchers/toMatchSnapshot.ts@@ -17,9 +17,7 @@import * as fs from 'fs';import * as path from 'path';-import { sanitizeForFilePath } from 'playwright-core/lib/server';-import { compareBuffersOrStrings, getComparator } from 'playwright-core/lib/server';-import { isString } from 'playwright-core/lib/utils';+import { compareBuffersOrStrings, getComparator, isString, sanitizeForFilePath } from 'playwright-core/lib/utils';import { colors } from 'playwright-core/lib/utilsBundle';import { mime } from 'playwright-core/lib/utilsBundle';@@ -38,7 +36,7 @@ import type { FullProjectInternal } from '../common/config';import type { TestInfoImpl, TestStepInfoImpl } from '../worker/testInfo';import type { Locator, Page } from 'playwright-core';import type { ExpectScreenshotOptions, Page as PageEx } from 'playwright-core/lib/client/page';-import type { Comparator, ImageComparatorOptions } from 'playwright-core/lib/server';+import type { Comparator, ImageComparatorOptions } from 'playwright-core/lib/utils';type NameOrSegments = string | string[];const snapshotNamesSymbol = Symbol('snapshotNames');diff --git a/packages/playwright/src/plugins/webServerPlugin.ts b/packages/playwright/src/plugins/webServerPlugin.tsindex e3103faaa8..62583c303e 100644--- a/packages/playwright/src/plugins/webServerPlugin.ts+++ b/packages/playwright/src/plugins/webServerPlugin.ts@@ -16,8 +16,7 @@import * as net from 'net';import * as path from 'path';-import { launchProcess } from 'playwright-core/lib/server';-import { isURLAvailable, monotonicTime, raceAgainstDeadline } from 'playwright-core/lib/utils';+import { launchProcess, isURLAvailable, monotonicTime, raceAgainstDeadline } from 'playwright-core/lib/utils';import { colors, debug } from 'playwright-core/lib/utilsBundle';import type { TestRunnerPlugin } from '.';diff --git a/packages/playwright/src/program.ts b/packages/playwright/src/program.tsindex 7aef21faee..19eabe6517 100644--- a/packages/playwright/src/program.ts+++ b/packages/playwright/src/program.ts@@ -20,8 +20,7 @@ import * as fs from 'fs';import * as path from 'path';import { program } from 'playwright-core/lib/cli/program';-import { gracefullyProcessExitDoNotHang } from 'playwright-core/lib/server';-import { startProfiling, stopProfiling } from 'playwright-core/lib/utils';+import { gracefullyProcessExitDoNotHang, startProfiling, stopProfiling } from 'playwright-core/lib/utils';import { builtInReporters, defaultReporter, defaultTimeout } from './common/config';import { loadConfigFromFileRestartIfNeeded, loadEmptyConfigForMergeReports, resolveConfigLocation } from './common/configLoader';diff --git a/packages/playwright/src/reporters/blob.ts b/packages/playwright/src/reporters/blob.tsindex 434ab8f798..7c17d91ab5 100644--- a/packages/playwright/src/reporters/blob.ts+++ b/packages/playwright/src/reporters/blob.ts@@ -18,7 +18,7 @@ import * as fs from 'fs';import * as path from 'path';import { Readable } from 'stream';-import { removeFolders, sanitizeForFilePath } from 'playwright-core/lib/server';+import { removeFolders, sanitizeForFilePath } from 'playwright-core/lib/utils';import { ManualPromise, calculateSha1, createGuid, getUserAgent } from 'playwright-core/lib/utils';import { mime } from 'playwright-core/lib/utilsBundle';import { yazl } from 'playwright-core/lib/zipBundle';diff --git a/packages/playwright/src/reporters/html.ts b/packages/playwright/src/reporters/html.tsindex 5583bb7316..3390a71746 100644--- a/packages/playwright/src/reporters/html.ts+++ b/packages/playwright/src/reporters/html.ts@@ -18,8 +18,7 @@ import * as fs from 'fs';import * as path from 'path';import { Transform } from 'stream';-import { copyFileAndMakeWritable, gracefullyProcessExitDoNotHang, removeFolders, sanitizeForFilePath, toPosixPath } from 'playwright-core/lib/server';-import { HttpServer, MultiMap, assert, calculateSha1, getPackageManagerExecCommand } from 'playwright-core/lib/utils';+import { HttpServer, MultiMap, assert, calculateSha1, getPackageManagerExecCommand, copyFileAndMakeWritable, gracefullyProcessExitDoNotHang, removeFolders, sanitizeForFilePath, toPosixPath } from 'playwright-core/lib/utils';import { colors, open } from 'playwright-core/lib/utilsBundle';import { mime } from 'playwright-core/lib/utilsBundle';import { yazl } from 'playwright-core/lib/zipBundle';diff --git a/packages/playwright/src/reporters/json.ts b/packages/playwright/src/reporters/json.tsindex cd3ec41b31..db40750d36 100644--- a/packages/playwright/src/reporters/json.ts+++ b/packages/playwright/src/reporters/json.ts@@ -17,8 +17,7 @@import * as fs from 'fs';import * as path from 'path';-import { toPosixPath } from 'playwright-core/lib/server';-import { MultiMap } from 'playwright-core/lib/utils';+import { toPosixPath, MultiMap } from 'playwright-core/lib/utils';import { formatError, nonTerminalScreen, prepareErrorStack, resolveOutputFile } from './base';import { getProjectId } from '../common/config';diff --git a/packages/playwright/src/runner/tasks.ts b/packages/playwright/src/runner/tasks.tsindex 77b1f34a52..d6dccef0e5 100644--- a/packages/playwright/src/runner/tasks.ts+++ b/packages/playwright/src/runner/tasks.ts@@ -18,8 +18,7 @@ import * as fs from 'fs';import * as path from 'path';import { promisify } from 'util';-import { removeFolders } from 'playwright-core/lib/server';-import { monotonicTime } from 'playwright-core/lib/utils';+import { monotonicTime, removeFolders } from 'playwright-core/lib/utils';import { debug } from 'playwright-core/lib/utilsBundle';import { Dispatcher } from './dispatcher';diff --git a/packages/playwright/src/runner/testServer.ts b/packages/playwright/src/runner/testServer.tsindex efa19c1882..4b11ac7af4 100644--- a/packages/playwright/src/runner/testServer.ts+++ b/packages/playwright/src/runner/testServer.ts@@ -17,8 +17,8 @@import * as fs from 'fs';import * as path from 'path';-import { gracefullyProcessExitDoNotHang, installRootRedirect, openTraceInBrowser, openTraceViewerApp, registry, startTraceViewerServer } from 'playwright-core/lib/server';-import { ManualPromise, isUnderTest } from 'playwright-core/lib/utils';+import { installRootRedirect, openTraceInBrowser, openTraceViewerApp, registry, startTraceViewerServer } from 'playwright-core/lib/server';+import { ManualPromise, isUnderTest, gracefullyProcessExitDoNotHang } from 'playwright-core/lib/utils';import { open } from 'playwright-core/lib/utilsBundle';import { createErrorCollectingReporter, createReporterForTestServer, createReporters } from './reporters';diff --git a/packages/playwright/src/runner/workerHost.ts b/packages/playwright/src/runner/workerHost.tsindex e6c97e45a6..d92093e72b 100644--- a/packages/playwright/src/runner/workerHost.ts+++ b/packages/playwright/src/runner/workerHost.ts@@ -17,7 +17,7 @@import * as fs from 'fs';import * as path from 'path';-import { removeFolders } from 'playwright-core/lib/server';+import { removeFolders } from 'playwright-core/lib/utils';import { ProcessHost } from './processHost';import { stdioChunkToParams } from '../common/ipc';diff --git a/packages/playwright/src/util.ts b/packages/playwright/src/util.tsindex 571c091b73..aa575710e5 100644--- a/packages/playwright/src/util.ts+++ b/packages/playwright/src/util.ts@@ -19,7 +19,7 @@ import * as path from 'path';import * as url from 'url';import util from 'util';-import { sanitizeForFilePath } from 'playwright-core/lib/server';+import { sanitizeForFilePath } from 'playwright-core/lib/utils';import { calculateSha1, formatCallLog, isRegExp, isString, stringifyStackFrames } from 'playwright-core/lib/utils';import { parseStackTraceLine } from 'playwright-core/lib/utils';import { debug, mime, minimatch } from 'playwright-core/lib/utilsBundle';diff --git a/packages/playwright/src/worker/testInfo.ts b/packages/playwright/src/worker/testInfo.tsindex 002c126487..5e964af5e0 100644--- a/packages/playwright/src/worker/testInfo.ts+++ b/packages/playwright/src/worker/testInfo.ts@@ -17,8 +17,7 @@import * as fs from 'fs';import * as path from 'path';-import { sanitizeForFilePath } from 'playwright-core/lib/server';-import { captureRawStack, monotonicTime, stringifyStackFrames, zones } from 'playwright-core/lib/utils';+import { captureRawStack, monotonicTime, sanitizeForFilePath, stringifyStackFrames, zones } from 'playwright-core/lib/utils';import { TimeoutManager, TimeoutManagerError, kMaxDeadline } from './timeoutManager';import { debugTest, filteredStackTrace, formatLocation, getContainedPath, normalizeAndSaveAttachment, trimLongString, windowsFilesystemFriendlyLength } from '../util';diff --git a/packages/playwright/src/worker/testTracing.ts b/packages/playwright/src/worker/testTracing.tsindex 73ae364591..a90c006616 100644--- a/packages/playwright/src/worker/testTracing.ts+++ b/packages/playwright/src/worker/testTracing.ts@@ -17,8 +17,7 @@import * as fs from 'fs';import * as path from 'path';-import { SerializedFS } from 'playwright-core/lib/server';-import { ManualPromise, calculateSha1, createGuid, monotonicTime } from 'playwright-core/lib/utils';+import { ManualPromise, SerializedFS, calculateSha1, createGuid, monotonicTime } from 'playwright-core/lib/utils';import { yauzl, yazl } from 'playwright-core/lib/zipBundle';import { filteredStackTrace } from '../util';diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.tsindex a813b0308c..5188614271 100644--- a/packages/playwright/src/worker/workerMain.ts+++ b/packages/playwright/src/worker/workerMain.ts@@ -14,9 +14,7 @@* limitations under the License.*/-import { removeFolders } from 'playwright-core/lib/server';-import { gracefullyCloseAll } from 'playwright-core/lib/server';-import { ManualPromise } from 'playwright-core/lib/utils';+import { ManualPromise, gracefullyCloseAll, removeFolders } from 'playwright-core/lib/utils';import { colors } from 'playwright-core/lib/utilsBundle';import { deserializeConfig } from '../common/configLoader';diff --git a/tests/config/proxy.ts b/tests/config/proxy.tsindex 94f2b57ed7..42910134fc 100644--- a/tests/config/proxy.ts+++ b/tests/config/proxy.ts@@ -18,8 +18,8 @@ import type { IncomingMessage } from 'http';import type { ProxyServer } from '../third_party/proxy';import { createProxy } from '../third_party/proxy';import net from 'net';-import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../../packages/playwright-core/src/common/socksProxy';-import { SocksProxy } from '../../packages/playwright-core/lib/common/socksProxy';+import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from 'playwright-core/src/server/utils/socksProxy';+import { SocksProxy } from '../../packages/playwright-core/lib/server/utils/socksProxy';// Certain browsers perform telemetry requests which we want to ignore.const kConnectHostsToIgnore = new Set([diff --git a/tests/config/serverFixtures.ts b/tests/config/serverFixtures.tsindex 12578a189f..12dad5d99b 100644--- a/tests/config/serverFixtures.ts+++ b/tests/config/serverFixtures.ts@@ -18,9 +18,9 @@ import type { Fixtures } from '@playwright/test';import path from 'path';import { TestServer } from './testserver';import { TestProxy } from './proxy';-import type { SocksSocketRequestedPayload } from '../../packages/playwright-core/src/common/socksProxy';+import type { SocksSocketRequestedPayload } from 'playwright-core/src/server/utils/socksProxy';-import { SocksProxy } from '../../packages/playwright-core/lib/common/socksProxy';+import { SocksProxy } from '../../packages/playwright-core/lib/server/utils/socksProxy';export type ServerWorkerOptions = {loopback?: string;diff --git a/tests/config/testserver/index.ts b/tests/config/testserver/index.tsindex ec7d4c1f69..b3c1a42b25 100644--- a/tests/config/testserver/index.ts+++ b/tests/config/testserver/index.ts@@ -25,7 +25,7 @@ import util from 'util';import type stream from 'stream';import ws from 'ws';import zlib, { gzip } from 'zlib';-import { createHttpServer, createHttpsServer } from '../../../packages/playwright-core/lib/utils/network';+import { createHttpServer, createHttpsServer } from '../../../packages/playwright-core/lib/server/utils/network';const fulfillSymbol = Symbol('fulfil callback');const rejectSymbol = Symbol('reject callback');diff --git a/tests/electron/globalSetup.ts b/tests/electron/globalSetup.tsindex c50f710c96..3b4021b8af 100644--- a/tests/electron/globalSetup.ts+++ b/tests/electron/globalSetup.ts@@ -15,7 +15,7 @@*/import assert from 'assert';-import { spawnAsync } from '../../packages/playwright-core/lib/utils/spawnAsync';+import { spawnAsync } from '../../packages/playwright-core/lib/server/utils/spawnAsync';export default async () => {const result = await spawnAsync('npx', ['electron', require.resolve('./electron-print-chromium-version.js'), '--no-sandbox'], {diff --git a/tests/installation/globalSetup.ts b/tests/installation/globalSetup.tsindex 214f586987..d875f8b215 100644--- a/tests/installation/globalSetup.ts+++ b/tests/installation/globalSetup.ts@@ -16,7 +16,7 @@import path from 'path';import fs from 'fs';-import { spawnAsync } from '../../packages/playwright-core/lib/utils/spawnAsync';+import { spawnAsync } from '../../packages/playwright-core/lib/server/utils/spawnAsync';import { removeFolders } from '../../packages/playwright-core/lib/server/utils/fileUtils';import { TMP_WORKSPACES } from './npmTest';diff --git a/tests/installation/npmTest.ts b/tests/installation/npmTest.tsindex 84dc11e99b..c3e5053013 100644--- a/tests/installation/npmTest.ts+++ b/tests/installation/npmTest.ts@@ -23,7 +23,7 @@ import { Registry } from './registry';import type { CommonFixtures, CommonWorkerFixtures } from '../config/commonFixtures';import { commonFixtures } from '../config/commonFixtures';import { removeFolders } from '../../packages/playwright-core/lib/server/utils/fileUtils';-import { spawnAsync } from '../../packages/playwright-core/lib/utils/spawnAsync';+import { spawnAsync } from '../../packages/playwright-core/lib/server/utils/spawnAsync';import type { SpawnOptions } from 'child_process';export const TMP_WORKSPACES = path.join(os.platform() === 'darwin' ? '/tmp' : os.tmpdir(), 'pwt', 'workspaces');diff --git a/tests/installation/registry.ts b/tests/installation/registry.tsindex c9214edb56..fd3194a039 100644--- a/tests/installation/registry.ts+++ b/tests/installation/registry.ts@@ -19,8 +19,8 @@ import type { Server } from 'http';import type http from 'http';import https from 'https';import path from 'path';-import { spawnAsync } from '../../packages/playwright-core/lib/utils/spawnAsync';-import { createHttpServer } from '../../packages/playwright-core/lib/utils/network';+import { spawnAsync } from '../../packages/playwright-core/lib/server/utils/spawnAsync';+import { createHttpServer } from '../../packages/playwright-core/lib/server/utils/network';const kPublicNpmRegistry = 'https://registry.npmjs.org';const kContentTypeAbbreviatedMetadata = 'application/vnd.npm.install-v1+json';diff --git a/tests/library/browsertype-connect.spec.ts b/tests/library/browsertype-connect.spec.tsindex d9a446c034..e4118e489f 100644--- a/tests/library/browsertype-connect.spec.ts+++ b/tests/library/browsertype-connect.spec.ts@@ -25,7 +25,7 @@ import { expect, playwrightTest } from '../config/browserTest';import { parseTrace, suppressCertificateWarning } from '../config/utils';import formidable from 'formidable';import type { Browser, ConnectOptions } from 'playwright-core';-import { createHttpServer } from '../../packages/playwright-core/lib/utils/network';+import { createHttpServer } from '../../packages/playwright-core/lib/server/utils/network';import { kTargetClosedErrorMessage } from '../config/errors';import { RunServer } from '../config/remoteServer';diff --git a/tests/library/proxy-pattern.spec.ts b/tests/library/proxy-pattern.spec.tsindex c8a7a78a48..2969d49f27 100644--- a/tests/library/proxy-pattern.spec.ts+++ b/tests/library/proxy-pattern.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { parsePattern } from '../../packages/playwright-core/lib/common/socksProxy';+import { parsePattern } from '../../packages/playwright-core/lib/server/utils/socksProxy';import { playwrightTest as test, expect } from '../config/browserTest';test('socks proxy patter matcher', async ({}) => {diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.tsindex e16fbcc460..bf78efc7c8 100644--- a/tests/playwright-test/reporter-blob.spec.ts+++ b/tests/playwright-test/reporter-blob.spec.ts@@ -18,7 +18,7 @@ import * as fs from 'fs';import type { PlaywrightTestConfig } from '@playwright/test';import path from 'path';import url from 'url';-import type { HttpServer } from '../../packages/playwright-core/src/utils';+import type { HttpServer } from '../../packages/playwright-core/lib/server/utils/httpServer';import { startHtmlReportServer } from '../../packages/playwright/lib/reporters/html';import { expect as baseExpect, test as baseTest, stripAnsi } from './playwright-test-fixtures';import extractZip from '../../packages/playwright-core/bundles/zip/node_modules/extract-zip';diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.tsindex 2c7915a357..acfd4cd187 100644--- a/tests/playwright-test/reporter-html.spec.ts+++ b/tests/playwright-test/reporter-html.spec.ts@@ -18,7 +18,7 @@ import fs from 'fs';import path from 'path';import url from 'url';import { test as baseTest, expect as baseExpect, createImage } from './playwright-test-fixtures';-import type { HttpServer } from '../../packages/playwright-core/src/utils';+import type { HttpServer } from '../../packages/playwright-core/lib/server/utils/httpServer';import { startHtmlReportServer } from '../../packages/playwright/lib/reporters/html';import { msToString } from '../../packages/web/src/uiUtils';const { spawnAsync } = require('../../packages/playwright-core/lib/utils');diff --git a/tests/playwright-test/web-server.spec.ts b/tests/playwright-test/web-server.spec.tsindex 6caed12a42..b50203048e 100644--- a/tests/playwright-test/web-server.spec.ts+++ b/tests/playwright-test/web-server.spec.ts@@ -18,7 +18,7 @@ import type http from 'http';import path from 'path';import { test, expect, parseTestRunnerOutput } from './playwright-test-fixtures';import type { RunResult } from './playwright-test-fixtures';-import { createHttpServer } from '../../packages/playwright-core/lib/utils/network';+import { createHttpServer } from '../../packages/playwright-core/lib/server/utils/network';const SIMPLE_SERVER_PATH = path.join(__dirname, 'assets', 'simple-server.js');