chore: move utils that are user in server to server/utils (1) (#34734)

This commit is contained in:
Pavel Feldman 2025-02-11 15:40:41 -08:00 committed by GitHub
parent 934600b24b
commit 25a168fae5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 115 additions and 101 deletions

View file

@ -188,11 +188,6 @@ const noRestrictedGlobalsRules = {
const importOrderRules = {
'import/order': [2, {
'alphabetize': {
'order': 'asc',
'caseInsensitive': false
},
'named': true,
'groups': ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index', 'type'],
'newlines-between': 'always',
}],

View file

@ -23,14 +23,14 @@
},
"./package.json": "./package.json",
"./lib/outofprocess": "./lib/outofprocess.js",
"./lib/image_tools/stats": "./lib/image_tools/stats.js",
"./lib/image_tools/compare": "./lib/image_tools/compare.js",
"./lib/image_tools/imageChannel": "./lib/image_tools/imageChannel.js",
"./lib/image_tools/colorUtils": "./lib/image_tools/colorUtils.js",
"./lib/cli/program": "./lib/cli/program.js",
"./lib/server/registry/index": "./lib/server/registry/index.js",
"./lib/remote/playwrightServer": "./lib/remote/playwrightServer.js",
"./lib/server": "./lib/server/index.js",
"./lib/server/utils/image_tools/stats": "./lib/server/utils/image_tools/stats.js",
"./lib/server/utils/image_tools/compare": "./lib/server/utils/image_tools/compare.js",
"./lib/server/utils/image_tools/imageChannel": "./lib/server/utils/image_tools/imageChannel.js",
"./lib/server/utils/image_tools/colorUtils": "./lib/server/utils/image_tools/colorUtils.js",
"./lib/server/registry/index": "./lib/server/registry/index.js",
"./lib/utils": "./lib/utils/index.js",
"./lib/utilsBundle": "./lib/utilsBundle.js",
"./lib/zipBundle": "./lib/zipBundle.js",

View file

@ -7,6 +7,7 @@
../server/
../server/injected/
../server/trace
../server/utils
../utils
../utilsBundle.ts

View file

@ -22,7 +22,7 @@ import * as playwright from '../..';
import { PipeTransport } from '../protocol/transport';
import { PlaywrightServer } from '../remote/playwrightServer';
import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from '../server';
import { gracefullyProcessExitDoNotHang } from '../server/processLauncher';
import { gracefullyProcessExitDoNotHang } from '../server/utils/processLauncher';
import type { BrowserType } from '../client/browserType';
import type { LaunchServerOptions } from '../client/types';

View file

@ -25,7 +25,8 @@ import { launchBrowserServer, printApiJson, runDriver, runServer } from './drive
import { isTargetClosedError } from '../client/errors';
import { gracefullyProcessExitDoNotHang, registry, writeDockerVersion } from '../server';
import { runTraceInBrowser, runTraceViewerApp } from '../server/trace/viewer/traceViewer';
import { assert, getPackageManagerExecCommand, isLikelyNpxGlobal, wrapInASCIIBox } from '../utils';
import { assert, getPackageManagerExecCommand, isLikelyNpxGlobal } from '../utils';
import { wrapInASCIIBox } from '../server/utils/ascii';
import { dotenv, program } from '../utilsBundle';
import type { Browser } from '../client/browser';

View file

@ -16,7 +16,6 @@
// This file is generated by generate_channels.js, do not edit manually.
/* eslint-disable import/order */
import { scheme, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary, tChannel, tType } from './validatorPrimitives';
export type { Validator, ValidatorContext } from './validatorPrimitives';
export { ValidationError, findValidator, maybeFindValidator, createMetadataValidator } from './validatorPrimitives';

View file

@ -4,5 +4,6 @@
../server/
../server/android/
../server/dispatchers/
../server/utils/
../utils/
../utilsBundle.ts

View file

@ -16,10 +16,11 @@
import { PlaywrightConnection } from './playwrightConnection';
import { createPlaywright } from '../server/playwright';
import { userAgentVersionMatchesErrorMessage } from '../utils';
import { debugLogger } from '../utils/debugLogger';
import { Semaphore } from '../utils/semaphore';
import { WSServer } from '../utils/wsServer';
import { wrapInASCIIBox } from '../server/utils/ascii';
import { getPlaywrightVersion } from '../utils/userAgent';
import type { ClientType } from './playwrightConnection';
import type { SocksProxy } from '../common/socksProxy';
@ -131,3 +132,28 @@ export class PlaywrightServer {
await this._wsServer.close();
}
}
function userAgentVersionMatchesErrorMessage(userAgent: string) {
const match = userAgent.match(/^Playwright\/(\d+\.\d+\.\d+)/);
if (!match) {
// Cannot parse user agent - be lax.
return;
}
const received = match[1].split('.').slice(0, 2).join('.');
const expected = getPlaywrightVersion(true);
if (received !== expected) {
return wrapInASCIIBox([
`Playwright version mismatch:`,
` - server version: v${expected}`,
` - client version: v${received}`,
``,
`If you are using VSCode extension, restart VSCode.`,
``,
`If you are connecting to a remote service,`,
`keep your local Playwright version in sync`,
`with the remote service version.`,
``,
`<3 Playwright Team`
].join('\n'), 1);
}
}

View file

@ -13,6 +13,7 @@
./recorder/
./registry/
./trace/recorder/tracing.ts
./utils/
[playwright.ts]
./android/

View file

@ -5,4 +5,5 @@
../../utils/
../../utilsBundle.ts
../chromium/
../utils
../registry/

View file

@ -28,10 +28,10 @@ import { wsReceiver, wsSender } from '../../utilsBundle';
import { validateBrowserContextOptions } from '../browserContext';
import { chromiumSwitches } from '../chromium/chromiumSwitches';
import { CRBrowser } from '../chromium/crBrowser';
import { removeFolders } from '../fileUtils';
import { removeFolders } from '../utils/fileUtils';
import { helper } from '../helper';
import { SdkObject, serverSideCallMetadata } from '../instrumentation';
import { gracefullyCloseSet } from '../processLauncher';
import { gracefullyCloseSet } from '../utils/processLauncher';
import { ProgressController } from '../progress';
import { registry } from '../registry';

View file

@ -2,6 +2,7 @@
../../utils/
../
../isomorphic/
../utils
./third_party/
[bidiOverCdp.ts]

View file

@ -16,7 +16,8 @@
import * as os from 'os';
import { assert, wrapInASCIIBox } from '../../utils';
import { assert } from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { BrowserReadyState, BrowserType, kNoXServerRunningError } from '../browserType';
import { BidiBrowser } from './bidiBrowser';
import { kBrowserCloseMessageId } from './bidiConnection';
@ -24,7 +25,7 @@ import { chromiumSwitches } from '../chromium/chromiumSwitches';
import type { BrowserOptions } from '../browser';
import type { SdkObject } from '../instrumentation';
import type { Env } from '../processLauncher';
import type { Env } from '../utils/processLauncher';
import type { ProtocolError } from '../protocolError';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';

View file

@ -17,7 +17,8 @@
import * as os from 'os';
import * as path from 'path';
import { assert, wrapInASCIIBox } from '../../utils';
import { assert } from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { BrowserReadyState, BrowserType, kNoXServerRunningError } from '../browserType';
import { BidiBrowser } from './bidiBrowser';
import { kBrowserCloseMessageId } from './bidiConnection';
@ -25,7 +26,7 @@ import { createProfile } from './third_party/firefoxPrefs';
import type { BrowserOptions } from '../browser';
import type { SdkObject } from '../instrumentation';
import type { Env } from '../processLauncher';
import type { Env } from '../utils/processLauncher';
import type { ProtocolError } from '../protocolError';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';

View file

@ -23,7 +23,7 @@ import { createGuid, debugMode } from '../utils';
import { Clock } from './clock';
import { Debugger } from './debugger';
import { BrowserContextAPIRequestContext } from './fetch';
import { mkdirIfNeeded } from './fileUtils';
import { mkdirIfNeeded } from './utils/fileUtils';
import { HarRecorder } from './har/harRecorder';
import { helper } from './helper';
import { SdkObject, serverSideCallMetadata } from './instrumentation';

View file

@ -21,11 +21,11 @@ import * as path from 'path';
import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
import { DEFAULT_TIMEOUT, TimeoutSettings } from '../common/timeoutSettings';
import { ManualPromise, assert, debugMode } from '../utils';
import { existsAsync } from './fileUtils';
import { existsAsync } from './utils/fileUtils';
import { helper } from './helper';
import { SdkObject } from './instrumentation';
import { PipeTransport } from './pipeTransport';
import { envArrayToObject, launchProcess } from './processLauncher';
import { envArrayToObject, launchProcess } from './utils/processLauncher';
import { ProgressController } from './progress';
import { isProtocolError } from './protocolError';
import { registry } from './registry';
@ -36,7 +36,7 @@ import { RecentLogsCollector } from '../utils/debugLogger';
import type { Browser, BrowserOptions, BrowserProcess } from './browser';
import type { BrowserContext } from './browserContext';
import type { CallMetadata } from './instrumentation';
import type { Env } from './processLauncher';
import type { Env } from './utils/processLauncher';
import type { Progress } from './progress';
import type { ProtocolError } from './protocolError';
import type { BrowserName } from './registry';

View file

@ -24,7 +24,7 @@ import { CRBrowser } from './crBrowser';
import { kBrowserCloseMessageId } from './crConnection';
import { TimeoutSettings } from '../../common/timeoutSettings';
import { debugMode, headersArrayToObject, headersObjectToArray, } from '../../utils';
import { wrapInASCIIBox } from '../../utils/ascii';
import { wrapInASCIIBox } from '../utils/ascii';
import { RecentLogsCollector } from '../../utils/debugLogger';
import { ManualPromise } from '../../utils/manualPromise';
import { fetchData } from '../../utils/network';
@ -37,14 +37,14 @@ import { registry } from '../registry';
import { WebSocketTransport } from '../transport';
import { CRDevTools } from './crDevTools';
import { Browser } from '../browser';
import { removeFolders } from '../fileUtils';
import { gracefullyCloseSet } from '../processLauncher';
import { removeFolders } from '../utils/fileUtils';
import { gracefullyCloseSet } from '../utils/processLauncher';
import { ProgressController } from '../progress';
import type { HTTPRequestParams } from '../../utils/network';
import type { BrowserOptions, BrowserProcess } from '../browser';
import type { CallMetadata, SdkObject } from '../instrumentation';
import type { Env } from '../processLauncher';
import type { Env } from '../utils/processLauncher';
import type { Progress } from '../progress';
import type { ProtocolError } from '../protocolError';
import type { ConnectionTransport, ProtocolRequest } from '../transport';

View file

@ -18,7 +18,7 @@
import * as fs from 'fs';
import { splitErrorMessage } from '../../utils/stackTrace';
import { mkdirIfNeeded } from '../fileUtils';
import { mkdirIfNeeded } from '../utils/fileUtils';
import type { CRSession } from './crConnection';
import type { Protocol } from './protocol';

View file

@ -17,7 +17,7 @@
import { assert, monotonicTime } from '../../utils';
import { serverSideCallMetadata } from '../instrumentation';
import { Page } from '../page';
import { launchProcess } from '../processLauncher';
import { launchProcess } from '../utils/processLauncher';
import { ProgressController } from '../progress';
import type { Progress } from '../progress';

View file

@ -15,7 +15,7 @@
*/
import { SdkObject, createInstrumentation, serverSideCallMetadata } from './instrumentation';
import { gracefullyProcessExitDoNotHang } from './processLauncher';
import { gracefullyProcessExitDoNotHang } from './utils/processLauncher';
import { Recorder } from './recorder';
import { asLocator } from '../utils';
import { parseAriaSnapshotUnsafe } from '../utils/isomorphic/ariaSnapshot';

View file

@ -18,7 +18,7 @@ import * as fs from 'fs';
import { Dispatcher, existingDispatcher } from './dispatcher';
import { StreamDispatcher } from './streamDispatcher';
import { mkdirIfNeeded } from '../fileUtils';
import { mkdirIfNeeded } from '../utils/fileUtils';
import type { DispatcherScope } from './dispatcher';
import type { Artifact } from '../artifact';

View file

@ -3,3 +3,4 @@
../../common/
../../utils/
../chromium/
../utils

View file

@ -20,7 +20,8 @@ import * as path from 'path';
import * as readline from 'readline';
import { TimeoutSettings } from '../../common/timeoutSettings';
import { ManualPromise, wrapInASCIIBox } from '../../utils';
import { ManualPromise } from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { RecentLogsCollector } from '../../utils/debugLogger';
import { eventsHelper } from '../../utils/eventsHelper';
import { validateBrowserContextOptions } from '../browserContext';
@ -32,7 +33,7 @@ import { ConsoleMessage } from '../console';
import { helper } from '../helper';
import { SdkObject, serverSideCallMetadata } from '../instrumentation';
import * as js from '../javascript';
import { envArrayToObject, launchProcess } from '../processLauncher';
import { envArrayToObject, launchProcess } from '../utils/processLauncher';
import { ProgressController } from '../progress';
import { WebSocketTransport } from '../transport';

View file

@ -20,13 +20,13 @@ import * as path from 'path';
import { FFBrowser } from './ffBrowser';
import { kBrowserCloseMessageId } from './ffConnection';
import { wrapInASCIIBox } from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { BrowserType, kNoXServerRunningError } from '../browserType';
import { BrowserReadyState } from '../browserType';
import type { BrowserOptions } from '../browser';
import type { SdkObject } from '../instrumentation';
import type { Env } from '../processLauncher';
import type { Env } from '../utils/processLauncher';
import type { ProtocolError } from '../protocolError';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';

View file

@ -31,5 +31,7 @@ export type { Playwright } from './playwright';
export { installRootRedirect, openTraceInBrowser, openTraceViewerApp, runTraceViewerApp, startTraceViewerServer } from './trace/viewer/traceViewer';
export { serverSideCallMetadata } from './instrumentation';
export { SocksProxy } from '../common/socksProxy';
export * from './fileUtils';
export * from './processLauncher';
export * from './utils/processLauncher';
export * from './utils/ascii';
export * from './utils/comparators';
export * from './utils/fileUtils';

View file

@ -31,7 +31,7 @@ import { Screenshotter, validateScreenshotOptions } from './screenshotter';
import { TimeoutSettings } from '../common/timeoutSettings';
import { LongStandingScope, assert, compressCallLog, createGuid, trimStringWithEllipsis } from '../utils';
import { asLocator } from '../utils';
import { getComparator } from '../utils/comparators';
import { getComparator } from './utils/comparators';
import { debugLogger } from '../utils/debugLogger';
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
import { ManualPromise } from '../utils/manualPromise';
@ -45,7 +45,7 @@ import type { Progress } from './progress';
import type { ScreenshotOptions } from './screenshotter';
import type * as types from './types';
import type { TimeoutOptions } from '../common/types';
import type { ImageComparatorOptions } from '../utils/comparators';
import type { ImageComparatorOptions } from './utils/comparators';
import type * as channels from '@protocol/channels';
export interface PageDelegate {

View file

@ -24,7 +24,7 @@ import { debugLogger } from '../../utils/debugLogger';
import { ManualPromise } from '../../utils/manualPromise';
import { getUserAgent } from '../../utils/userAgent';
import { colors, progress as ProgressBar } from '../../utilsBundle';
import { existsAsync } from '../fileUtils';
import { existsAsync } from '../utils/fileUtils';
import { browserDirectoryToMarkerFilePath } from '.';

View file

@ -20,7 +20,7 @@ import * as os from 'os';
import * as path from 'path';
import { deps } from './nativeDeps';
import * as utils from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
import { spawnAsync } from '../../utils/spawnAsync';
import { getPlaywrightVersion } from '../../utils/userAgent';
@ -271,7 +271,7 @@ export async function validateDependenciesLinux(sdkLanguage: string, linuxLddDir
]);
}
throw new Error('\n' + utils.wrapInASCIIBox(errorLines.join('\n'), 1));
throw new Error('\n' + wrapInASCIIBox(errorLines.join('\n'), 1));
}
function isSharedLib(basename: string) {

View file

@ -23,14 +23,15 @@ import * as util from 'util';
import { downloadBrowserWithProgressBar, logPolitely } from './browserFetcher';
import { dockerVersion, readDockerVersionSync, transformCommandsForRoot } from './dependencies';
import { installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';
import { calculateSha1, getAsBooleanFromENV, getFromENV, getPackageManagerExecCommand, wrapInASCIIBox } from '../../utils';
import { calculateSha1, getAsBooleanFromENV, getFromENV, getPackageManagerExecCommand } from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { debugLogger } from '../../utils/debugLogger';
import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
import { fetchData } from '../../utils/network';
import { spawnAsync } from '../../utils/spawnAsync';
import { getEmbedderName } from '../../utils/userAgent';
import { lockfile } from '../../utilsBundle';
import { canAccessFile, existsAsync, removeFolders } from '../fileUtils';
import { canAccessFile, existsAsync, removeFolders } from '../utils/fileUtils';
import type { DependencyGroup } from './dependencies';
import type { HostPlatform } from '../../utils/hostPlatform';

View file

@ -7,4 +7,5 @@
../../../utilsBundle.ts
../../../zipBundle.ts
../../dispatchers/dispatcher.ts
../common/
../../utils
../common/

View file

@ -25,7 +25,7 @@ import { Artifact } from '../../artifact';
import { BrowserContext } from '../../browserContext';
import { Dispatcher } from '../../dispatchers/dispatcher';
import { serializeError } from '../../errors';
import { SerializedFS, removeFolders } from '../../fileUtils';
import { SerializedFS, removeFolders } from '../../utils/fileUtils';
import { HarTracer } from '../../har/harTracer';
import { SdkObject } from '../../instrumentation';
import { Page } from '../../page';

View file

@ -0,0 +1,9 @@
[*]
../../utils
../../utilsBundle.ts
../../zipBundle.ts
[comparators.ts]
./image_tools
../../third_party/pixelmatch

View file

@ -15,12 +15,12 @@
* limitations under the License.
*/
import { compare } from '../image_tools/compare';
import { compare } from './image_tools/compare';
// @ts-ignore
import pixelmatch from '../third_party/pixelmatch';
import { colors, jpegjs } from '../utilsBundle';
import { diff } from '../utilsBundle';
import { PNG } from '../utilsBundle';
import pixelmatch from '../../third_party/pixelmatch';
import { colors, jpegjs } from '../../utilsBundle';
import { diff } from '../../utilsBundle';
import { PNG } from '../../utilsBundle';
export type ImageComparatorOptions = { threshold?: number, maxDiffPixels?: number, maxDiffPixelRatio?: number, comparator?: string };
export type ComparatorResult = { diff?: Buffer; errorMessage: string; } | null;

View file

@ -17,8 +17,8 @@
import * as fs from 'fs';
import * as path from 'path';
import { ManualPromise } from '../utils/manualPromise';
import { yazl } from '../zipBundle';
import { ManualPromise } from '../../utils/manualPromise';
import { yazl } from '../../zipBundle';
import type { EventEmitter } from 'events';

View file

@ -20,7 +20,7 @@ import * as fs from 'fs';
import * as readline from 'readline';
import { removeFolders } from './fileUtils';
import { isUnderTest } from '../utils';
import { isUnderTest } from '../../utils';
export type Env = {[key: string]: string | number | boolean | undefined};

View file

@ -18,13 +18,13 @@
import * as path from 'path';
import { kBrowserCloseMessageId } from './wkConnection';
import { wrapInASCIIBox } from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { BrowserType, kNoXServerRunningError } from '../browserType';
import { WKBrowser } from '../webkit/wkBrowser';
import type { BrowserOptions } from '../browser';
import type { SdkObject } from '../instrumentation';
import type { Env } from '../processLauncher';
import type { Env } from '../utils/processLauncher';
import type { ProtocolError } from '../protocolError';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';

View file

@ -1,6 +1,4 @@
[*]
./
../third_party/pixelmatch
../image_tools/compare.ts
../utilsBundle.ts
../zipBundle.ts

View file

@ -14,8 +14,6 @@
* limitations under the License.
*/
export * from './ascii';
export * from './comparators';
export * from './crypto';
export * from './debug';
export * from './debugLogger';

View file

@ -17,7 +17,6 @@
import { execSync } from 'child_process';
import * as os from 'os';
import { wrapInASCIIBox } from './ascii';
import { getLinuxDistributionInfoSync } from '../utils/linuxUtils';
let cachedUserAgent: string | undefined;
@ -81,28 +80,3 @@ export function getPlaywrightVersion(majorMinorOnly = false): string {
const version = process.env.PW_VERSION_OVERRIDE || require('./../../package.json').version;
return majorMinorOnly ? version.split('.').slice(0, 2).join('.') : version;
}
export function userAgentVersionMatchesErrorMessage(userAgent: string) {
const match = userAgent.match(/^Playwright\/(\d+\.\d+\.\d+)/);
if (!match) {
// Cannot parse user agent - be lax.
return;
}
const received = match[1].split('.').slice(0, 2).join('.');
const expected = getPlaywrightVersion(true);
if (received !== expected) {
return wrapInASCIIBox([
`Playwright version mismatch:`,
` - server version: v${expected}`,
` - client version: v${received}`,
``,
`If you are using VSCode extension, restart VSCode.`,
``,
`If you are connecting to a remote service,`,
`keep your local Playwright version in sync`,
`with the remote service version.`,
``,
`<3 Playwright Team`
].join('\n'), 1);
}
}

View file

@ -18,7 +18,8 @@ import * as fs from 'fs';
import * as path from 'path';
import * as playwrightLibrary from 'playwright-core';
import { addInternalStackPrefix, asLocator, createGuid, debugMode, isString, jsonStringifyForceASCII, zones } from 'playwright-core/lib/utils';
import { jsonStringifyForceASCII } from 'playwright-core/lib/server';
import { addInternalStackPrefix, asLocator, createGuid, debugMode, isString, zones } from 'playwright-core/lib/utils';
import { currentTestInfo } from './common/globals';
import { rootTestType } from './common/testType';

View file

@ -18,7 +18,8 @@ import * as fs from 'fs';
import * as path from 'path';
import { sanitizeForFilePath } from 'playwright-core/lib/server';
import { compareBuffersOrStrings, getComparator, isString } from 'playwright-core/lib/utils';
import { compareBuffersOrStrings, getComparator } from 'playwright-core/lib/server';
import { isString } from 'playwright-core/lib/utils';
import { colors } from 'playwright-core/lib/utilsBundle';
import { mime } from 'playwright-core/lib/utilsBundle';
@ -37,7 +38,7 @@ import type { FullProjectInternal } from '../common/config';
import type { TestInfoImpl, TestStepInfoImpl } from '../worker/testInfo';
import type { Locator, Page } from 'playwright-core';
import type { ExpectScreenshotOptions, Page as PageEx } from 'playwright-core/lib/client/page';
import type { Comparator, ImageComparatorOptions } from 'playwright-core/lib/utils';
import type { Comparator, ImageComparatorOptions } from 'playwright-core/lib/server';
type NameOrSegments = string | string[];
const snapshotNamesSymbol = Symbol('snapshotNames');

View file

@ -19,7 +19,7 @@ import * as os from 'os';
import * as path from 'path';
import { baseTest } from './baseTest';
import { RunServer, RemoteServer } from './remoteServer';
import { removeFolders } from '../../packages/playwright-core/lib/server/fileUtils';
import { removeFolders } from '../../packages/playwright-core/lib/server/utils/fileUtils';
import { parseHar } from '../config/utils';
import { createSkipTestPredicate } from '../bidi/expectationUtil';

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { getComparator } from '../../packages/playwright-core/lib/utils/comparators';
import { getComparator } from '../../packages/playwright-core/lib/server/utils/comparators';
const pngComparator = getComparator('image/png');
type ComparatorResult = { diff?: Buffer; errorMessage: string; } | null;

View file

@ -16,7 +16,7 @@
import { test, expect } from '../playwright-test/stable-test-runner';
import { PNG } from 'playwright-core/lib/utilsBundle';
import { compare } from 'playwright-core/lib/image_tools/compare';
import { compare } from 'playwright-core/lib/server/utils/image_tools/compare';
import fs from 'fs';
import path from 'path';

View file

@ -15,9 +15,9 @@
*/
import { test } from '../playwright-test/stable-test-runner';
import { ssim, FastStats } from 'playwright-core/lib/image_tools/stats';
import { ImageChannel } from 'playwright-core/lib/image_tools/imageChannel';
import { srgb2xyz, xyz2lab, colorDeltaE94 } from 'playwright-core/lib/image_tools/colorUtils';
import { ssim, FastStats } from 'playwright-core/lib/server/utils/image_tools/stats';
import { ImageChannel } from 'playwright-core/lib/server/utils/image_tools/imageChannel';
import { srgb2xyz, xyz2lab, colorDeltaE94 } from 'playwright-core/lib/server/utils/image_tools/colorUtils';
import referenceSSIM from 'ssim.js';
import { randomPNG, assertEqual, grayChannel } from './utils';

View file

@ -15,7 +15,7 @@
*/
import { PNG } from 'playwright-core/lib/utilsBundle';
import { ImageChannel } from 'playwright-core/lib/image_tools/imageChannel';
import { ImageChannel } from 'playwright-core/lib/server/utils/image_tools/imageChannel';
// mulberry32
export function createRandom(seed) {

View file

@ -17,7 +17,7 @@
import path from 'path';
import fs from 'fs';
import { spawnAsync } from '../../packages/playwright-core/lib/utils/spawnAsync';
import { removeFolders } from '../../packages/playwright-core/lib/server/fileUtils';
import { removeFolders } from '../../packages/playwright-core/lib/server/utils/fileUtils';
import { TMP_WORKSPACES } from './npmTest';
const PACKAGE_BUILDER_SCRIPT = path.join(__dirname, '..', '..', 'utils', 'pack_package.js');

View file

@ -22,7 +22,7 @@ import debugLogger from 'debug';
import { Registry } from './registry';
import type { CommonFixtures, CommonWorkerFixtures } from '../config/commonFixtures';
import { commonFixtures } from '../config/commonFixtures';
import { removeFolders } from '../../packages/playwright-core/lib/server/fileUtils';
import { removeFolders } from '../../packages/playwright-core/lib/server/utils/fileUtils';
import { spawnAsync } from '../../packages/playwright-core/lib/utils/spawnAsync';
import type { SpawnOptions } from 'child_process';

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { compare } from 'playwright-core/lib/image_tools/compare';
import { compare } from 'playwright-core/lib/server/utils/image_tools/compare';
import { PNG } from 'playwright-core/lib/utilsBundle';
import { expect, playwrightTest as it } from '../config/browserTest';

View file

@ -153,7 +153,6 @@ const validator_ts = [
// This file is generated by ${path.basename(__filename)}, do not edit manually.
/* eslint-disable import/order */
import { scheme, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary, tChannel, tType } from './validatorPrimitives';
export type { Validator, ValidatorContext } from './validatorPrimitives';
export { ValidationError, findValidator, maybeFindValidator, createMetadataValidator } from './validatorPrimitives';