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 debug, env and user agent from utils/ (#34766)
Pavel Feldman3d760b657b83
diff --git a/packages/playwright-core/src/DEPS.list b/packages/playwright-core/src/DEPS.listindex ec14e89070..2ffa077b4e 100644--- a/packages/playwright-core/src/DEPS.list+++ b/packages/playwright-core/src/DEPS.list@@ -8,10 +8,13 @@**[inprocess.ts]+common/utils/+server/utils[outofprocess.ts]client/+common/protocol/utils/utils/isomorphicdiff --git a/packages/playwright-core/src/client/android.ts b/packages/playwright-core/src/client/android.tsindex f6e0419c2c..f0ca11848f 100644--- a/packages/playwright-core/src/client/android.ts+++ b/packages/playwright-core/src/client/android.ts@@ -21,7 +21,7 @@ import { ChannelOwner } from './channelOwner';import { TargetClosedError, isTargetClosedError } from './errors';import { Events } from './events';import { Waiter } from './waiter';-import { TimeoutSettings } from '../common/timeoutSettings';+import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';import { isRegExp, isString } from '../utils/isomorphic/rtti';import { monotonicTime } from '../utils/isomorphic/time';import { raceAgainstDeadline } from '../utils/isomorphic/timeoutRunner';@@ -30,7 +30,7 @@ import type { Page } from './page';import type * as types from './types';import type * as api from '../../types/types';import type { AndroidServerLauncherImpl } from '../androidServerImpl';-import type { Platform } from '../utils/platform';+import type { Platform } from '../common/platform';import type * as channels from '@protocol/channels';type Direction = 'down' | 'up' | 'left' | 'right';diff --git a/packages/playwright-core/src/client/artifact.ts b/packages/playwright-core/src/client/artifact.tsindex fc1e9bca12..815c7a358b 100644--- a/packages/playwright-core/src/client/artifact.ts+++ b/packages/playwright-core/src/client/artifact.ts@@ -16,7 +16,7 @@import { ChannelOwner } from './channelOwner';import { Stream } from './stream';-import { mkdirIfNeeded } from '../utils/fileUtils';+import { mkdirIfNeeded } from '../common/fileUtils';import type * as channels from '@protocol/channels';import type { Readable } from 'stream';diff --git a/packages/playwright-core/src/client/browser.ts b/packages/playwright-core/src/client/browser.tsindex 9d2ca1fab0..88140621fe 100644--- a/packages/playwright-core/src/client/browser.ts+++ b/packages/playwright-core/src/client/browser.ts@@ -20,7 +20,7 @@ import { CDPSession } from './cdpSession';import { ChannelOwner } from './channelOwner';import { isTargetClosedError } from './errors';import { Events } from './events';-import { mkdirIfNeeded } from '../utils/fileUtils';+import { mkdirIfNeeded } from '../common/fileUtils';import type { BrowserType } from './browserType';import type { Page } from './page';diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.tsindex 32cac6ba7f..02aa857366 100644--- a/packages/playwright-core/src/client/browserContext.ts+++ b/packages/playwright-core/src/client/browserContext.ts@@ -34,8 +34,8 @@ import { Tracing } from './tracing';import { Waiter } from './waiter';import { WebError } from './webError';import { Worker } from './worker';-import { TimeoutSettings } from '../common/timeoutSettings';-import { mkdirIfNeeded } from '../utils/fileUtils';+import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';+import { mkdirIfNeeded } from '../common/fileUtils';import { headersObjectToArray } from '../utils/isomorphic/headers';import { urlMatchesEqual } from '../utils/isomorphic/urlMatch';import { isRegExp, isString } from '../utils/isomorphic/rtti';@@ -46,7 +46,7 @@ import type { BrowserContextOptions, Headers, LaunchOptions, StorageState, WaitFimport type * as structs from '../../types/structs';import type * as api from '../../types/types';import type { URLMatch } from '../utils/isomorphic/urlMatch';-import type { Platform } from '../utils/platform';+import type { Platform } from '../common/platform';import type * as channels from '@protocol/channels';export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel> implements api.BrowserContext {diff --git a/packages/playwright-core/src/client/browserType.ts b/packages/playwright-core/src/client/browserType.tsindex 79d2fbd521..06bae0419f 100644--- a/packages/playwright-core/src/client/browserType.ts+++ b/packages/playwright-core/src/client/browserType.ts@@ -21,7 +21,7 @@ import { BrowserContext, prepareBrowserContextParams } from './browserContext';import { ChannelOwner } from './channelOwner';import { envObjectToArray } from './clientHelper';import { Events } from './events';-import { assert } from '../utils/debug';+import { assert } from '../utils/isomorphic/debug';import { headersObjectToArray } from '../utils/isomorphic/headers';import { monotonicTime } from '../utils/isomorphic/time';import { raceAgainstDeadline } from '../utils/isomorphic/timeoutRunner';diff --git a/packages/playwright-core/src/client/channelOwner.ts b/packages/playwright-core/src/client/channelOwner.tsindex 5c5afcdc2d..40bf226c65 100644--- a/packages/playwright-core/src/client/channelOwner.ts+++ b/packages/playwright-core/src/client/channelOwner.ts@@ -16,8 +16,7 @@import { EventEmitter } from './eventEmitter';import { ValidationError, maybeFindValidator } from '../protocol/validator';-import { isUnderTest } from '../utils/debug';-import { debugLogger } from '../utils/debugLogger';+import { isUnderTest } from '../utils/isomorphic/debug';import { captureLibraryStackTrace, stringifyStackFrames } from '../utils/isomorphic/stackTrace';import { zones } from '../utils/zones';@@ -25,7 +24,7 @@ import type { ClientInstrumentation } from './clientInstrumentation';import type { Connection } from './connection';import type { Logger } from './types';import type { ValidatorContext } from '../protocol/validator';-import type { Platform } from '../utils/platform';+import type { Platform } from '../common/platform';import type * as channels from '@protocol/channels';type Listener = (...args: any[]) => void;@@ -158,7 +157,7 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.ChannelapiZone.params = params;apiZone.reported = true;this._instrumentation.onApiCallBegin(apiZone);- logApiCall(this._logger, `=> ${apiZone.apiName} started`);+ logApiCall(this._platform, this._logger, `=> ${apiZone.apiName} started`);return await this._connection.sendMessageToServer(this, prop, validatedParams, apiZone.apiName, apiZone.frames, apiZone.stepId);}// Since this api call is either internal, or has already been reported/traced once,@@ -189,7 +188,7 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channeltry {const result = await zones.run('apiZone', apiZone, async () => await func(apiZone));if (!isInternal) {- logApiCall(logger, `<= ${apiZone.apiName} succeeded`);+ logApiCall(this._platform, logger, `<= ${apiZone.apiName} succeeded`);this._instrumentation.onApiCallEnd(apiZone);}return result;@@ -204,7 +203,7 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channele.stack = '';if (!isInternal) {apiZone.error = e;- logApiCall(logger, `<= ${apiZone.apiName} failed`);+ logApiCall(this._platform, logger, `<= ${apiZone.apiName} failed`);this._instrumentation.onApiCallEnd(apiZone);}throw e;@@ -227,10 +226,10 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel}}-function logApiCall(logger: Logger | undefined, message: string) {+function logApiCall(platform: Platform, logger: Logger | undefined, message: string) {if (logger && logger.isEnabled('api', 'info'))logger.log('api', 'info', message, [], { color: 'cyan' });- debugLogger.log('api', message);+ platform.log('api', message);}function tChannelImplToWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext) {diff --git a/packages/playwright-core/src/client/clientHelper.ts b/packages/playwright-core/src/client/clientHelper.tsindex 3ffe01034b..afb6077c13 100644--- a/packages/playwright-core/src/client/clientHelper.ts+++ b/packages/playwright-core/src/client/clientHelper.ts@@ -18,7 +18,7 @@import { isString } from '../utils/isomorphic/rtti';import type * as types from './types';-import type { Platform } from '../utils/platform';+import type { Platform } from '../common/platform';export function envObjectToArray(env: types.Env): { name: string, value: string }[] {const result: { name: string, value: string }[] = [];diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.tsindex fe0e14b032..124fcc15d5 100644--- a/packages/playwright-core/src/client/connection.ts+++ b/packages/playwright-core/src/client/connection.ts@@ -42,14 +42,13 @@ import { Tracing } from './tracing';import { Worker } from './worker';import { WritableStream } from './writableStream';import { ValidationError, findValidator } from '../protocol/validator';-import { debugLogger } from '../utils/debugLogger';import { formatCallLog, rewriteErrorMessage } from '../utils/isomorphic/stackTrace';import { zones } from '../utils/zones';import type { ClientInstrumentation } from './clientInstrumentation';import type { HeadersArray } from './types';import type { ValidatorContext } from '../protocol/validator';-import type { Platform } from '../utils/platform';+import type { Platform } from '../common/platform';import type * as channels from '@protocol/channels';class Root extends ChannelOwner<channels.RootChannel> {@@ -139,9 +138,9 @@ export class Connection extends EventEmitter {const type = object._type;const id = ++this._lastId;const message = { id, guid, method, params };- if (debugLogger.isEnabled('channel')) {+ if (this.platform.isLogEnabled('channel')) {// Do not include metadata in debug logs to avoid noise.- debugLogger.log('channel', 'SEND> ' + JSON.stringify(message));+ this.platform.log('channel', 'SEND> ' + JSON.stringify(message));}const location = frames[0] ? { file: frames[0].file, line: frames[0].line, column: frames[0].column } : undefined;const metadata: channels.Metadata = { apiName, location, internal: !apiName, stepId };@@ -159,8 +158,8 @@ export class Connection extends EventEmitter {const { id, guid, method, params, result, error, log } = message as any;if (id) {- if (debugLogger.isEnabled('channel'))- debugLogger.log('channel', '<RECV ' + JSON.stringify(message));+ if (this.platform.isLogEnabled('channel'))+ this.platform.log('channel', '<RECV ' + JSON.stringify(message));const callback = this._callbacks.get(id);if (!callback)throw new Error(`Cannot find command to respond: ${id}`);@@ -176,8 +175,8 @@ export class Connection extends EventEmitter {return;}- if (debugLogger.isEnabled('channel'))- debugLogger.log('channel', '<EVENT ' + JSON.stringify(message));+ if (this.platform.isLogEnabled('channel'))+ this.platform.log('channel', '<EVENT ' + JSON.stringify(message));if (method === '__create__') {this._createRemoteObject(guid, params.type, params.guid, params.initializer);return;diff --git a/packages/playwright-core/src/client/consoleMessage.ts b/packages/playwright-core/src/client/consoleMessage.tsindex 5ad37b305e..5d215cf2ad 100644--- a/packages/playwright-core/src/client/consoleMessage.ts+++ b/packages/playwright-core/src/client/consoleMessage.ts@@ -18,7 +18,7 @@ import { JSHandle } from './jsHandle';import { Page } from './page';import type * as api from '../../types/types';-import type { Platform } from '../utils/platform';+import type { Platform } from '../common/platform';import type * as channels from '@protocol/channels';type ConsoleMessageLocation = channels.BrowserContextConsoleEvent['location'];diff --git a/packages/playwright-core/src/client/electron.ts b/packages/playwright-core/src/client/electron.tsindex 01d194e029..90ae6dc4d4 100644--- a/packages/playwright-core/src/client/electron.ts+++ b/packages/playwright-core/src/client/electron.ts@@ -22,7 +22,7 @@ import { TargetClosedError, isTargetClosedError } from './errors';import { Events } from './events';import { JSHandle, parseResult, serializeArgument } from './jsHandle';import { Waiter } from './waiter';-import { TimeoutSettings } from '../common/timeoutSettings';+import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';import type { Page } from './page';import type { BrowserContextOptions, Env, Headers, WaitForEventOptions } from './types';diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.tsindex 6bca1c7e82..206fc33084 100644--- a/packages/playwright-core/src/client/elementHandle.ts+++ b/packages/playwright-core/src/client/elementHandle.ts@@ -19,8 +19,8 @@ import { promisify } from 'util';import { Frame } from './frame';import { JSHandle, parseResult, serializeArgument } from './jsHandle';-import { assert } from '../utils/debug';-import { fileUploadSizeLimit, mkdirIfNeeded } from '../utils/fileUtils';+import { assert } from '../utils/isomorphic/debug';+import { fileUploadSizeLimit, mkdirIfNeeded } from '../common/fileUtils';import { isString } from '../utils/isomorphic/rtti';import { mime } from '../utilsBundle';import { WritableStream } from './writableStream';@@ -31,7 +31,7 @@ import type { Locator } from './locator';import type { FilePayload, Rect, SelectOption, SelectOptionOptions } from './types';import type * as structs from '../../types/structs';import type * as api from '../../types/types';-import type { Platform } from '../utils/platform';+import type { Platform } from '../common/platform';import type * as channels from '@protocol/channels';const pipelineAsync = promisify(pipeline);diff --git a/packages/playwright-core/src/client/eventEmitter.ts b/packages/playwright-core/src/client/eventEmitter.tsindex 5fbe3372cb..ce695490c2 100644--- a/packages/playwright-core/src/client/eventEmitter.ts+++ b/packages/playwright-core/src/client/eventEmitter.ts@@ -24,7 +24,7 @@import { EventEmitter as OriginalEventEmitter } from 'events';-import { isUnderTest } from '../utils/debug';+import { isUnderTest } from '../utils/isomorphic/debug';import type { EventEmitter as EventEmitterType } from 'events';diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.tsindex 11c28e7c20..8e02bc34a2 100644--- a/packages/playwright-core/src/client/fetch.ts+++ b/packages/playwright-core/src/client/fetch.ts@@ -19,8 +19,8 @@ import { ChannelOwner } from './channelOwner';import { TargetClosedError, isTargetClosedError } from './errors';import { RawHeaders } from './network';import { Tracing } from './tracing';-import { assert } from '../utils/debug';-import { mkdirIfNeeded } from '../utils/fileUtils';+import { assert } from '../utils/isomorphic/debug';+import { mkdirIfNeeded } from '../common/fileUtils';import { headersObjectToArray } from '../utils/isomorphic/headers';import { isString } from '../utils/isomorphic/rtti';@@ -29,7 +29,7 @@ import type { ClientCertificate, FilePayload, Headers, SetStorageState, StorageSimport type { Serializable } from '../../types/structs';import type * as api from '../../types/types';import type { HeadersArray, NameValue } from '../common/types';-import type { Platform } from '../utils/platform';+import type { Platform } from '../common/platform';import type * as channels from '@protocol/channels';import type * as fs from 'fs';diff --git a/packages/playwright-core/src/client/frame.ts b/packages/playwright-core/src/client/frame.tsindex 2155ab0f87..c302da02e4 100644--- a/packages/playwright-core/src/client/frame.ts+++ b/packages/playwright-core/src/client/frame.ts@@ -26,7 +26,7 @@ import { FrameLocator, Locator, testIdAttributeName } from './locator';import * as network from './network';import { kLifecycleEvents } from './types';import { Waiter } from './waiter';-import { assert } from '../utils/debug';+import { assert } from '../utils/isomorphic/debug';import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';import { urlMatches } from '../utils/isomorphic/urlMatch';diff --git a/packages/playwright-core/src/client/harRouter.ts b/packages/playwright-core/src/client/harRouter.tsindex 33767e11a0..a9ab966b2a 100644--- a/packages/playwright-core/src/client/harRouter.ts+++ b/packages/playwright-core/src/client/harRouter.ts@@ -14,8 +14,6 @@* limitations under the License.*/-import { debugLogger } from '../utils/debugLogger';-import type { BrowserContext } from './browserContext';import type { LocalUtils } from './localUtils';import type { Route } from './network';@@ -57,7 +55,7 @@ export class HarRouter {});if (response.action === 'redirect') {- debugLogger.log('api', `HAR: ${route.request().url()} redirected to ${response.redirectURL}`);+ route._platform.log('api', `HAR: ${route.request().url()} redirected to ${response.redirectURL}`);await route._redirectNavigationRequest(response.redirectURL!);return;}@@ -79,7 +77,7 @@ export class HarRouter {}if (response.action === 'error')- debugLogger.log('api', 'HAR: ' + response.message!);+ route._platform.log('api', 'HAR: ' + response.message!);// Report the error, but fall through to the default handler.if (this._notFoundAction === 'abort') {diff --git a/packages/playwright-core/src/client/localUtils.ts b/packages/playwright-core/src/client/localUtils.tsindex 29f2cc8312..ad66de6814 100644--- a/packages/playwright-core/src/client/localUtils.ts+++ b/packages/playwright-core/src/client/localUtils.ts@@ -16,11 +16,11 @@import { ChannelOwner } from './channelOwner';import { Connection } from './connection';-import * as localUtils from '../utils/localUtils';+import * as localUtils from '../common/localUtils';import type { HeadersArray, Size } from './types';-import type { HarBackend } from '../utils/harBackend';-import type { Platform } from '../utils/platform';+import type { HarBackend } from '../common/harBackend';+import type { Platform } from '../common/platform';import type * as channels from '@protocol/channels';type DeviceDescriptor = {diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.tsindex 801146c2a7..a2c64c08b1 100644--- a/packages/playwright-core/src/client/network.ts+++ b/packages/playwright-core/src/client/network.ts@@ -23,7 +23,7 @@ import { APIResponse } from './fetch';import { Frame } from './frame';import { Waiter } from './waiter';import { Worker } from './worker';-import { assert } from '../utils/debug';+import { assert } from '../utils/isomorphic/debug';import { headersObjectToArray } from '../utils/isomorphic/headers';import { urlMatches } from '../utils/isomorphic/urlMatch';import { LongStandingScope, ManualPromise } from '../utils/isomorphic/manualPromise';diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.tsindex d71afce060..b954cca502 100644--- a/packages/playwright-core/src/client/page.ts+++ b/packages/playwright-core/src/client/page.ts@@ -33,9 +33,9 @@ import { Response, Route, RouteHandler, WebSocket, WebSocketRoute, WebSocketRouimport { Video } from './video';import { Waiter } from './waiter';import { Worker } from './worker';-import { TimeoutSettings } from '../common/timeoutSettings';-import { assert } from '../utils/debug';-import { mkdirIfNeeded } from '../utils/fileUtils';+import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';+import { assert } from '../utils/isomorphic/debug';+import { mkdirIfNeeded } from '../common/fileUtils';import { headersObjectToArray } from '../utils/isomorphic/headers';import { trimStringWithEllipsis } from '../utils/isomorphic/stringUtils';import { urlMatches, urlMatchesEqual } from '../utils/isomorphic/urlMatch';diff --git a/packages/playwright-core/src/client/selectors.ts b/packages/playwright-core/src/client/selectors.tsindex 2a1097f7ec..3eca51bf36 100644--- a/packages/playwright-core/src/client/selectors.ts+++ b/packages/playwright-core/src/client/selectors.ts@@ -17,19 +17,25 @@import { ChannelOwner } from './channelOwner';import { evaluationScript } from './clientHelper';import { setTestIdAttribute, testIdAttributeName } from './locator';-import { nodePlatform } from '../utils/platform';+import { emptyPlatform } from '../common/platform';import type { SelectorEngine } from './types';import type * as api from '../../types/types';import type * as channels from '@protocol/channels';+import type { Platform } from '../common/platform';+let platform = emptyPlatform;++export function setPlatformForSelectors(p: Platform) {+ platform = p;+}export class Selectors implements api.Selectors {private _channels = new Set<SelectorsOwner>();private _registrations: channels.SelectorsRegisterParams[] = [];async register(name: string, script: string | (() => SelectorEngine) | { path?: string, content?: string }, options: { contentScript?: boolean } = {}): Promise<void> {- const source = await evaluationScript(nodePlatform, script, undefined, false);+ const source = await evaluationScript(platform, script, undefined, false);const params = { ...options, name, source };for (const channel of this._channels)await channel._channel.register(params);diff --git a/packages/playwright-core/src/common/DEPS.list b/packages/playwright-core/src/common/DEPS.listindex 43bff9dba4..a25dd41c36 100644--- a/packages/playwright-core/src/common/DEPS.list+++ b/packages/playwright-core/src/common/DEPS.list@@ -1,4 +1,5 @@[*]../utils/+../utils/isomorphic/../utilsBundle.ts../zipBundle.tsdiff --git a/packages/playwright-core/src/utils/fileUtils.ts b/packages/playwright-core/src/common/fileUtils.tssimilarity index 100%rename from packages/playwright-core/src/utils/fileUtils.tsrename to packages/playwright-core/src/common/fileUtils.tsdiff --git a/packages/playwright-core/src/utils/harBackend.ts b/packages/playwright-core/src/common/harBackend.tssimilarity index 98%rename from packages/playwright-core/src/utils/harBackend.tsrename to packages/playwright-core/src/common/harBackend.tsindex 304fe4b150..f59b7de5f1 100644--- a/packages/playwright-core/src/utils/harBackend.ts+++ b/packages/playwright-core/src/common/harBackend.ts@@ -14,9 +14,9 @@* limitations under the License.*/-import { ZipFile } from './zipFile';+import { ZipFile } from '../utils/zipFile';-import type { HeadersArray } from '../common/types';+import type { HeadersArray } from './types';import type * as har from '@trace/har';import type { Platform } from './platform';diff --git a/packages/playwright-core/src/utils/localUtils.ts b/packages/playwright-core/src/common/localUtils.tssimilarity index 98%rename from packages/playwright-core/src/utils/localUtils.tsrename to packages/playwright-core/src/common/localUtils.tsindex 49a3c43175..5020d82b75 100644--- a/packages/playwright-core/src/utils/localUtils.ts+++ b/packages/playwright-core/src/common/localUtils.ts@@ -20,11 +20,11 @@ import * as path from 'path';import { removeFolders } from './fileUtils';import { HarBackend } from './harBackend';-import { ManualPromise } from './isomorphic/manualPromise';-import { ZipFile } from './zipFile';+import { ManualPromise } from '../utils/isomorphic/manualPromise';+import { ZipFile } from '../utils/zipFile';import { yauzl, yazl } from '../zipBundle';import { serializeClientSideCallMetadata } from '../utils/isomorphic/traceUtils';-import { assert } from '../utils/debug';+import { assert } from '../utils/isomorphic/debug';import type { Platform } from './platform';import type * as channels from '@protocol/channels';diff --git a/packages/playwright-core/src/utils/platform.ts b/packages/playwright-core/src/common/platform.tssimilarity index 68%rename from packages/playwright-core/src/utils/platform.tsrename to packages/playwright-core/src/common/platform.tsindex 5abf38e8c0..390dbf80ff 100644--- a/packages/playwright-core/src/utils/platform.ts+++ b/packages/playwright-core/src/common/platform.ts@@ -17,36 +17,19 @@import * as crypto from 'crypto';import * as fs from 'fs';import * as path from 'path';-import * as util from 'util';export type Platform = {calculateSha1(text: string): Promise<string>;createGuid: () => string;fs: () => typeof fs;inspectCustom: symbol | undefined;+ isLogEnabled(name: 'api' | 'channel'): boolean;+ log(name: 'api' | 'channel', message: string | Error | object): void;path: () => typeof path;pathSeparator: string;ws?: (url: string) => WebSocket;};-export const nodePlatform: Platform = {- calculateSha1: (text: string) => {- const sha1 = crypto.createHash('sha1');- sha1.update(text);- return Promise.resolve(sha1.digest('hex'));- },-- createGuid: () => crypto.randomBytes(16).toString('hex'),-- fs: () => fs,-- inspectCustom: util.inspect.custom,-- path: () => path,-- pathSeparator: path.sep-};-export const webPlatform: Platform = {calculateSha1: async (text: string) => {const bytes = new TextEncoder().encode(text);@@ -64,6 +47,13 @@ export const webPlatform: Platform = {inspectCustom: undefined,++ isLogEnabled(name: 'api' | 'channel') {+ return false;+ },++ log(name: 'api' | 'channel', message: string | Error | object) {},+path: () => {throw new Error('Path module is not available');},@@ -72,3 +62,31 @@ export const webPlatform: Platform = {ws: (url: string) => new WebSocket(url),};++export const emptyPlatform: Platform = {+ calculateSha1: async () => {+ throw new Error('Not implemented');+ },++ createGuid: () => {+ throw new Error('Not implemented');+ },++ fs: () => {+ throw new Error('Not implemented');+ },++ inspectCustom: undefined,++ isLogEnabled(name: 'api' | 'channel') {+ return false;+ },++ log(name: 'api' | 'channel', message: string | Error | object) { },++ path: () => {+ throw new Error('Function not implemented.');+ },++ pathSeparator: '/'+};diff --git a/packages/playwright-core/src/inProcessFactory.ts b/packages/playwright-core/src/inProcessFactory.tsindex 784bfc4c88..81b40afe19 100644--- a/packages/playwright-core/src/inProcessFactory.ts+++ b/packages/playwright-core/src/inProcessFactory.ts@@ -21,13 +21,21 @@ import { BrowserServerLauncherImpl } from './browserServerImpl';import { Connection } from './client/connection';import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from './server';import { setLibraryStackPrefix } from './utils/isomorphic/stackTrace';+import { setDebugMode } from './utils/isomorphic/debug';+import { getFromENV } from './server/utils/env';+import { nodePlatform } from './server/utils/nodePlatform';+import { setPlatformForSelectors } from './client/selectors';import type { Playwright as PlaywrightAPI } from './client/playwright';import type { Language } from './utils';-import type { Platform } from './utils/platform';+import type { Platform } from './common/platform';+export function createInProcessPlaywright(platform: Platform): PlaywrightAPI {const playwright = createPlaywright({ sdkLanguage: (process.env.PW_LANG_NAME as Language | undefined) || 'javascript' });+ setDebugMode(getFromENV('PWDEBUG') || '');+ setPlatformForSelectors(nodePlatform);+setLibraryStackPrefix(path.join(__dirname, '..'));const clientConnection = new Connection(undefined, platform, undefined, []);diff --git a/packages/playwright-core/src/inprocess.ts b/packages/playwright-core/src/inprocess.tsindex c057f7b5c0..fc0550e924 100644--- a/packages/playwright-core/src/inprocess.ts+++ b/packages/playwright-core/src/inprocess.ts@@ -15,6 +15,6 @@*/import { createInProcessPlaywright } from './inProcessFactory';-import { nodePlatform } from './utils/platform';+import { nodePlatform } from './server/utils/nodePlatform';module.exports = createInProcessPlaywright(nodePlatform);diff --git a/packages/playwright-core/src/outofprocess.ts b/packages/playwright-core/src/outofprocess.tsindex 8dcb8fa45a..c24decb900 100644--- a/packages/playwright-core/src/outofprocess.ts+++ b/packages/playwright-core/src/outofprocess.ts@@ -20,7 +20,7 @@ import * as path from 'path';import { Connection } from './client/connection';import { PipeTransport } from './utils/pipeTransport';import { ManualPromise } from './utils/isomorphic/manualPromise';-import { nodePlatform } from './utils/platform';+import { nodePlatform } from './server/utils/nodePlatform';import type { Playwright } from './client/playwright';diff --git a/packages/playwright-core/src/remote/playwrightConnection.ts b/packages/playwright-core/src/remote/playwrightConnection.tsindex e276873668..00ca33b353 100644--- a/packages/playwright-core/src/remote/playwrightConnection.ts+++ b/packages/playwright-core/src/remote/playwrightConnection.ts@@ -23,7 +23,7 @@ import { serverSideCallMetadata } from '../server/instrumentation';import { assert, isUnderTest } from '../utils';import { startProfiling, stopProfiling } from '../server/utils/profiler';import { monotonicTime } from '../utils';-import { debugLogger } from '../utils/debugLogger';+import { debugLogger } from '../server/utils/debugLogger';import type { DispatcherScope, Playwright } from '../server';import type { LaunchOptions } from '../server/types';diff --git a/packages/playwright-core/src/remote/playwrightServer.ts b/packages/playwright-core/src/remote/playwrightServer.tsindex 911fa1b97c..7f6a58a0a5 100644--- a/packages/playwright-core/src/remote/playwrightServer.ts+++ b/packages/playwright-core/src/remote/playwrightServer.ts@@ -16,11 +16,11 @@import { PlaywrightConnection } from './playwrightConnection';import { createPlaywright } from '../server/playwright';-import { debugLogger } from '../utils/debugLogger';+import { debugLogger } from '../server/utils/debugLogger';import { Semaphore } from '../utils/isomorphic/semaphore';import { WSServer } from '../server/utils/wsServer';import { wrapInASCIIBox } from '../server/utils/ascii';-import { getPlaywrightVersion } from '../utils/userAgent';+import { getPlaywrightVersion } from '../server/utils/userAgent';import type { ClientType } from './playwrightConnection';import type { SocksProxy } from '../server/utils/socksProxy';diff --git a/packages/playwright-core/src/server/android/DEPS.list b/packages/playwright-core/src/server/android/DEPS.listindex b45c3a16a7..b852561b95 100644--- a/packages/playwright-core/src/server/android/DEPS.list+++ b/packages/playwright-core/src/server/android/DEPS.list@@ -3,6 +3,7 @@../../common/../../protocol/../../utils/+../../utils/isomorphic/../../utilsBundle.ts../chromium/../utilsdiff --git a/packages/playwright-core/src/server/android/android.ts b/packages/playwright-core/src/server/android/android.tsindex 68db8ab77c..c1516dea76 100644--- a/packages/playwright-core/src/server/android/android.ts+++ b/packages/playwright-core/src/server/android/android.ts@@ -19,13 +19,13 @@ import * as fs from 'fs';import * as os from 'os';import * as path from 'path';-import { TimeoutSettings } from '../../common/timeoutSettings';+import { TimeoutSettings } from '../../utils/isomorphic/timeoutSettings';import { PipeTransport } from '../../utils/pipeTransport';import { createGuid } from '../utils/crypto';-import { isUnderTest } from '../../utils/debug';-import { getPackageManagerExecCommand } from '../../utils/env';+import { isUnderTest } from '../../utils/isomorphic/debug';+import { getPackageManagerExecCommand } from '../utils/env';import { makeWaitForNextTask } from '../../utils/task';-import { RecentLogsCollector } from '../../utils/debugLogger';+import { RecentLogsCollector } from '../utils/debugLogger';import { debug } from '../../utilsBundle';import { wsReceiver, wsSender } from '../../utilsBundle';import { validateBrowserContextOptions } from '../browserContext';diff --git a/packages/playwright-core/src/server/android/backendAdb.ts b/packages/playwright-core/src/server/android/backendAdb.tsindex 737d415050..036c74703e 100644--- a/packages/playwright-core/src/server/android/backendAdb.ts+++ b/packages/playwright-core/src/server/android/backendAdb.ts@@ -17,7 +17,7 @@import { EventEmitter } from 'events';import * as net from 'net';-import { assert } from '../../utils/debug';+import { assert } from '../../utils/isomorphic/debug';import { createGuid } from '../utils/crypto';import { debug } from '../../utilsBundle';diff --git a/packages/playwright-core/src/server/bidi/bidiConnection.ts b/packages/playwright-core/src/server/bidi/bidiConnection.tsindex 87b3f59c9b..0882836c38 100644--- a/packages/playwright-core/src/server/bidi/bidiConnection.ts+++ b/packages/playwright-core/src/server/bidi/bidiConnection.ts@@ -16,11 +16,11 @@import { EventEmitter } from 'events';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from '../utils/debugLogger';import { helper } from '../helper';import { ProtocolError } from '../protocolError';-import type { RecentLogsCollector } from '../../utils/debugLogger';+import type { RecentLogsCollector } from '../utils/debugLogger';import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';import type { ProtocolLogger } from '../types';import type * as bidiCommands from './third_party/bidiCommands';diff --git a/packages/playwright-core/src/server/bidi/bidiOverCdp.ts b/packages/playwright-core/src/server/bidi/bidiOverCdp.tsindex adf7c9afbf..8acd45563d 100644--- a/packages/playwright-core/src/server/bidi/bidiOverCdp.ts+++ b/packages/playwright-core/src/server/bidi/bidiOverCdp.ts@@ -17,7 +17,7 @@import * as bidiMapper from 'chromium-bidi/lib/cjs/bidiMapper/BidiMapper';import * as bidiCdpConnection from 'chromium-bidi/lib/cjs/cdp/CdpConnection';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from '../utils/debugLogger';import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';import type { ChromiumBidi } from 'chromium-bidi/lib/cjs/protocol/protocol';diff --git a/packages/playwright-core/src/server/browser.ts b/packages/playwright-core/src/server/browser.tsindex d99a3f8f8a..7cf00f73c8 100644--- a/packages/playwright-core/src/server/browser.ts+++ b/packages/playwright-core/src/server/browser.ts@@ -24,7 +24,7 @@ import { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';import type { CallMetadata } from './instrumentation';import type * as types from './types';import type { ProxySettings } from './types';-import type { RecentLogsCollector } from '../utils/debugLogger';+import type { RecentLogsCollector } from './utils/debugLogger';import type * as channels from '@protocol/channels';import type { ChildProcess } from 'child_process';diff --git a/packages/playwright-core/src/server/browserContext.ts b/packages/playwright-core/src/server/browserContext.tsindex 48c87f7dc4..fd50994343 100644--- a/packages/playwright-core/src/server/browserContext.ts+++ b/packages/playwright-core/src/server/browserContext.ts@@ -18,9 +18,9 @@import * as fs from 'fs';import * as path from 'path';-import { TimeoutSettings } from '../common/timeoutSettings';+import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';import { createGuid } from './utils/crypto';-import { debugMode } from '../utils/debug';+import { debugMode } from '../utils/isomorphic/debug';import { Clock } from './clock';import { Debugger } from './debugger';import { BrowserContextAPIRequestContext } from './fetch';diff --git a/packages/playwright-core/src/server/browserType.ts b/packages/playwright-core/src/server/browserType.tsindex 9952aef2f4..7fe3844c7d 100644--- a/packages/playwright-core/src/server/browserType.ts+++ b/packages/playwright-core/src/server/browserType.ts@@ -19,7 +19,7 @@ import * as os from 'os';import * as path from 'path';import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';-import { DEFAULT_TIMEOUT, TimeoutSettings } from '../common/timeoutSettings';+import { DEFAULT_TIMEOUT, TimeoutSettings } from '../utils/isomorphic/timeoutSettings';import { ManualPromise, assert, debugMode } from '../utils';import { existsAsync } from './utils/fileUtils';import { helper } from './helper';@@ -31,7 +31,7 @@ import { isProtocolError } from './protocolError';import { registry } from './registry';import { ClientCertificatesProxy } from './socksClientCertificatesInterceptor';import { WebSocketTransport } from './transport';-import { RecentLogsCollector } from '../utils/debugLogger';+import { RecentLogsCollector } from './utils/debugLogger';import type { Browser, BrowserOptions, BrowserProcess } from './browser';import type { BrowserContext } from './browserContext';diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.tsindex 7c520aa213..3f06e135cd 100644--- a/packages/playwright-core/src/server/chromium/chromium.ts+++ b/packages/playwright-core/src/server/chromium/chromium.ts@@ -22,13 +22,13 @@ import * as path from 'path';import { chromiumSwitches } from './chromiumSwitches';import { CRBrowser } from './crBrowser';import { kBrowserCloseMessageId } from './crConnection';-import { TimeoutSettings } from '../../common/timeoutSettings';+import { TimeoutSettings } from '../../utils/isomorphic/timeoutSettings';import { debugMode, headersArrayToObject, headersObjectToArray, } from '../../utils';import { wrapInASCIIBox } from '../utils/ascii';-import { RecentLogsCollector } from '../../utils/debugLogger';+import { RecentLogsCollector } from '../utils/debugLogger';import { ManualPromise } from '../../utils/isomorphic/manualPromise';import { fetchData } from '../utils/network';-import { getUserAgent } from '../../utils/userAgent';+import { getUserAgent } from '../utils/userAgent';import { validateBrowserContextOptions } from '../browserContext';import { BrowserType, kNoXServerRunningError } from '../browserType';import { BrowserReadyState } from '../browserType';diff --git a/packages/playwright-core/src/server/chromium/crBrowser.ts b/packages/playwright-core/src/server/chromium/crBrowser.tsindex abd4aee685..7cc6030486 100644--- a/packages/playwright-core/src/server/chromium/crBrowser.ts+++ b/packages/playwright-core/src/server/chromium/crBrowser.ts@@ -17,7 +17,7 @@import * as path from 'path';-import { assert } from '../../utils/debug';+import { assert } from '../../utils/isomorphic/debug';import { createGuid } from '../utils/crypto';import { Artifact } from '../artifact';import { Browser } from '../browser';diff --git a/packages/playwright-core/src/server/chromium/crConnection.ts b/packages/playwright-core/src/server/chromium/crConnection.tsindex 424d64a500..98c566c82a 100644--- a/packages/playwright-core/src/server/chromium/crConnection.ts+++ b/packages/playwright-core/src/server/chromium/crConnection.ts@@ -18,14 +18,14 @@import { EventEmitter } from 'events';import { assert, eventsHelper } from '../../utils';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from '../utils/debugLogger';import { helper } from '../helper';import { ProtocolError } from '../protocolError';import type { RegisteredListener } from '../../utils';import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';import type { Protocol } from './protocol';-import type { RecentLogsCollector } from '../../utils/debugLogger';+import type { RecentLogsCollector } from '../utils/debugLogger';import type { ProtocolLogger } from '../types';diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.tsindex bb218202e6..34470470dc 100644--- a/packages/playwright-core/src/server/chromium/crPage.ts+++ b/packages/playwright-core/src/server/chromium/crPage.ts@@ -17,7 +17,7 @@import * as path from 'path';-import { assert } from '../../utils/debug';+import { assert } from '../../utils/isomorphic/debug';import { createGuid } from '../utils/crypto';import { eventsHelper } from '../utils/eventsHelper';import { rewriteErrorMessage } from '../../utils/isomorphic/stackTrace';diff --git a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.tsindex 37ff8c8b81..b582aa8788 100644--- a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts@@ -16,9 +16,9 @@import { Dispatcher } from './dispatcher';import { SdkObject } from '../../server/instrumentation';-import * as localUtils from '../../utils/localUtils';-import { nodePlatform } from '../../utils/platform';-import { getUserAgent } from '../../utils/userAgent';+import * as localUtils from '../../common/localUtils';+import { nodePlatform } from '../utils/nodePlatform';+import { getUserAgent } from '../utils/userAgent';import { deviceDescriptors as descriptors } from '../deviceDescriptors';import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';import { Progress, ProgressController } from '../progress';@@ -26,7 +26,7 @@ import { SocksInterceptor } from '../socksInterceptor';import { WebSocketTransport } from '../transport';import { fetchData } from '../utils/network';-import type { HarBackend } from '../../utils/harBackend';+import type { HarBackend } from '../../common/harBackend';import type { CallMetadata } from '../instrumentation';import type { Playwright } from '../playwright';import type { RootDispatcher } from './dispatcher';diff --git a/packages/playwright-core/src/server/electron/DEPS.list b/packages/playwright-core/src/server/electron/DEPS.listindex 1d51da425e..1acb5c5a0e 100644--- a/packages/playwright-core/src/server/electron/DEPS.list+++ b/packages/playwright-core/src/server/electron/DEPS.list@@ -2,5 +2,6 @@../../../common/../../utils/+../../utils/isomorphic/../chromium/../utils\ No newline at end of filediff --git a/packages/playwright-core/src/server/electron/electron.ts b/packages/playwright-core/src/server/electron/electron.tsindex 1728a317a8..4713324ed1 100644--- a/packages/playwright-core/src/server/electron/electron.ts+++ b/packages/playwright-core/src/server/electron/electron.ts@@ -19,10 +19,10 @@ import * as os from 'os';import * as path from 'path';import * as readline from 'readline';-import { TimeoutSettings } from '../../common/timeoutSettings';+import { TimeoutSettings } from '../../utils/isomorphic/timeoutSettings';import { ManualPromise } from '../../utils';import { wrapInASCIIBox } from '../utils/ascii';-import { RecentLogsCollector } from '../../utils/debugLogger';+import { RecentLogsCollector } from '../utils/debugLogger';import { eventsHelper } from '../utils/eventsHelper';import { validateBrowserContextOptions } from '../browserContext';import { CRBrowser } from '../chromium/crBrowser';diff --git a/packages/playwright-core/src/server/fetch.ts b/packages/playwright-core/src/server/fetch.tsindex 08e63bb83b..6e1d6d02f1 100644--- a/packages/playwright-core/src/server/fetch.ts+++ b/packages/playwright-core/src/server/fetch.ts@@ -21,10 +21,10 @@ import { TLSSocket } from 'tls';import * as url from 'url';import * as zlib from 'zlib';-import { TimeoutSettings } from '../common/timeoutSettings';+import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';import { assert, constructURLBasedOnBaseURL, eventsHelper, monotonicTime } from '../utils';import { createGuid } from './utils/crypto';-import { getUserAgent } from '../utils/userAgent';+import { getUserAgent } from './utils/userAgent';import { HttpsProxyAgent, SocksProxyAgent } from '../utilsBundle';import { BrowserContext, verifyClientCertificates } from './browserContext';import { CookieStore, domainMatches, parseRawCookie } from './cookieStore';diff --git a/packages/playwright-core/src/server/fileUploadUtils.ts b/packages/playwright-core/src/server/fileUploadUtils.tsindex 1c53812a0a..908e7644ac 100644--- a/packages/playwright-core/src/server/fileUploadUtils.ts+++ b/packages/playwright-core/src/server/fileUploadUtils.ts@@ -17,8 +17,8 @@import * as fs from 'fs';import * as path from 'path';-import { assert } from '../utils/debug';-import { fileUploadSizeLimit } from '../utils/fileUtils';+import { assert } from '../utils/isomorphic/debug';+import { fileUploadSizeLimit } from '../common/fileUtils';import { mime } from '../utilsBundle';import type { WritableStreamDispatcher } from './dispatchers/writableStreamDispatcher';diff --git a/packages/playwright-core/src/server/firefox/ffConnection.ts b/packages/playwright-core/src/server/firefox/ffConnection.tsindex 6001754219..1477ace249 100644--- a/packages/playwright-core/src/server/firefox/ffConnection.ts+++ b/packages/playwright-core/src/server/firefox/ffConnection.ts@@ -17,13 +17,13 @@import { EventEmitter } from 'events';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from '../utils/debugLogger';import { helper } from '../helper';import { ProtocolError } from '../protocolError';import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';import type { Protocol } from './protocol';-import type { RecentLogsCollector } from '../../utils/debugLogger';+import type { RecentLogsCollector } from '../utils/debugLogger';import type { ProtocolLogger } from '../types';diff --git a/packages/playwright-core/src/server/firefox/ffPage.ts b/packages/playwright-core/src/server/firefox/ffPage.tsindex c2b59ca08b..22229dff3e 100644--- a/packages/playwright-core/src/server/firefox/ffPage.ts+++ b/packages/playwright-core/src/server/firefox/ffPage.ts@@ -25,7 +25,7 @@ import { FFSession } from './ffConnection';import { FFExecutionContext } from './ffExecutionContext';import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './ffInput';import { FFNetworkManager } from './ffNetworkManager';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from '../utils/debugLogger';import { splitErrorMessage } from '../../utils/isomorphic/stackTrace';import { BrowserContext } from '../browserContext';import { TargetClosedError } from '../errors';diff --git a/packages/playwright-core/src/server/frames.ts b/packages/playwright-core/src/server/frames.tsindex 87bd4f9623..dee2ad7f08 100644--- a/packages/playwright-core/src/server/frames.ts+++ b/packages/playwright-core/src/server/frames.ts@@ -29,7 +29,7 @@ import { ProgressController } from './progress';import * as types from './types';import { LongStandingScope, asLocator, assert, compressCallLog, constructURLBasedOnBaseURL, makeWaitForNextTask, monotonicTime } from '../utils';import { isSessionClosedError } from './protocolError';-import { debugLogger } from '../utils/debugLogger';+import { debugLogger } from './utils/debugLogger';import { eventsHelper } from './utils/eventsHelper';import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';import { ManualPromise } from '../utils/isomorphic/manualPromise';diff --git a/packages/playwright-core/src/server/helper.ts b/packages/playwright-core/src/server/helper.tsindex da049e2be6..e9fec62419 100644--- a/packages/playwright-core/src/server/helper.ts+++ b/packages/playwright-core/src/server/helper.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { debugLogger } from '../utils/debugLogger';+import { debugLogger } from './utils/debugLogger';import { eventsHelper } from './utils/eventsHelper';import type { Progress } from './progress';diff --git a/packages/playwright-core/src/server/page.ts b/packages/playwright-core/src/server/page.tsindex 300cf05e50..d2db2e4211 100644--- a/packages/playwright-core/src/server/page.ts+++ b/packages/playwright-core/src/server/page.ts@@ -28,12 +28,12 @@ import { parseEvaluationResultValue, source } from './isomorphic/utilityScriptSeimport * as js from './javascript';import { ProgressController } from './progress';import { Screenshotter, validateScreenshotOptions } from './screenshotter';-import { TimeoutSettings } from '../common/timeoutSettings';+import { TimeoutSettings } from '../utils/isomorphic/timeoutSettings';import { LongStandingScope, assert, compressCallLog, trimStringWithEllipsis } from '../utils';import { createGuid } from './utils/crypto';import { asLocator } from '../utils';import { getComparator } from './utils/comparators';-import { debugLogger } from '../utils/debugLogger';+import { debugLogger } from './utils/debugLogger';import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';import { ManualPromise } from '../utils/isomorphic/manualPromise';diff --git a/packages/playwright-core/src/server/pipeTransport.ts b/packages/playwright-core/src/server/pipeTransport.tsindex 67bf126324..ba811e606e 100644--- a/packages/playwright-core/src/server/pipeTransport.ts+++ b/packages/playwright-core/src/server/pipeTransport.ts@@ -16,7 +16,7 @@*/import { makeWaitForNextTask } from '../utils';-import { debugLogger } from '../utils/debugLogger';+import { debugLogger } from './utils/debugLogger';import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';diff --git a/packages/playwright-core/src/server/progress.ts b/packages/playwright-core/src/server/progress.tsindex 9766c66ebd..30db144fbb 100644--- a/packages/playwright-core/src/server/progress.ts+++ b/packages/playwright-core/src/server/progress.ts@@ -20,7 +20,7 @@ import { ManualPromise } from '../utils/isomorphic/manualPromise';import type { CallMetadata, Instrumentation, SdkObject } from './instrumentation';import type { Progress as CommonProgress } from '../common/progress';-import type { LogName } from '../utils/debugLogger';+import type { LogName } from './utils/debugLogger';export interface Progress extends CommonProgress {metadata: CallMetadata;diff --git a/packages/playwright-core/src/server/recorder/recorderCollection.ts b/packages/playwright-core/src/server/recorder/recorderCollection.tsindex 454fa05b90..8c7b344b8e 100644--- a/packages/playwright-core/src/server/recorder/recorderCollection.ts+++ b/packages/playwright-core/src/server/recorder/recorderCollection.ts@@ -18,7 +18,7 @@ import { EventEmitter } from 'events';import { performAction } from './recorderRunner';import { collapseActions } from './recorderUtils';-import { isUnderTest } from '../../utils/debug';+import { isUnderTest } from '../../utils/isomorphic/debug';import { monotonicTime } from '../../utils/isomorphic/time';import type { Signal } from '../../../../recorder/src/actions';diff --git a/packages/playwright-core/src/server/registry/browserFetcher.ts b/packages/playwright-core/src/server/registry/browserFetcher.tsindex 0e7809cadb..fb6afb3f10 100644--- a/packages/playwright-core/src/server/registry/browserFetcher.ts+++ b/packages/playwright-core/src/server/registry/browserFetcher.ts@@ -20,9 +20,9 @@ import * as fs from 'fs';import * as os from 'os';import * as path from 'path';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from '../utils/debugLogger';import { ManualPromise } from '../../utils/isomorphic/manualPromise';-import { getUserAgent } from '../../utils/userAgent';+import { getUserAgent } from '../utils/userAgent';import { progress as ProgressBar } from '../../utilsBundle';import { colors } from '../../utils/isomorphic/colors';import { existsAsync } from '../utils/fileUtils';diff --git a/packages/playwright-core/src/server/registry/dependencies.ts b/packages/playwright-core/src/server/registry/dependencies.tsindex e405d75c6f..5cf4a097b1 100644--- a/packages/playwright-core/src/server/registry/dependencies.ts+++ b/packages/playwright-core/src/server/registry/dependencies.ts@@ -21,9 +21,9 @@ import * as path from 'path';import { deps } from './nativeDeps';import { wrapInASCIIBox } from '../utils/ascii';-import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';+import { hostPlatform, isOfficiallySupportedPlatform } from '../utils/hostPlatform';import { spawnAsync } from '../utils/spawnAsync';-import { getPlaywrightVersion } from '../../utils/userAgent';+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 87804f06dd..e0282120fb 100644--- a/packages/playwright-core/src/server/registry/index.ts+++ b/packages/playwright-core/src/server/registry/index.ts@@ -25,16 +25,16 @@ import { dockerVersion, readDockerVersionSync, transformCommandsForRoot } from 'import { installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';import { calculateSha1, getAsBooleanFromENV, getFromENV, getPackageManagerExecCommand } from '../../utils';import { wrapInASCIIBox } from '../utils/ascii';-import { debugLogger } from '../../utils/debugLogger';-import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';+import { debugLogger } from '../utils/debugLogger';+import { hostPlatform, isOfficiallySupportedPlatform } from '../utils/hostPlatform';import { fetchData } from '../utils/network';import { spawnAsync } from '../utils/spawnAsync';-import { getEmbedderName } from '../../utils/userAgent';+import { getEmbedderName } from '../utils/userAgent';import { lockfile } from '../../utilsBundle';import { canAccessFile, existsAsync, removeFolders } from '../utils/fileUtils';import type { DependencyGroup } from './dependencies';-import type { HostPlatform } from '../../utils/hostPlatform';+import type { HostPlatform } from '../utils/hostPlatform';export { writeDockerVersion } from './dependencies';diff --git a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.tsindex b1943ca123..f769f60d74 100644--- a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts+++ b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts@@ -24,7 +24,7 @@ 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 { debugLogger } from './utils/debugLogger';import { createSocket, createTLSSocket } from './utils/happyEyeballs';import type * as types from './types';diff --git a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts b/packages/playwright-core/src/server/trace/recorder/snapshotter.tsindex 9a914e1ad4..f4e288d077 100644--- a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts+++ b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts@@ -17,7 +17,7 @@import { frameSnapshotStreamer } from './snapshotterInjected';import { monotonicTime } from '../../../utils/isomorphic/time';import { calculateSha1, createGuid } from '../../utils/crypto';-import { debugLogger } from '../../../utils/debugLogger';+import { debugLogger } from '../../utils/debugLogger';import { eventsHelper } from '../../utils/eventsHelper';import { mime } from '../../../utilsBundle';import { BrowserContext } from '../../browserContext';diff --git a/packages/playwright-core/src/server/trace/recorder/tracing.ts b/packages/playwright-core/src/server/trace/recorder/tracing.tsindex 26e3075a29..309867f3b0 100644--- a/packages/playwright-core/src/server/trace/recorder/tracing.ts+++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts@@ -20,7 +20,7 @@ import * as path from 'path';import { Snapshotter } from './snapshotter';import { commandsWithTracingSnapshots } from '../../../protocol/debug';-import { assert } from '../../../utils/debug';+import { assert } from '../../../utils/isomorphic/debug';import { monotonicTime } from '../../../utils/isomorphic/time';import { eventsHelper } from '../../utils/eventsHelper';import { createGuid } from '../../utils/crypto';diff --git a/packages/playwright-core/src/server/utils/DEPS.list b/packages/playwright-core/src/server/utils/DEPS.listindex 8d1b7a30f2..685e00df46 100644--- a/packages/playwright-core/src/server/utils/DEPS.list+++ b/packages/playwright-core/src/server/utils/DEPS.list@@ -1,4 +1,5 @@[*]+../../common../../utils../../utils/isomorphic../../utilsBundle.tsdiff --git a/packages/playwright-core/src/server/utils/crypto.ts b/packages/playwright-core/src/server/utils/crypto.tsindex 0a35c3c8c9..7189f38b00 100644--- a/packages/playwright-core/src/server/utils/crypto.ts+++ b/packages/playwright-core/src/server/utils/crypto.ts@@ -16,7 +16,7 @@import * as crypto from 'crypto';-import { assert } from '../../utils/debug';+import { assert } from '../../utils/isomorphic/debug';export function createGuid(): string {return crypto.randomBytes(16).toString('hex');diff --git a/packages/playwright-core/src/utils/debugLogger.ts b/packages/playwright-core/src/server/utils/debugLogger.tssimilarity index 98%rename from packages/playwright-core/src/utils/debugLogger.tsrename to packages/playwright-core/src/server/utils/debugLogger.tsindex 24b0a1dbf8..8713b3cf7e 100644--- a/packages/playwright-core/src/utils/debugLogger.ts+++ b/packages/playwright-core/src/server/utils/debugLogger.ts@@ -16,7 +16,7 @@import * as fs from 'fs';-import { debug } from '../utilsBundle';+import { debug } from '../../utilsBundle';const debugLoggerColorMap = {'api': 45, // cyandiff --git a/packages/playwright-core/src/utils/env.ts b/packages/playwright-core/src/server/utils/env.tssimilarity index 100%rename from packages/playwright-core/src/utils/env.tsrename to packages/playwright-core/src/server/utils/env.tsdiff --git a/packages/playwright-core/src/server/utils/happyEyeballs.ts b/packages/playwright-core/src/server/utils/happyEyeballs.tsindex a5c6087513..da3481f4c1 100644--- a/packages/playwright-core/src/server/utils/happyEyeballs.ts+++ b/packages/playwright-core/src/server/utils/happyEyeballs.ts@@ -20,7 +20,7 @@ import * as https from 'https';import * as net from 'net';import * as tls from 'tls';-import { assert } from '../../utils/debug';+import { assert } from '../../utils/isomorphic/debug';import { ManualPromise } from '../../utils/isomorphic/manualPromise';import { monotonicTime } from '../../utils/isomorphic/time';diff --git a/packages/playwright-core/src/utils/hostPlatform.ts b/packages/playwright-core/src/server/utils/hostPlatform.tssimilarity index 100%rename from packages/playwright-core/src/utils/hostPlatform.tsrename to packages/playwright-core/src/server/utils/hostPlatform.tsdiff --git a/packages/playwright-core/src/server/utils/httpServer.ts b/packages/playwright-core/src/server/utils/httpServer.tsindex 21992195c0..0c9f0fe25a 100644--- a/packages/playwright-core/src/server/utils/httpServer.ts+++ b/packages/playwright-core/src/server/utils/httpServer.ts@@ -19,7 +19,7 @@ import * as path from 'path';import { mime, wsServer } from '../../utilsBundle';import { createGuid } from './crypto';-import { assert } from '../../utils/debug';+import { assert } from '../../utils/isomorphic/debug';import { ManualPromise } from '../../utils/isomorphic/manualPromise';import { createHttpServer } from './network';diff --git a/packages/playwright-core/src/utils/linuxUtils.ts b/packages/playwright-core/src/server/utils/linuxUtils.tssimilarity index 73%rename from packages/playwright-core/src/utils/linuxUtils.tsrename to packages/playwright-core/src/server/utils/linuxUtils.tsindex c51d32f9d5..3c85ebe091 100644--- a/packages/playwright-core/src/utils/linuxUtils.ts+++ b/packages/playwright-core/src/server/utils/linuxUtils.ts@@ -23,26 +23,6 @@ let osRelease: {version: string,} | undefined;-export async function getLinuxDistributionInfo(): Promise<{ id: string, version: string } | undefined> {- if (process.platform !== 'linux')- return undefined;- if (!osRelease && !didFailToReadOSRelease) {- try {- // List of /etc/os-release values for different distributions could be- // found here: https://gist.github.com/aslushnikov/8ceddb8288e4cf9db3039c02e0f4fb75- const osReleaseText = await fs.promises.readFile('/etc/os-release', 'utf8');- const fields = parseOSReleaseText(osReleaseText);- osRelease = {- id: fields.get('id') ?? '',- version: fields.get('version_id') ?? '',- };- } catch (e) {- didFailToReadOSRelease = true;- }- }- return osRelease;-}-export function getLinuxDistributionInfoSync(): { id: string, version: string } | undefined {if (process.platform !== 'linux')return undefined;diff --git a/packages/playwright-core/src/server/utils/nodePlatform.ts b/packages/playwright-core/src/server/utils/nodePlatform.tsnew file mode 100644index 0000000000..1a6f2ddc25--- /dev/null+++ b/packages/playwright-core/src/server/utils/nodePlatform.ts@@ -0,0 +1,49 @@+/**+ * 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.+ */++import * as crypto from 'crypto';+import * as fs from 'fs';+import * as path from 'path';+import * as util from 'util';++import { Platform } from '../../common/platform';+import { debugLogger } from './debugLogger';++export const nodePlatform: Platform = {+ calculateSha1: (text: string) => {+ const sha1 = crypto.createHash('sha1');+ sha1.update(text);+ return Promise.resolve(sha1.digest('hex'));+ },++ createGuid: () => crypto.randomBytes(16).toString('hex'),++ fs: () => fs,++ inspectCustom: util.inspect.custom,++ isLogEnabled(name: 'api' | 'channel') {+ return debugLogger.isEnabled(name);+ },++ log(name: 'api' | 'channel', message: string | Error | object) {+ debugLogger.log(name, message);+ },++ path: () => path,++ pathSeparator: path.sep+};diff --git a/packages/playwright-core/src/server/utils/socksProxy.ts b/packages/playwright-core/src/server/utils/socksProxy.tsindex 49dab675f6..c0fe0f126a 100644--- a/packages/playwright-core/src/server/utils/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 } from '../../utils/debug';+import { assert } from '../../utils/isomorphic/debug';import { createGuid } from './crypto';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from './debugLogger';import { createSocket } from './happyEyeballs';import type { AddressInfo } from 'net';diff --git a/packages/playwright-core/src/utils/userAgent.ts b/packages/playwright-core/src/server/utils/userAgent.tssimilarity index 98%rename from packages/playwright-core/src/utils/userAgent.tsrename to packages/playwright-core/src/server/utils/userAgent.tsindex 7f3e3d2275..9676a5bae5 100644--- a/packages/playwright-core/src/utils/userAgent.ts+++ b/packages/playwright-core/src/server/utils/userAgent.ts@@ -77,6 +77,6 @@ export function getEmbedderName(): { embedderName: string, embedderVersion: stri}export function getPlaywrightVersion(majorMinorOnly = false): string {- const version = process.env.PW_VERSION_OVERRIDE || require('./../../package.json').version;+ const version = process.env.PW_VERSION_OVERRIDE || require('./../../../package.json').version;return majorMinorOnly ? version.split('.').slice(0, 2).join('.') : version;}diff --git a/packages/playwright-core/src/server/utils/wsServer.ts b/packages/playwright-core/src/server/utils/wsServer.tsindex b223802a1b..68362f14de 100644--- a/packages/playwright-core/src/server/utils/wsServer.ts+++ b/packages/playwright-core/src/server/utils/wsServer.ts@@ -16,7 +16,7 @@import { createHttpServer } from './network';import { wsServer } from '../../utilsBundle';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from './debugLogger';import type { WebSocket, WebSocketServer } from '../../utilsBundle';import type http from 'http';diff --git a/packages/playwright-core/src/server/webkit/wkConnection.ts b/packages/playwright-core/src/server/webkit/wkConnection.tsindex 0012d8702f..ada50a413b 100644--- a/packages/playwright-core/src/server/webkit/wkConnection.ts+++ b/packages/playwright-core/src/server/webkit/wkConnection.ts@@ -18,13 +18,13 @@import { EventEmitter } from 'events';import { assert } from '../../utils';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from '../utils/debugLogger';import { helper } from '../helper';import { ProtocolError } from '../protocolError';import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';import type { Protocol } from './protocol';-import type { RecentLogsCollector } from '../../utils/debugLogger';+import type { RecentLogsCollector } from '../utils/debugLogger';import type { ProtocolLogger } from '../types';diff --git a/packages/playwright-core/src/server/webkit/wkPage.ts b/packages/playwright-core/src/server/webkit/wkPage.tsindex 91a5054123..f9e9517fb2 100644--- a/packages/playwright-core/src/server/webkit/wkPage.ts+++ b/packages/playwright-core/src/server/webkit/wkPage.ts@@ -21,7 +21,7 @@ import { assert, debugAssert } from '../../utils';import { headersArrayToObject } from '../../utils/isomorphic/headers';import { createGuid } from '../utils/crypto';import { eventsHelper } from '../utils/eventsHelper';-import { hostPlatform } from '../../utils/hostPlatform';+import { hostPlatform } from '../utils/hostPlatform';import { splitErrorMessage } from '../../utils/isomorphic/stackTrace';import { PNG, jpegjs } from '../../utilsBundle';import { BrowserContext } from '../browserContext';@@ -39,7 +39,7 @@ import { RawKeyboardImpl, RawMouseImpl, RawTouchscreenImpl } from './wkInput';import { WKInterceptableRequest, WKRouteImpl } from './wkInterceptableRequest';import { WKProvisionalPage } from './wkProvisionalPage';import { WKWorkers } from './wkWorkers';-import { debugLogger } from '../../utils/debugLogger';+import { debugLogger } from '../utils/debugLogger';import type { Protocol } from './protocol';import type { WKBrowserContext } from './wkBrowser';diff --git a/packages/playwright-core/src/utils.ts b/packages/playwright-core/src/utils.tsindex 62058f3451..b4829cb78c 100644--- a/packages/playwright-core/src/utils.ts+++ b/packages/playwright-core/src/utils.ts@@ -15,6 +15,7 @@*/export * from './utils/isomorphic/colors';+export * from './utils/isomorphic/debug';export * from './utils/isomorphic/locatorGenerators';export * from './utils/isomorphic/manualPromise';export * from './utils/isomorphic/mimeType';@@ -25,29 +26,27 @@ export * from './utils/isomorphic/time';export * from './utils/isomorphic/timeoutRunner';export * from './utils/isomorphic/urlMatch';-export * from './utils/debug';-export * from './utils/debugLogger';-export * from './utils/env';-export * from './utils/hostPlatform';export * from './utils/isomorphic/headers';export * from './utils/isomorphic/semaphore';-export * from './utils/platform';export * from './utils/isomorphic/stackTrace';export * from './utils/task';-export * from './utils/userAgent';export * from './utils/zipFile';export * from './utils/zones';export * from './server/utils/ascii';export * from './server/utils/comparators';export * from './server/utils/crypto';+export * from './server/utils/debugLogger';+export * from './server/utils/env';export * from './server/utils/eventsHelper';export * from './server/utils/expectUtils';export * from './server/utils/fileUtils';+export * from './server/utils/hostPlatform';export * from './server/utils/httpServer';export * from './server/utils/network';export * from './server/utils/processLauncher';export * from './server/utils/profiler';export * from './server/utils/socksProxy';export * from './server/utils/spawnAsync';+export * from './server/utils/userAgent';export * from './server/utils/wsServer';diff --git a/packages/playwright-core/src/utils/debug.ts b/packages/playwright-core/src/utils/isomorphic/debug.tssimilarity index 83%rename from packages/playwright-core/src/utils/debug.tsrename to packages/playwright-core/src/utils/isomorphic/debug.tsindex 2e199b3a31..1eec988aa9 100644--- a/packages/playwright-core/src/utils/debug.ts+++ b/packages/playwright-core/src/utils/isomorphic/debug.ts@@ -14,8 +14,6 @@* limitations under the License.*/-import { getFromENV } from './env';-export function assert(value: any, message?: string): asserts value {if (!value)throw new Error(message || 'Assertion error');@@ -26,13 +24,18 @@ export function debugAssert(value: any, message?: string): asserts value {throw new Error(message);}-const debugEnv = getFromENV('PWDEBUG') || '';+let _debugMode: string | undefined;++export function setDebugMode(mode: string) {+ _debugMode = mode;+}+export function debugMode() {- if (debugEnv === 'console')+ if (_debugMode === 'console')return 'console';- if (debugEnv === '0' || debugEnv === 'false')+ if (_debugMode === '0' || _debugMode === 'false')return '';- return debugEnv ? 'inspector' : '';+ return _debugMode ? 'inspector' : '';}let _isUnderTest = !!process.env.PWTEST_UNDER_TEST;diff --git a/packages/playwright-core/src/common/timeoutSettings.ts b/packages/playwright-core/src/utils/isomorphic/timeoutSettings.tssimilarity index 98%rename from packages/playwright-core/src/common/timeoutSettings.tsrename to packages/playwright-core/src/utils/isomorphic/timeoutSettings.tsindex 65c8be1ecf..02c02a33b5 100644--- a/packages/playwright-core/src/common/timeoutSettings.ts+++ b/packages/playwright-core/src/utils/isomorphic/timeoutSettings.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { debugMode } from '../utils';+import { debugMode } from './debug';export const DEFAULT_TIMEOUT = 30000;export const DEFAULT_LAUNCH_TIMEOUT = 3 * 60 * 1000; // 3 minutesdiff --git a/tests/library/browsertype-connect.spec.ts b/tests/library/browsertype-connect.spec.tsindex c0475ab57e..1298e38b5e 100644--- a/tests/library/browsertype-connect.spec.ts+++ b/tests/library/browsertype-connect.spec.ts@@ -19,7 +19,7 @@ import fs from 'fs';import type http from 'http';import type net from 'net';import * as path from 'path';-import { getUserAgent, getPlaywrightVersion } from '../../packages/playwright-core/lib/utils/userAgent';+import { getUserAgent, getPlaywrightVersion } from '../../packages/playwright-core/lib/server/utils/userAgent';import WebSocket from 'ws';import { expect, playwrightTest } from '../config/browserTest';import { parseTrace, suppressCertificateWarning } from '../config/utils';diff --git a/tests/library/capabilities.spec.ts b/tests/library/capabilities.spec.tsindex 29328f3f80..8b065834ab 100644--- a/tests/library/capabilities.spec.ts+++ b/tests/library/capabilities.spec.ts@@ -17,7 +17,7 @@import os from 'os';import url from 'url';import { contextTest as it, expect } from '../config/browserTest';-import { hostPlatform } from '../../packages/playwright-core/src/utils/hostPlatform';+import { hostPlatform } from '../../packages/playwright-core/src/server/utils/hostPlatform';it('SharedArrayBuffer should work @smoke', async function({ contextFactory, httpsServer }) {const context = await contextFactory({ ignoreHTTPSErrors: true });diff --git a/tests/library/chromium/connect-over-cdp.spec.ts b/tests/library/chromium/connect-over-cdp.spec.tsindex f31f60baf0..3191403be8 100644--- a/tests/library/chromium/connect-over-cdp.spec.ts+++ b/tests/library/chromium/connect-over-cdp.spec.ts@@ -18,7 +18,7 @@import { playwrightTest as test, expect } from '../../config/browserTest';import http from 'http';import fs from 'fs';-import { getUserAgent } from '../../../packages/playwright-core/lib/utils/userAgent';+import { getUserAgent } from '../../../packages/playwright-core/lib/server/utils/userAgent';import { suppressCertificateWarning } from '../../config/utils';test.skip(({ mode }) => mode === 'service2');diff --git a/tests/library/events/check-listener-leaks.spec.ts b/tests/library/events/check-listener-leaks.spec.tsindex d9b51f27ef..5a328d720f 100644--- a/tests/library/events/check-listener-leaks.spec.ts+++ b/tests/library/events/check-listener-leaks.spec.ts@@ -22,7 +22,7 @@import events from 'events';import { EventEmitter } from '../../../packages/playwright-core/lib/client/eventEmitter';-import { setUnderTest } from '../../../packages/playwright-core/lib/utils/debug';+import { setUnderTest } from '../../../packages/playwright-core/lib/utils/isomorphic/debug';import { test, expect } from '@playwright/test';import * as common from './utils';diff --git a/tests/library/global-fetch.spec.ts b/tests/library/global-fetch.spec.tsindex 0ad73bb9b6..9a402ed152 100644--- a/tests/library/global-fetch.spec.ts+++ b/tests/library/global-fetch.spec.ts@@ -16,7 +16,7 @@import os from 'os';import * as util from 'util';-import { getPlaywrightVersion } from '../../packages/playwright-core/lib/utils/userAgent';+import { getPlaywrightVersion } from '../../packages/playwright-core/lib/server/utils/userAgent';import { expect, playwrightTest as base } from '../config/browserTest';import { kTargetClosedErrorMessage } from 'tests/config/errors';diff --git a/tests/library/inspector/inspectorTest.ts b/tests/library/inspector/inspectorTest.tsindex fa13420fc3..c2ed97d50e 100644--- a/tests/library/inspector/inspectorTest.ts+++ b/tests/library/inspector/inspectorTest.ts@@ -22,7 +22,7 @@ import type { Source } from '../../../packages/recorder/src/recorderTypes';import type { CommonFixtures, TestChildProcess } from '../../config/commonFixtures';import { stripAnsi } from '../../config/utils';import { expect } from '@playwright/test';-import { nodePlatform } from '../../../packages/playwright-core/lib/utils/platform';+import { nodePlatform } from '../../../packages/playwright-core/lib/server/utils/nodePlatform';export { expect } from '@playwright/test';type CLITestArgs = {diff --git a/tests/library/modernizr.spec.ts b/tests/library/modernizr.spec.tsindex c0a06f3714..0a1b124301 100644--- a/tests/library/modernizr.spec.ts+++ b/tests/library/modernizr.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { hostPlatform } from '../../packages/playwright-core/src/utils/hostPlatform';+import { hostPlatform } from '../../packages/playwright-core/src/server/utils/hostPlatform';import { browserTest as it, expect } from '../config/browserTest';import fs from 'fs';import os from 'os';diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.tsindex bf78efc7c8..a8846e69ae 100644--- a/tests/playwright-test/reporter-blob.spec.ts+++ b/tests/playwright-test/reporter-blob.spec.ts@@ -23,7 +23,7 @@ import { startHtmlReportServer } from '../../packages/playwright/lib/reporters/himport { expect as baseExpect, test as baseTest, stripAnsi } from './playwright-test-fixtures';import extractZip from '../../packages/playwright-core/bundles/zip/node_modules/extract-zip';import * as yazl from '../../packages/playwright-core/bundles/zip/node_modules/yazl';-import { getUserAgent } from '../../packages/playwright-core/lib/utils/userAgent';+import { getUserAgent } from '../../packages/playwright-core/lib/server/utils/userAgent';import { Readable } from 'stream';const DOES_NOT_SUPPORT_UTF8_IN_TERMINAL = process.platform === 'win32' && process.env.TERM_PROGRAM !== 'vscode' && !process.env.WT_SESSION;