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 imageUtils.ts to utils/isomorphic (#39497)

Copilot6ae6e049fefe
diff --git a/packages/playwright-core/src/mcp/browser/tools/screenshot.ts b/packages/playwright-core/src/mcp/browser/tools/screenshot.ts
index 4d09081052..0fefcd5890 100644
--- a/packages/playwright-core/src/mcp/browser/tools/screenshot.ts
+++ b/packages/playwright-core/src/mcp/browser/tools/screenshot.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { scaleImageToSize } from '../../../server/utils/imageUtils';
+import { scaleImageToSize } from '../../../utils/isomorphic/imageUtils';
import { jpegjs, PNG } from '../../../utilsBundle';
import { formatObject } from '../../../utils/isomorphic/stringUtils';
diff --git a/packages/playwright-core/src/server/utils/comparators.ts b/packages/playwright-core/src/server/utils/comparators.ts
index 77426a2d29..e7bf50ddd2 100644
--- a/packages/playwright-core/src/server/utils/comparators.ts
+++ b/packages/playwright-core/src/server/utils/comparators.ts
@@ -21,9 +21,9 @@ import pixelmatch from '../../third_party/pixelmatch';
import { jpegjs } from '../../utilsBundle';
import { colors, diff } from '../../utilsBundle';
import { PNG } from '../../utilsBundle';
-import { padImageToSize } from './imageUtils';
+import { padImageToSize } from '../../utils/isomorphic/imageUtils';
-import type { ImageData } from './imageUtils';
+import type { ImageData } from '../../utils/isomorphic/imageUtils';
export type ImageComparatorOptions = { threshold?: number, maxDiffPixels?: number, maxDiffPixelRatio?: number, comparator?: string };
export type ComparatorResult = { diff?: Buffer; errorMessage: string; } | null;
diff --git a/packages/playwright-core/src/utils.ts b/packages/playwright-core/src/utils.ts
index 2fbe8e3df0..a1ef290719 100644
--- a/packages/playwright-core/src/utils.ts
+++ b/packages/playwright-core/src/utils.ts
@@ -18,6 +18,7 @@ export * from './utils/isomorphic/ariaSnapshot';
export * from './utils/isomorphic/assert';
export * from './utils/isomorphic/colors';
export * from './utils/isomorphic/headers';
+export * from './utils/isomorphic/imageUtils';
export * from './utils/isomorphic/locatorGenerators';
export * from './utils/isomorphic/manualPromise';
export * from './utils/isomorphic/mimeType';
@@ -44,7 +45,6 @@ export * from './server/utils/expectUtils';
export * from './server/utils/fileUtils';
export * from './server/utils/hostPlatform';
export * from './server/utils/httpServer';
-export * from './server/utils/imageUtils';
export * from './server/utils/network';
export * from './server/utils/nodePlatform';
export * from './server/utils/processLauncher';
diff --git a/packages/playwright-core/src/server/utils/imageUtils.ts b/packages/playwright-core/src/utils/isomorphic/imageUtils.ts
similarity index 100%
rename from packages/playwright-core/src/server/utils/imageUtils.ts
rename to packages/playwright-core/src/utils/isomorphic/imageUtils.ts