Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: move utils that are user in server to server/utils (3) (#34739)

Pavel Feldmanf54478a23e0d
diff --git a/packages/playwright-core/src/DEPS.list b/packages/playwright-core/src/DEPS.list
index 026473f98a..ec14e89070 100644
--- a/packages/playwright-core/src/DEPS.list
+++ b/packages/playwright-core/src/DEPS.list
@@ -14,4 +14,6 @@ utils/
client/
protocol/
utils/
-common/
\ No newline at end of file
+utils/isomorphic
+server/utils
+common/
diff --git a/packages/playwright-core/src/cli/driver.ts b/packages/playwright-core/src/cli/driver.ts
index 2b49b65ee7..1e16de00bf 100644
--- a/packages/playwright-core/src/cli/driver.ts
+++ b/packages/playwright-core/src/cli/driver.ts
@@ -19,7 +19,7 @@
import * as fs from 'fs';
import * as playwright from '../..';
-import { PipeTransport } from '../protocol/transport';
+import { PipeTransport } from '../utils/pipeTransport';
import { PlaywrightServer } from '../remote/playwrightServer';
import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from '../server';
import { gracefullyProcessExitDoNotHang } from '../server/utils/processLauncher';
diff --git a/packages/playwright-core/src/client/android.ts b/packages/playwright-core/src/client/android.ts
index 7f062143fc..f6e0419c2c 100644
--- a/packages/playwright-core/src/client/android.ts
+++ b/packages/playwright-core/src/client/android.ts
@@ -22,9 +22,9 @@ import { TargetClosedError, isTargetClosedError } from './errors';
import { Events } from './events';
import { Waiter } from './waiter';
import { TimeoutSettings } from '../common/timeoutSettings';
-import { isRegExp, isString } from '../utils/rtti';
-import { monotonicTime } from '../utils/time';
-import { raceAgainstDeadline } from '../utils/timeoutRunner';
+import { isRegExp, isString } from '../utils/isomorphic/rtti';
+import { monotonicTime } from '../utils/isomorphic/time';
+import { raceAgainstDeadline } from '../utils/isomorphic/timeoutRunner';
import type { Page } from './page';
import type * as types from './types';
diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.ts
index d625135f73..7c0210ceaf 100644
--- a/packages/playwright-core/src/client/browserContext.ts
+++ b/packages/playwright-core/src/client/browserContext.ts
@@ -36,9 +36,9 @@ import { WebError } from './webError';
import { Worker } from './worker';
import { TimeoutSettings } from '../common/timeoutSettings';
import { mkdirIfNeeded } from '../utils/fileUtils';
-import { headersObjectToArray } from '../utils/headers';
+import { headersObjectToArray } from '../utils/isomorphic/headers';
import { urlMatchesEqual } from '../utils/isomorphic/urlMatch';
-import { isRegExp, isString } from '../utils/rtti';
+import { isRegExp, isString } from '../utils/isomorphic/rtti';
import { rewriteErrorMessage } from '../utils/stackTrace';
import type { BrowserType } from './browserType';
diff --git a/packages/playwright-core/src/client/browserType.ts b/packages/playwright-core/src/client/browserType.ts
index 9afdb8dc0a..79d2fbd521 100644
--- a/packages/playwright-core/src/client/browserType.ts
+++ b/packages/playwright-core/src/client/browserType.ts
@@ -22,9 +22,9 @@ import { ChannelOwner } from './channelOwner';
import { envObjectToArray } from './clientHelper';
import { Events } from './events';
import { assert } from '../utils/debug';
-import { headersObjectToArray } from '../utils/headers';
-import { monotonicTime } from '../utils/time';
-import { raceAgainstDeadline } from '../utils/timeoutRunner';
+import { headersObjectToArray } from '../utils/isomorphic/headers';
+import { monotonicTime } from '../utils/isomorphic/time';
+import { raceAgainstDeadline } from '../utils/isomorphic/timeoutRunner';
import type { Playwright } from './playwright';
import type { ConnectOptions, LaunchOptions, LaunchPersistentContextOptions, LaunchServerOptions, Logger } from './types';
diff --git a/packages/playwright-core/src/client/clientHelper.ts b/packages/playwright-core/src/client/clientHelper.ts
index 4ae343224a..3ffe01034b 100644
--- a/packages/playwright-core/src/client/clientHelper.ts
+++ b/packages/playwright-core/src/client/clientHelper.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { isString } from '../utils/rtti';
+import { isString } from '../utils/isomorphic/rtti';
import type * as types from './types';
import type { Platform } from '../utils/platform';
diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.ts
index e39e4413e7..6bca1c7e82 100644
--- a/packages/playwright-core/src/client/elementHandle.ts
+++ b/packages/playwright-core/src/client/elementHandle.ts
@@ -21,7 +21,7 @@ import { Frame } from './frame';
import { JSHandle, parseResult, serializeArgument } from './jsHandle';
import { assert } from '../utils/debug';
import { fileUploadSizeLimit, mkdirIfNeeded } from '../utils/fileUtils';
-import { isString } from '../utils/rtti';
+import { isString } from '../utils/isomorphic/rtti';
import { mime } from '../utilsBundle';
import { WritableStream } from './writableStream';
diff --git a/packages/playwright-core/src/client/errors.ts b/packages/playwright-core/src/client/errors.ts
index 81f32080b7..5d1465261f 100644
--- a/packages/playwright-core/src/client/errors.ts
+++ b/packages/playwright-core/src/client/errors.ts
@@ -15,7 +15,7 @@
*/
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
-import { isError } from '../utils/rtti';
+import { isError } from '../utils/isomorphic/rtti';
import type { SerializedError } from '@protocol/channels';
diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.ts
index eba881a5ca..11c28e7c20 100644
--- a/packages/playwright-core/src/client/fetch.ts
+++ b/packages/playwright-core/src/client/fetch.ts
@@ -21,8 +21,8 @@ import { RawHeaders } from './network';
import { Tracing } from './tracing';
import { assert } from '../utils/debug';
import { mkdirIfNeeded } from '../utils/fileUtils';
-import { headersObjectToArray } from '../utils/headers';
-import { isString } from '../utils/rtti';
+import { headersObjectToArray } from '../utils/isomorphic/headers';
+import { isString } from '../utils/isomorphic/rtti';
import type { Playwright } from './playwright';
import type { ClientCertificate, FilePayload, Headers, SetStorageState, StorageState } from './types';
diff --git a/packages/playwright-core/src/client/locator.ts b/packages/playwright-core/src/client/locator.ts
index 04cfa5fadf..5d0f0aa0c3 100644
--- a/packages/playwright-core/src/client/locator.ts
+++ b/packages/playwright-core/src/client/locator.ts
@@ -19,8 +19,8 @@ import { parseResult, serializeArgument } from './jsHandle';
import { asLocator } from '../utils/isomorphic/locatorGenerators';
import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../utils/isomorphic/locatorUtils';
import { escapeForTextSelector } from '../utils/isomorphic/stringUtils';
-import { isString } from '../utils/rtti';
-import { monotonicTime } from '../utils/time';
+import { isString } from '../utils/isomorphic/rtti';
+import { monotonicTime } from '../utils/isomorphic/time';
import type { Frame } from './frame';
import type { FilePayload, FrameExpectParams, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.ts
index ae7c7bb251..20675492eb 100644
--- a/packages/playwright-core/src/client/network.ts
+++ b/packages/playwright-core/src/client/network.ts
@@ -24,11 +24,11 @@ import { Frame } from './frame';
import { Waiter } from './waiter';
import { Worker } from './worker';
import { assert } from '../utils/debug';
-import { headersObjectToArray } from '../utils/headers';
+import { headersObjectToArray } from '../utils/isomorphic/headers';
import { urlMatches } from '../utils/isomorphic/urlMatch';
-import { LongStandingScope, ManualPromise } from '../utils/manualPromise';
-import { MultiMap } from '../utils/multimap';
-import { isRegExp, isString } from '../utils/rtti';
+import { LongStandingScope, ManualPromise } from '../utils/isomorphic/manualPromise';
+import { MultiMap } from '../utils/isomorphic/multimap';
+import { isRegExp, isString } from '../utils/isomorphic/rtti';
import { rewriteErrorMessage } from '../utils/stackTrace';
import { zones } from '../utils/zones';
import { mime } from '../utilsBundle';
diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.ts
index d4bb32ffbd..d71afce060 100644
--- a/packages/playwright-core/src/client/page.ts
+++ b/packages/playwright-core/src/client/page.ts
@@ -36,11 +36,11 @@ import { Worker } from './worker';
import { TimeoutSettings } from '../common/timeoutSettings';
import { assert } from '../utils/debug';
import { mkdirIfNeeded } from '../utils/fileUtils';
-import { headersObjectToArray } from '../utils/headers';
+import { headersObjectToArray } from '../utils/isomorphic/headers';
import { trimStringWithEllipsis } from '../utils/isomorphic/stringUtils';
import { urlMatches, urlMatchesEqual } from '../utils/isomorphic/urlMatch';
-import { LongStandingScope } from '../utils/manualPromise';
-import { isObject, isRegExp, isString } from '../utils/rtti';
+import { LongStandingScope } from '../utils/isomorphic/manualPromise';
+import { isObject, isRegExp, isString } from '../utils/isomorphic/rtti';
import type { BrowserContext } from './browserContext';
import type { Clock } from './clock';
diff --git a/packages/playwright-core/src/client/video.ts b/packages/playwright-core/src/client/video.ts
index 993647dc72..1ff4065be7 100644
--- a/packages/playwright-core/src/client/video.ts
+++ b/packages/playwright-core/src/client/video.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { ManualPromise } from '../utils/manualPromise';
+import { ManualPromise } from '../utils/isomorphic/manualPromise';
import type { Artifact } from './artifact';
import type { Connection } from './connection';
diff --git a/packages/playwright-core/src/client/worker.ts b/packages/playwright-core/src/client/worker.ts
index ee9c2dcd6e..5a5a5fe246 100644
--- a/packages/playwright-core/src/client/worker.ts
+++ b/packages/playwright-core/src/client/worker.ts
@@ -18,7 +18,7 @@ import { ChannelOwner } from './channelOwner';
import { TargetClosedError } from './errors';
import { Events } from './events';
import { JSHandle, assertMaxArguments, parseResult, serializeArgument } from './jsHandle';
-import { LongStandingScope } from '../utils/manualPromise';
+import { LongStandingScope } from '../utils/isomorphic/manualPromise';
import type { BrowserContext } from './browserContext';
import type { Page } from './page';
diff --git a/packages/playwright-core/src/outofprocess.ts b/packages/playwright-core/src/outofprocess.ts
index 3af4065e1d..8dcb8fa45a 100644
--- a/packages/playwright-core/src/outofprocess.ts
+++ b/packages/playwright-core/src/outofprocess.ts
@@ -18,8 +18,8 @@ import * as childProcess from 'child_process';
import * as path from 'path';
import { Connection } from './client/connection';
-import { PipeTransport } from './protocol/transport';
-import { ManualPromise } from './utils/manualPromise';
+import { PipeTransport } from './utils/pipeTransport';
+import { ManualPromise } from './utils/isomorphic/manualPromise';
import { nodePlatform } from './utils/platform';
import type { Playwright } from './client/playwright';
diff --git a/packages/playwright-core/src/remote/DEPS.list b/packages/playwright-core/src/remote/DEPS.list
index 62660da37d..bf3843dca0 100644
--- a/packages/playwright-core/src/remote/DEPS.list
+++ b/packages/playwright-core/src/remote/DEPS.list
@@ -6,4 +6,5 @@
../server/dispatchers/
../server/utils/
../utils/
+../utils/isomorphic
../utilsBundle.ts
diff --git a/packages/playwright-core/src/remote/playwrightServer.ts b/packages/playwright-core/src/remote/playwrightServer.ts
index 06193a618a..911fa1b97c 100644
--- a/packages/playwright-core/src/remote/playwrightServer.ts
+++ b/packages/playwright-core/src/remote/playwrightServer.ts
@@ -17,7 +17,7 @@
import { PlaywrightConnection } from './playwrightConnection';
import { createPlaywright } from '../server/playwright';
import { debugLogger } from '../utils/debugLogger';
-import { Semaphore } from '../utils/semaphore';
+import { Semaphore } from '../utils/isomorphic/semaphore';
import { WSServer } from '../server/utils/wsServer';
import { wrapInASCIIBox } from '../server/utils/ascii';
import { getPlaywrightVersion } from '../utils/userAgent';
diff --git a/packages/playwright-core/src/server/android/android.ts b/packages/playwright-core/src/server/android/android.ts
index e47e115112..c3e2cbb22c 100644
--- a/packages/playwright-core/src/server/android/android.ts
+++ b/packages/playwright-core/src/server/android/android.ts
@@ -20,7 +20,7 @@ import * as os from 'os';
import * as path from 'path';
import { TimeoutSettings } from '../../common/timeoutSettings';
-import { PipeTransport } from '../../protocol/transport';
+import { PipeTransport } from '../../utils/pipeTransport';
import { createGuid, getPackageManagerExecCommand, isUnderTest, makeWaitForNextTask } from '../../utils';
import { RecentLogsCollector } from '../../utils/debugLogger';
import { debug } from '../../utilsBundle';
diff --git a/packages/playwright-core/src/server/artifact.ts b/packages/playwright-core/src/server/artifact.ts
index 26b97d4d56..703e2d9e89 100644
--- a/packages/playwright-core/src/server/artifact.ts
+++ b/packages/playwright-core/src/server/artifact.ts
@@ -19,7 +19,7 @@ import * as fs from 'fs';
import { assert } from '../utils';
import { TargetClosedError } from './errors';
import { SdkObject } from './instrumentation';
-import { ManualPromise } from '../utils/manualPromise';
+import { ManualPromise } from '../utils/isomorphic/manualPromise';
type SaveCallback = (localPath: string, error?: Error) => Promise<void>;
type CancelCallback = () => Promise<void>;
diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.ts
index ff5c4a826c..7c520aa213 100644
--- a/packages/playwright-core/src/server/chromium/chromium.ts
+++ b/packages/playwright-core/src/server/chromium/chromium.ts
@@ -26,7 +26,7 @@ import { TimeoutSettings } from '../../common/timeoutSettings';
import { debugMode, headersArrayToObject, headersObjectToArray, } from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { RecentLogsCollector } from '../../utils/debugLogger';
-import { ManualPromise } from '../../utils/manualPromise';
+import { ManualPromise } from '../../utils/isomorphic/manualPromise';
import { fetchData } from '../utils/network';
import { getUserAgent } from '../../utils/userAgent';
import { validateBrowserContextOptions } from '../browserContext';
diff --git a/packages/playwright-core/src/server/frames.ts b/packages/playwright-core/src/server/frames.ts
index 2183d3f409..8be38f885f 100644
--- a/packages/playwright-core/src/server/frames.ts
+++ b/packages/playwright-core/src/server/frames.ts
@@ -32,7 +32,7 @@ import { isSessionClosedError } from './protocolError';
import { debugLogger } from '../utils/debugLogger';
import { eventsHelper } from '../utils/eventsHelper';
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
-import { ManualPromise } from '../utils/manualPromise';
+import { ManualPromise } from '../utils/isomorphic/manualPromise';
import type { ConsoleMessage } from './console';
import type { Dialog } from './dialog';
diff --git a/packages/playwright-core/src/server/har/harRecorder.ts b/packages/playwright-core/src/server/har/harRecorder.ts
index 7cde24fa3a..94175de35c 100644
--- a/packages/playwright-core/src/server/har/harRecorder.ts
+++ b/packages/playwright-core/src/server/har/harRecorder.ts
@@ -20,7 +20,7 @@ import * as path from 'path';
import { Artifact } from '../artifact';
import { HarTracer } from './harTracer';
import { createGuid } from '../../utils';
-import { ManualPromise } from '../../utils/manualPromise';
+import { ManualPromise } from '../../utils/isomorphic/manualPromise';
import { yazl } from '../../zipBundle';
import type { BrowserContext } from '../browserContext';
diff --git a/packages/playwright-core/src/server/har/harTracer.ts b/packages/playwright-core/src/server/har/harTracer.ts
index 0e3a66b938..d046962199 100644
--- a/packages/playwright-core/src/server/har/harTracer.ts
+++ b/packages/playwright-core/src/server/har/harTracer.ts
@@ -17,7 +17,7 @@
import { assert, calculateSha1, monotonicTime } from '../../utils';
import { getPlaywrightVersion, isTextualMimeType, urlMatches } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
-import { ManualPromise } from '../../utils/manualPromise';
+import { ManualPromise } from '../../utils/isomorphic/manualPromise';
import { mime } from '../../utilsBundle';
import { BrowserContext } from '../browserContext';
import { APIRequestContext } from '../fetch';
diff --git a/packages/playwright-core/src/server/javascript.ts b/packages/playwright-core/src/server/javascript.ts
index 32ba84179e..a3d65f86a8 100644
--- a/packages/playwright-core/src/server/javascript.ts
+++ b/packages/playwright-core/src/server/javascript.ts
@@ -18,7 +18,7 @@ import { SdkObject } from './instrumentation';
import * as utilityScriptSource from '../generated/utilityScriptSource';
import { isUnderTest } from '../utils';
import { serializeAsCallArgument } from './isomorphic/utilityScriptSerializers';
-import { LongStandingScope } from '../utils/manualPromise';
+import { LongStandingScope } from '../utils/isomorphic/manualPromise';
import type * as dom from './dom';
import type { UtilityScript } from './injected/utilityScript';
diff --git a/packages/playwright-core/src/server/network.ts b/packages/playwright-core/src/server/network.ts
index 81e23abd82..dfee496fc2 100644
--- a/packages/playwright-core/src/server/network.ts
+++ b/packages/playwright-core/src/server/network.ts
@@ -18,7 +18,7 @@ import { assert } from '../utils';
import { BrowserContext } from './browserContext';
import { APIRequestContext } from './fetch';
import { SdkObject } from './instrumentation';
-import { ManualPromise } from '../utils/manualPromise';
+import { ManualPromise } from '../utils/isomorphic/manualPromise';
import type * as contexts from './browserContext';
import type * as frames from './frames';
diff --git a/packages/playwright-core/src/server/page.ts b/packages/playwright-core/src/server/page.ts
index ac7f6dfd81..730f1210de 100644
--- a/packages/playwright-core/src/server/page.ts
+++ b/packages/playwright-core/src/server/page.ts
@@ -34,7 +34,7 @@ import { asLocator } from '../utils';
import { getComparator } from './utils/comparators';
import { debugLogger } from '../utils/debugLogger';
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
-import { ManualPromise } from '../utils/manualPromise';
+import { ManualPromise } from '../utils/isomorphic/manualPromise';
import type { Artifact } from './artifact';
import type * as dom from './dom';
diff --git a/packages/playwright-core/src/server/progress.ts b/packages/playwright-core/src/server/progress.ts
index 1b18089233..9766c66ebd 100644
--- a/packages/playwright-core/src/server/progress.ts
+++ b/packages/playwright-core/src/server/progress.ts
@@ -16,7 +16,7 @@
import { TimeoutError } from './errors';
import { assert, monotonicTime } from '../utils';
-import { ManualPromise } from '../utils/manualPromise';
+import { ManualPromise } from '../utils/isomorphic/manualPromise';
import type { CallMetadata, Instrumentation, SdkObject } from './instrumentation';
import type { Progress as CommonProgress } from '../common/progress';
diff --git a/packages/playwright-core/src/server/recorder/contextRecorder.ts b/packages/playwright-core/src/server/recorder/contextRecorder.ts
index 5cc3e9abae..cede7bb28a 100644
--- a/packages/playwright-core/src/server/recorder/contextRecorder.ts
+++ b/packages/playwright-core/src/server/recorder/contextRecorder.ts
@@ -19,7 +19,7 @@ import { EventEmitter } from 'events';
import { RecorderCollection } from './recorderCollection';
import * as recorderSource from '../../generated/pollingRecorderSource';
import { eventsHelper, monotonicTime, quoteCSSAttributeValue } from '../../utils';
-import { raceAgainstDeadline } from '../../utils/timeoutRunner';
+import { raceAgainstDeadline } from '../../utils/isomorphic/timeoutRunner';
import { BrowserContext } from '../browserContext';
import { languageSet } from '../codegen/languages';
import { Frame } from '../frames';
diff --git a/packages/playwright-core/src/server/recorder/recorderCollection.ts b/packages/playwright-core/src/server/recorder/recorderCollection.ts
index 1780502d7d..454fa05b90 100644
--- a/packages/playwright-core/src/server/recorder/recorderCollection.ts
+++ b/packages/playwright-core/src/server/recorder/recorderCollection.ts
@@ -19,7 +19,7 @@ import { EventEmitter } from 'events';
import { performAction } from './recorderRunner';
import { collapseActions } from './recorderUtils';
import { isUnderTest } from '../../utils/debug';
-import { monotonicTime } from '../../utils/time';
+import { monotonicTime } from '../../utils/isomorphic/time';
import type { Signal } from '../../../../recorder/src/actions';
import type { Frame } from '../frames';
diff --git a/packages/playwright-core/src/server/registry/browserFetcher.ts b/packages/playwright-core/src/server/registry/browserFetcher.ts
index e7ffda483f..16cab16db1 100644
--- a/packages/playwright-core/src/server/registry/browserFetcher.ts
+++ b/packages/playwright-core/src/server/registry/browserFetcher.ts
@@ -21,7 +21,7 @@ import * as os from 'os';
import * as path from 'path';
import { debugLogger } from '../../utils/debugLogger';
-import { ManualPromise } from '../../utils/manualPromise';
+import { ManualPromise } from '../../utils/isomorphic/manualPromise';
import { getUserAgent } from '../../utils/userAgent';
import { colors, progress as ProgressBar } from '../../utilsBundle';
import { existsAsync } from '../utils/fileUtils';
diff --git a/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts b/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts
index ef6348aab2..bda904f47a 100644
--- a/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts
+++ b/packages/playwright-core/src/server/registry/oopDownloadBrowserMain.ts
@@ -17,7 +17,7 @@
import * as fs from 'fs';
import * as path from 'path';
-import { ManualPromise } from '../../utils/manualPromise';
+import { ManualPromise } from '../../utils/isomorphic/manualPromise';
import { httpRequest } from '../utils/network';
import { extract } from '../../zipBundle';
diff --git a/packages/playwright-core/src/server/screenshotter.ts b/packages/playwright-core/src/server/screenshotter.ts
index 88870b8900..b32f51a6de 100644
--- a/packages/playwright-core/src/server/screenshotter.ts
+++ b/packages/playwright-core/src/server/screenshotter.ts
@@ -17,7 +17,7 @@
import { helper } from './helper';
import { assert } from '../utils';
-import { MultiMap } from '../utils/multimap';
+import { MultiMap } from '../utils/isomorphic/multimap';
import type * as dom from './dom';
import type { Frame } from './frames';
diff --git a/packages/playwright-core/src/server/utils/DEPS.list b/packages/playwright-core/src/server/utils/DEPS.list
index 53cad9639a..8d1b7a30f2 100644
--- a/packages/playwright-core/src/server/utils/DEPS.list
+++ b/packages/playwright-core/src/server/utils/DEPS.list
@@ -1,9 +1,9 @@
[*]
../../utils
+../../utils/isomorphic
../../utilsBundle.ts
../../zipBundle.ts
[comparators.ts]
./image_tools
../../third_party/pixelmatch
-
diff --git a/packages/playwright-core/src/server/utils/fileUtils.ts b/packages/playwright-core/src/server/utils/fileUtils.ts
index 5f196963b7..0a0a95d2a1 100644
--- a/packages/playwright-core/src/server/utils/fileUtils.ts
+++ b/packages/playwright-core/src/server/utils/fileUtils.ts
@@ -17,7 +17,7 @@
import * as fs from 'fs';
import * as path from 'path';
-import { ManualPromise } from '../../utils/manualPromise';
+import { ManualPromise } from '../../utils/isomorphic/manualPromise';
import { yazl } from '../../zipBundle';
import type { EventEmitter } from 'events';
diff --git a/packages/playwright-core/src/server/utils/happyEyeballs.ts b/packages/playwright-core/src/server/utils/happyEyeballs.ts
index ba6188f97c..a5c6087513 100644
--- a/packages/playwright-core/src/server/utils/happyEyeballs.ts
+++ b/packages/playwright-core/src/server/utils/happyEyeballs.ts
@@ -21,8 +21,8 @@ import * as net from 'net';
import * as tls from 'tls';
import { assert } from '../../utils/debug';
-import { ManualPromise } from '../../utils/manualPromise';
-import { monotonicTime } from '../../utils/time';
+import { ManualPromise } from '../../utils/isomorphic/manualPromise';
+import { monotonicTime } from '../../utils/isomorphic/time';
// Implementation(partial) of Happy Eyeballs 2 algorithm described in
// https://www.rfc-editor.org/rfc/rfc8305
diff --git a/packages/playwright-core/src/server/utils/httpServer.ts b/packages/playwright-core/src/server/utils/httpServer.ts
index ee170eca33..6308ad67fa 100644
--- a/packages/playwright-core/src/server/utils/httpServer.ts
+++ b/packages/playwright-core/src/server/utils/httpServer.ts
@@ -20,7 +20,7 @@ import * as path from 'path';
import { mime, wsServer } from '../../utilsBundle';
import { createGuid } from '../../utils/crypto';
import { assert } from '../../utils/debug';
-import { ManualPromise } from '../../utils/manualPromise';
+import { ManualPromise } from '../../utils/isomorphic/manualPromise';
import { createHttpServer } from './network';
import type http from 'http';
diff --git a/packages/playwright-core/src/utils.ts b/packages/playwright-core/src/utils.ts
index 930acae092..0bfd82bd96 100644
--- a/packages/playwright-core/src/utils.ts
+++ b/packages/playwright-core/src/utils.ts
@@ -14,27 +14,28 @@
* limitations under the License.
*/
+export * from './utils/isomorphic/manualPromise';
+export * from './utils/isomorphic/locatorGenerators';
+export * from './utils/isomorphic/mimeType';
+export * from './utils/isomorphic/stringUtils';
+export * from './utils/isomorphic/urlMatch';
+export * from './utils/isomorphic/multimap';
+export * from './utils/isomorphic/rtti';
+export * from './utils/isomorphic/time';
+export * from './utils/isomorphic/timeoutRunner';
+
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/isomorphic/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/platform';
+export * from './utils/isomorphic/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';
diff --git a/packages/playwright-core/src/utils/DEPS.list b/packages/playwright-core/src/utils/DEPS.list
index 0e2297dfdb..8a14701d4d 100644
--- a/packages/playwright-core/src/utils/DEPS.list
+++ b/packages/playwright-core/src/utils/DEPS.list
@@ -1,4 +1,6 @@
[*]
./
+./isomorphic
../utilsBundle.ts
../zipBundle.ts
+../utils/isomorphic
\ No newline at end of file
diff --git a/packages/playwright-core/src/utils/expectUtils.ts b/packages/playwright-core/src/utils/expectUtils.ts
index f39af23cee..ebbdf8e867 100644
--- a/packages/playwright-core/src/utils/expectUtils.ts
+++ b/packages/playwright-core/src/utils/expectUtils.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { isRegExp, isString } from './rtti';
+import { isRegExp, isString } from './isomorphic/rtti';
import type { ExpectedTextValue } from '@protocol/channels';
diff --git a/packages/playwright-core/src/utils/headers.ts b/packages/playwright-core/src/utils/isomorphic/headers.ts
similarity index 100%
rename from packages/playwright-core/src/utils/headers.ts
rename to packages/playwright-core/src/utils/isomorphic/headers.ts
diff --git a/packages/playwright-core/src/utils/manualPromise.ts b/packages/playwright-core/src/utils/isomorphic/manualPromise.ts
similarity index 92%
rename from packages/playwright-core/src/utils/manualPromise.ts
rename to packages/playwright-core/src/utils/isomorphic/manualPromise.ts
index 467b8de0db..a5034e05ec 100644
--- a/packages/playwright-core/src/utils/manualPromise.ts
+++ b/packages/playwright-core/src/utils/isomorphic/manualPromise.ts
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import { captureRawStack } from './stackTrace';
-
export class ManualPromise<T = void> extends Promise<T> {
private _resolve!: (t: T) => void;
private _reject!: (e: Error) => void;
@@ -118,3 +116,12 @@ function cloneError(error: Error, frames: string[]) {
clone.stack = [error.name + ':' + error.message, ...frames].join('\n');
return clone;
}
+
+function captureRawStack(): string[] {
+ const stackTraceLimit = Error.stackTraceLimit;
+ Error.stackTraceLimit = 50;
+ const error = new Error();
+ const stack = error.stack || '';
+ Error.stackTraceLimit = stackTraceLimit;
+ return stack.split('\n');
+}
diff --git a/packages/playwright-core/src/utils/multimap.ts b/packages/playwright-core/src/utils/isomorphic/multimap.ts
similarity index 100%
rename from packages/playwright-core/src/utils/multimap.ts
rename to packages/playwright-core/src/utils/isomorphic/multimap.ts
diff --git a/packages/playwright-core/src/utils/rtti.ts b/packages/playwright-core/src/utils/isomorphic/rtti.ts
similarity index 95%
rename from packages/playwright-core/src/utils/rtti.ts
rename to packages/playwright-core/src/utils/isomorphic/rtti.ts
index a18d3a450a..0bcaef0748 100644
--- a/packages/playwright-core/src/utils/rtti.ts
+++ b/packages/playwright-core/src/utils/isomorphic/rtti.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-export { isString } from './isomorphic/stringUtils';
+export { isString } from './stringUtils';
export function isRegExp(obj: any): obj is RegExp {
return obj instanceof RegExp || Object.prototype.toString.call(obj) === '[object RegExp]';
diff --git a/packages/playwright-core/src/utils/semaphore.ts b/packages/playwright-core/src/utils/isomorphic/semaphore.ts
similarity index 100%
rename from packages/playwright-core/src/utils/semaphore.ts
rename to packages/playwright-core/src/utils/isomorphic/semaphore.ts
diff --git a/packages/playwright-core/src/utils/sequence.ts b/packages/playwright-core/src/utils/isomorphic/sequence.ts
similarity index 100%
rename from packages/playwright-core/src/utils/sequence.ts
rename to packages/playwright-core/src/utils/isomorphic/sequence.ts
diff --git a/packages/playwright-core/src/utils/isomorphic/time.ts b/packages/playwright-core/src/utils/isomorphic/time.ts
new file mode 100644
index 0000000000..625fd18805
--- /dev/null
+++ b/packages/playwright-core/src/utils/isomorphic/time.ts
@@ -0,0 +1,19 @@
+/**
+ * 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 function monotonicTime(): number {
+ return (performance.now() * 1000 | 0) / 1000;
+}
diff --git a/packages/playwright-core/src/utils/timeoutRunner.ts b/packages/playwright-core/src/utils/isomorphic/timeoutRunner.ts
similarity index 98%
rename from packages/playwright-core/src/utils/timeoutRunner.ts
rename to packages/playwright-core/src/utils/isomorphic/timeoutRunner.ts
index e8f128b9f8..e8016ddb49 100644
--- a/packages/playwright-core/src/utils/timeoutRunner.ts
+++ b/packages/playwright-core/src/utils/isomorphic/timeoutRunner.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { monotonicTime } from '../utils';
+import { monotonicTime } from './time';
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-core/src/utils/isomorphic/traceUtils.ts b/packages/playwright-core/src/utils/isomorphic/traceUtils.ts
index edb1e1c660..f077cc5c4b 100644
--- a/packages/playwright-core/src/utils/isomorphic/traceUtils.ts
+++ b/packages/playwright-core/src/utils/isomorphic/traceUtils.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { StackFrame } from '@protocol/channels';
+import type { ClientSideCallMetadata, StackFrame } from '@protocol/channels';
export type SerializedStackFrame = [number, number, number, string];
export type SerializedStack = [number, SerializedStackFrame[]];
@@ -33,3 +33,24 @@ export function parseClientSideCallMetadata(data: SerializedClientSideCallMetada
}
return result;
}
+
+export function serializeClientSideCallMetadata(metadatas: ClientSideCallMetadata[]): SerializedClientSideCallMetadata {
+ const fileNames = new Map<string, number>();
+ const stacks: SerializedStack[] = [];
+ for (const m of metadatas) {
+ if (!m.stack || !m.stack.length)
+ continue;
+ const stack: SerializedStackFrame[] = [];
+ for (const frame of m.stack) {
+ let ordinal = fileNames.get(frame.file);
+ if (typeof ordinal !== 'number') {
+ ordinal = fileNames.size;
+ fileNames.set(frame.file, ordinal);
+ }
+ const stackFrame: SerializedStackFrame = [ordinal, frame.line || 0, frame.column || 0, frame.function || ''];
+ stack.push(stackFrame);
+ }
+ stacks.push([m.id, stack]);
+ }
+ return { files: [...fileNames.keys()], stacks };
+}
diff --git a/packages/playwright-core/src/utils/localUtils.ts b/packages/playwright-core/src/utils/localUtils.ts
index d94a7da27e..91162a0301 100644
--- a/packages/playwright-core/src/utils/localUtils.ts
+++ b/packages/playwright-core/src/utils/localUtils.ts
@@ -20,11 +20,12 @@ import * as path from 'path';
import { removeFolders } from './fileUtils';
import { HarBackend } from './harBackend';
-import { ManualPromise } from './manualPromise';
+import { ManualPromise } from './isomorphic/manualPromise';
import { ZipFile } from './zipFile';
import { yauzl, yazl } from '../zipBundle';
-import { serializeClientSideCallMetadata } from '../utils';
-import { assert, calculateSha1 } from '../utils';
+import { serializeClientSideCallMetadata } from '../utils/isomorphic/traceUtils';
+import { assert } from '../utils/debug';
+import { calculateSha1 } from '../utils/crypto';
import type { Platform } from './platform';
import type * as channels from '@protocol/channels';
diff --git a/packages/playwright-core/src/protocol/transport.ts b/packages/playwright-core/src/utils/pipeTransport.ts
similarity index 95%
rename from packages/playwright-core/src/protocol/transport.ts
rename to packages/playwright-core/src/utils/pipeTransport.ts
index e647100c63..64b1d80e8f 100644
--- a/packages/playwright-core/src/protocol/transport.ts
+++ b/packages/playwright-core/src/utils/pipeTransport.ts
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-import { makeWaitForNextTask } from '../utils';
+import { makeWaitForNextTask } from './task';
-export interface WritableStream {
+interface WritableStream {
write(data: Buffer): void;
}
-export interface ReadableStream {
+interface ReadableStream {
on(event: 'data', callback: (b: Buffer) => void): void;
on(event: 'close', callback: () => void): void;
}
-export interface ClosableStream {
+interface ClosableStream {
close(): void;
}
diff --git a/packages/playwright-core/src/utils/stackTrace.ts b/packages/playwright-core/src/utils/stackTrace.ts
index fb97115035..d3331698d1 100644
--- a/packages/playwright-core/src/utils/stackTrace.ts
+++ b/packages/playwright-core/src/utils/stackTrace.ts
@@ -17,15 +17,13 @@
import * as path from 'path';
import { colors } from '../utilsBundle';
-import { findRepeatedSubsequences } from './sequence';
-import { StackUtils } from './stackUtils';
+import { findRepeatedSubsequences } from './isomorphic/sequence';
+import { parseStackFrame } from './stackUtils';
import type { StackFrame } from '@protocol/channels';
-const stackUtils = new StackUtils();
-
export function parseStackTraceLine(line: string): StackFrame | null {
- const frame = stackUtils.parseLine(line);
+ const frame = parseStackFrame(line);
if (!frame)
return null;
if (!process.env.PWDEBUGIMPL && (frame.file?.startsWith('internal') || frame.file?.startsWith('node:')))
diff --git a/packages/playwright-core/src/utils/stackUtils.ts b/packages/playwright-core/src/utils/stackUtils.ts
index 0be4675a86..024b6fe8d0 100644
--- a/packages/playwright-core/src/utils/stackUtils.ts
+++ b/packages/playwright-core/src/utils/stackUtils.ts
@@ -35,84 +35,82 @@ type StackData = {
evalFile?: string | undefined;
};
-export class StackUtils {
- parseLine(line: string) {
- const match = line && line.match(re);
- if (!match)
- return null;
-
- const ctor = match[1] === 'new';
- let fname = match[2];
- const evalOrigin = match[3];
- const evalFile = match[4];
- const evalLine = Number(match[5]);
- const evalCol = Number(match[6]);
- let file = match[7];
- const lnum = match[8];
- const col = match[9];
- const native = match[10] === 'native';
- const closeParen = match[11] === ')';
- let method;
-
- const res: StackData = {};
-
- if (lnum)
- res.line = Number(lnum);
-
- if (col)
- res.column = Number(col);
-
- if (closeParen && file) {
- // make sure parens are balanced
- // if we have a file like "asdf) [as foo] (xyz.js", then odds are
- // that the fname should be += " (asdf) [as foo]" and the file
- // should be just "xyz.js"
- // walk backwards from the end to find the last unbalanced (
- let closes = 0;
- for (let i = file.length - 1; i > 0; i--) {
- if (file.charAt(i) === ')') {
- closes++;
- } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
- closes--;
- if (closes === -1 && file.charAt(i - 1) === ' ') {
- const before = file.slice(0, i - 1);
- const after = file.slice(i + 1);
- file = after;
- fname += ` (${before}`;
- break;
- }
+export function parseStackFrame(line: string): StackData | null {
+ const match = line && line.match(re);
+ if (!match)
+ return null;
+
+ const ctor = match[1] === 'new';
+ let fname = match[2];
+ const evalOrigin = match[3];
+ const evalFile = match[4];
+ const evalLine = Number(match[5]);
+ const evalCol = Number(match[6]);
+ let file = match[7];
+ const lnum = match[8];
+ const col = match[9];
+ const native = match[10] === 'native';
+ const closeParen = match[11] === ')';
+ let method;
+
+ const res: StackData = {};
+
+ if (lnum)
+ res.line = Number(lnum);
+
+ if (col)
+ res.column = Number(col);
+
+ if (closeParen && file) {
+ // make sure parens are balanced
+ // if we have a file like "asdf) [as foo] (xyz.js", then odds are
+ // that the fname should be += " (asdf) [as foo]" and the file
+ // should be just "xyz.js"
+ // walk backwards from the end to find the last unbalanced (
+ let closes = 0;
+ for (let i = file.length - 1; i > 0; i--) {
+ if (file.charAt(i) === ')') {
+ closes++;
+ } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
+ closes--;
+ if (closes === -1 && file.charAt(i - 1) === ' ') {
+ const before = file.slice(0, i - 1);
+ const after = file.slice(i + 1);
+ file = after;
+ fname += ` (${before}`;
+ break;
}
}
}
+ }
- if (fname) {
- const methodMatch = fname.match(methodRe);
- if (methodMatch) {
- fname = methodMatch[1];
- method = methodMatch[2];
- }
+ if (fname) {
+ const methodMatch = fname.match(methodRe);
+ if (methodMatch) {
+ fname = methodMatch[1];
+ method = methodMatch[2];
}
+ }
- setFile(res, file);
-
- if (ctor)
- res.isConstructor = true;
+ setFile(res, file);
- if (evalOrigin) {
- res.evalOrigin = evalOrigin;
- res.evalLine = evalLine;
- res.evalColumn = evalCol;
- res.evalFile = evalFile && evalFile.replace(/\\/g, '/');
- }
+ if (ctor)
+ res.isConstructor = true;
- if (native)
- res.native = true;
- if (fname)
- res.function = fname;
- if (method && fname !== method)
- res.method = method;
- return res;
+ if (evalOrigin) {
+ res.evalOrigin = evalOrigin;
+ res.evalLine = evalLine;
+ res.evalColumn = evalCol;
+ res.evalFile = evalFile && evalFile.replace(/\\/g, '/');
}
+
+ if (native)
+ res.native = true;
+ if (fname)
+ res.function = fname;
+ if (method && fname !== method)
+ res.method = method;
+ return res;
}
function setFile(result: StackData, filename: string) {
diff --git a/packages/playwright-core/src/utils/time.ts b/packages/playwright-core/src/utils/time.ts
deleted file mode 100644
index d00ee62e82..0000000000
--- a/packages/playwright-core/src/utils/time.ts
+++ /dev/null
@@ -1,32 +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.
- */
-
-// The `process.hrtime()` returns a time from some arbitrary
-// date in the past; on certain systems, this is the time from the system boot.
-// The `monotonicTime()` converts this to milliseconds.
-//
-// For a Linux server with uptime of 36 days, the `monotonicTime()` value
-// will be 36 * 86400 * 1000 = 3_110_400_000, which is larger than
-// the maximum value that `setTimeout` accepts as an argument: 2_147_483_647.
-//
-// To make the `monotonicTime()` a reasonable value, we anchor
-// it to the time of the first import of this utility.
-const initialTime = process.hrtime();
-
-export function monotonicTime(): number {
- const [seconds, nanoseconds] = process.hrtime(initialTime);
- return seconds * 1000 + (nanoseconds / 1000 | 0) / 1000;
-}
diff --git a/packages/playwright-core/src/utils/traceUtils.ts b/packages/playwright-core/src/utils/traceUtils.ts
deleted file mode 100644
index c6ecc7988b..0000000000
--- a/packages/playwright-core/src/utils/traceUtils.ts
+++ /dev/null
@@ -1,39 +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.
- */
-
-import type { SerializedClientSideCallMetadata, SerializedStack, SerializedStackFrame } from './isomorphic/traceUtils';
-import type { ClientSideCallMetadata } from '@protocol/channels';
-
-export function serializeClientSideCallMetadata(metadatas: ClientSideCallMetadata[]): SerializedClientSideCallMetadata {
- const fileNames = new Map<string, number>();
- const stacks: SerializedStack[] = [];
- for (const m of metadatas) {
- if (!m.stack || !m.stack.length)
- continue;
- const stack: SerializedStackFrame[] = [];
- for (const frame of m.stack) {
- let ordinal = fileNames.get(frame.file);
- if (typeof ordinal !== 'number') {
- ordinal = fileNames.size;
- fileNames.set(frame.file, ordinal);
- }
- const stackFrame: SerializedStackFrame = [ordinal, frame.line || 0, frame.column || 0, frame.function || ''];
- stack.push(stackFrame);
- }
- stacks.push([m.id, stack]);
- }
- return { files: [...fileNames.keys()], stacks };
-}
diff --git a/packages/playwright/src/util.ts b/packages/playwright/src/util.ts
index aa575710e5..803aa73f6b 100644
--- a/packages/playwright/src/util.ts
+++ b/packages/playwright/src/util.ts
@@ -19,9 +19,7 @@ import * as path from 'path';
import * as url from 'url';
import util from 'util';
-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 { parseStackTraceLine, sanitizeForFilePath, calculateSha1, formatCallLog, isRegExp, isString, stringifyStackFrames } from 'playwright-core/lib/utils';
import { debug, mime, minimatch } from 'playwright-core/lib/utilsBundle';
import type { Location } from './../types/testReporter';
diff --git a/tests/library/events/remove-all-listeners-wait.spec.ts b/tests/library/events/remove-all-listeners-wait.spec.ts
index 1f8dcc8dd0..e5b4bf2dc5 100644
--- a/tests/library/events/remove-all-listeners-wait.spec.ts
+++ b/tests/library/events/remove-all-listeners-wait.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { ManualPromise } from '../../../packages/playwright-core/lib/utils/manualPromise';
+import { ManualPromise } from '../../../packages/playwright-core/lib/utils/isomorphic/manualPromise';
import { EventEmitter } from '../../../packages/playwright-core/lib/client/eventEmitter';
import { test, expect } from '@playwright/test';
diff --git a/tests/library/unit/sequence.spec.ts b/tests/library/unit/sequence.spec.ts
index 624722753e..e0decd4d84 100644
--- a/tests/library/unit/sequence.spec.ts
+++ b/tests/library/unit/sequence.spec.ts
@@ -16,7 +16,7 @@
import { test as it, expect } from '@playwright/test';
-import { findRepeatedSubsequences } from '../../../packages/playwright-core/lib/utils/sequence';
+import { findRepeatedSubsequences } from '../../../packages/playwright-core/lib/utils/isomorphic/sequence';
it('should return an empty array when the input is empty', () => {
const input = [];
diff --git a/tests/page/page-leaks.spec.ts b/tests/page/page-leaks.spec.ts
index abd33e651e..90f78d83a9 100644
--- a/tests/page/page-leaks.spec.ts
+++ b/tests/page/page-leaks.spec.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { MultiMap } from '../../packages/playwright-core/lib/utils/multimap';
+import { MultiMap } from '../../packages/playwright-core/lib/utils/isomorphic/multimap';
import { test, expect } from './pageTest';
function leakedJSHandles(): string {
diff --git a/tests/page/page-listeners.spec.ts b/tests/page/page-listeners.spec.ts
index c22be64553..495ecf36c7 100644
--- a/tests/page/page-listeners.spec.ts
+++ b/tests/page/page-listeners.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { ManualPromise } from '../../packages/playwright-core/lib/utils/manualPromise';
+import { ManualPromise } from '../../packages/playwright-core/lib/utils/isomorphic/manualPromise';
import { test as it, expect } from './pageTest';
// This test is mostly for type checking, the actual tests are in the library/events.
diff --git a/tests/playwright-test/ui-mode-test-progress.spec.ts b/tests/playwright-test/ui-mode-test-progress.spec.ts
index f2f01a79ce..1b397f8f9a 100644
--- a/tests/playwright-test/ui-mode-test-progress.spec.ts
+++ b/tests/playwright-test/ui-mode-test-progress.spec.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { ManualPromise } from '../../packages/playwright-core/lib/utils/manualPromise';
+import { ManualPromise } from '../../packages/playwright-core/lib/utils/isomorphic/manualPromise';
import { test, expect, retries, dumpTestTree } from './ui-mode-fixtures';
test.describe.configure({ mode: 'parallel', retries });