@pixsame/playwright-visual-regression-diff 0.0.0-canary-20261113-8e3iy1gd → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # pixsame for Playwright
2
2
 
3
- Published as `@pixsame/playwright-visual-regression-diff`. Visual regression testing for [Playwright](https://playwright.dev) with the same `matchImage` flow, baseline layout, run manifest and CI tooling as [`@frsource/cypress-plugin-visual-regression-diff`](../cypress-plugin-visual-regression-diff/README.md), plus an optional remote browser in Docker so that the pixels you approve locally are the pixels CI produces.
3
+ Published as `@pixsame/playwright-visual-regression-diff`. Visual regression testing for [Playwright](https://playwright.dev) with the same `matchImage` flow, baseline layout, run manifest and CI tooling as [`@frsource/cypress-plugin-visual-regression-diff`](../cypress-plugin-visual-regression-diff/README.md), plus an optional **remote browser in Docker** so that the pixels you approve locally are the pixels CI produces.
4
4
 
5
- > Status: 0.x, published on the `next` dist-tag. The API below is small on purpose and may still change before 1.0.
5
+ > Status: 0.x, published on the `next` dist-tag: options may still change. The API below is small on purpose and may still move before 1.0.
6
6
 
7
7
  ## Why another Playwright screenshot tool
8
8
 
9
9
  Playwright ships `toHaveScreenshot()`, and it is good. This package exists for teams that already use the Cypress plugin (or its GitHub App) and want one baseline format, one manifest and one review workflow across both runners:
10
10
 
11
- - The comparison is the same: `pixelmatch` with `includeAA: false`, the same padding for size mismatches, the same `<name>_#n.png` / `.actual.png` / `.diff.png` files, the same PNG marker. So a baseline recorded by the Cypress plugin is a valid baseline here and vice versa. One default differs until the plugin's 5.0: the 4.x plugin compares with `includeAA: true`, so a diff that passes here can still fail there by a few anti-aliased pixels unless you set `diffConfig: { includeAA: false }` on the Cypress side too.
12
- - The run manifest is the same too. Every comparison lands in a `visual-regression-manifest.playwright.w<n>.json` next to Playwright's test results, written through [`visual-regression-manifest`](https://www.npmjs.com/package/visual-regression-manifest), the runner-agnostic [standard](https://visual-regression.dev/manifest) the GitHub App and other consumers read. Only the `runner` block is Playwright-specific.
13
- - `remoteBrowser()` runs the browser inside the official Playwright image and keeps the test runner, your app and your editor native, so local and CI screenshots come from the same browser build, fonts and rasteriser.
11
+ - **Same comparison.** `pixelmatch` with `includeAA: false`, the same padding for size mismatches, the same `<name>_#n.png` / `.actual.png` / `.diff.png` files, the same PNG marker. A baseline recorded by the Cypress plugin is a valid baseline here and vice versa. One default differs until the plugin's 5.0: the 4.x plugin compares with `includeAA: true`, so a diff that passes here can still fail there by a few anti-aliased pixels unless you set `diffConfig: { includeAA: false }` on the Cypress side too.
12
+ - **Same run manifest.** Every comparison lands in a `visual-regression-manifest.playwright.w<n>.json` next to Playwright's test results, written through [`visual-regression-manifest`](https://www.npmjs.com/package/visual-regression-manifest), the runner-agnostic [standard](https://visual-regression.dev/manifest) the GitHub App and other consumers read. Only the `runner` block is Playwright-specific.
13
+ - **Drift-free pixels without leaving your machine.** `remoteBrowser()` runs the browser inside the official Playwright image and keeps the test runner, your app and your editor native. Local and CI screenshots then come from the same browser build, fonts and rasteriser.
14
14
 
15
15
  ## Install
16
16
 
@@ -68,18 +68,17 @@ export default defineConfig({
68
68
  });
69
69
  ```
70
70
 
71
- | option | default | meaning |
72
- | ------------------------ | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73
- | `imagesPath` | `'{spec_path}/__image_snapshots__'` | Where baselines live; relative paths resolve against `rootDir`. Tokens: `{spec_path}` (directory of the test file, whole segment only), `{platform}` (`{os}-{browser}`), `{os}` (`linux`, `darwin`, `win32`), `{browser}` (`chromium`, `firefox`, `webkit`). |
74
- | `maxDiffThreshold` | `0.01` | Maximum share of differing pixels, 0..1. |
75
- | `diffConfig` | `{}` | [pixelmatch options](https://github.com/mapbox/pixelmatch#pixelmatchimg1-img2-output-width-height-options); `includeAA: false` unless you say otherwise. |
76
- | `createMissingImages` | `true` | Create the baseline from the first screenshot instead of failing. |
77
- | `updateImages` | `false` | `true` overwrites every baseline without comparing; `'failures-only'` compares first and overwrites only the ones above the threshold. |
78
- | `title` | test title path joined by spaces | Screenshot name; repeated names within a test get `_#0`, `_#1`, ... |
79
- | `matchAgainstPath` | | Compare against this file instead of the derived baseline path (never token-expanded). |
80
- | `screenshotConfig` | `{}` | Passed to `page.screenshot()` / `locator.screenshot()`, e.g. `{ fullPage: true, mask: [...] }`. |
81
- | `deterministicRendering` | `true` | Disables CSS animations and hides the caret for the screenshot (`animations: 'disabled'`, `caret: 'hide'`). |
82
- | `analysis` | `true` | Describe what changed when a comparison finds differences, e.g. "Everything below y=340 moved down by 12 px." The sentence ends the failure message and is recorded in the run manifest as `extra.pixsame.analysis`. It never changes whether the comparison passes. |
71
+ | option | default | meaning |
72
+ | ------------------------ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
73
+ | `imagesPath` | `'{spec_path}/__image_snapshots__'` | Where baselines live; relative paths resolve against `rootDir`. Tokens: `{spec_path}` (directory of the test file, whole segment only), `{platform}` (`{os}-{browser}`), `{os}` (`linux`, `darwin`, `win32`), `{browser}` (`chromium`, `firefox`, `webkit`). |
74
+ | `maxDiffThreshold` | `0.01` | Maximum share of differing pixels, 0..1. |
75
+ | `diffConfig` | `{}` | [pixelmatch options](https://github.com/mapbox/pixelmatch#pixelmatchimg1-img2-output-width-height-options); `includeAA: false` unless you say otherwise. |
76
+ | `createMissingImages` | `true` | Create the baseline from the first screenshot instead of failing. |
77
+ | `updateImages` | `false` | `true` overwrites every baseline without comparing; `'failures-only'` compares first and overwrites only the ones above the threshold. |
78
+ | `title` | test title path joined by spaces | Screenshot name; repeated names within a test get `_#0`, `_#1`, ... |
79
+ | `matchAgainstPath` | | Compare against this file instead of the derived baseline path (never token-expanded). |
80
+ | `screenshotConfig` | `{}` | Passed to `page.screenshot()` / `locator.screenshot()`, e.g. `{ fullPage: true, mask: [...] }`. |
81
+ | `deterministicRendering` | `true` | Disables CSS animations and hides the caret for the screenshot (`animations: 'disabled'`, `caret: 'hide'`). |
83
82
 
84
83
  Screenshots are taken at the context's `deviceScaleFactor` (1 by default); nothing is rescaled.
85
84
 
package/dist/compare.d.ts CHANGED
@@ -16,8 +16,6 @@ export type CompareInput = {
16
16
  updateImages: boolean | 'failures-only';
17
17
  maxDiffThreshold: number;
18
18
  diffConfig: PixelmatchOptions;
19
- /** Describe what changed when the comparison finds differences. Default `true`. */
20
- analysis?: boolean;
21
19
  /** Screenshot name recorded on the manifest entry; defaults to the baseline's file name. */
22
20
  name?: string;
23
21
  /** The test the screenshot belongs to, recorded on the manifest entry. */
@@ -36,8 +34,6 @@ export type CompareResult = {
36
34
  /** `true` when the test should fail. */
37
35
  error: boolean;
38
36
  message: string;
39
- /** What changed, in one sentence; only for a comparison that found differences. */
40
- description?: string;
41
37
  /** Share of differing pixels, 0..1; `0` when no comparison ran. */
42
38
  diffRatio: number;
43
39
  threshold: number;
package/dist/compare.js CHANGED
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.compareImages = exports.createComparison = exports.diffPathFor = void 0;
7
- const analysis_1 = require("@pixsame/analysis");
8
7
  const fs_1 = __importDefault(require("fs"));
9
8
  const path_1 = __importDefault(require("path"));
10
9
  const visual_regression_manifest_1 = require("visual-regression-manifest");
@@ -29,8 +28,7 @@ const isUnstamped = ({ input }) => input.files !== undefined &&
29
28
  * - pixelmatch with every one of its options (`alpha`, `aaColor`, `diffColor`,
30
29
  * `diffMask`, ...), not only the `threshold` and `includeAA` of the built-in
31
30
  * engine, and anti-aliased pixels not counted unless asked for; registered
32
- * under the built-in's name, so it takes its place; the compared images
33
- * are handed to `@pixsame/analysis`, which says what changed;
31
+ * under the built-in's name, so it takes its place;
34
32
  * - the `.diff.png` carries the package marker, like the screenshot does;
35
33
  * - a passed comparison whose baseline lacks the marker refreshes the baseline,
36
34
  * so the file is rewritten once instead of by whoever runs the test next.
@@ -61,7 +59,6 @@ const matchImagePlugin = (pixelmatch) => ({
61
59
  const { width, height } = baseline;
62
60
  const diff = new Uint8ClampedArray(width * height * 4);
63
61
  const diffPixels = pixelmatch(baseline.data, actual.data, diff, width, height, { includeAA: false, ...options });
64
- (0, analysis_1.captureComparison)(baseline, actual, { width, height, data: diff }, options);
65
62
  return {
66
63
  diffPixels,
67
64
  diffRatio: width * height === 0 ? 0 : diffPixels / (width * height),
@@ -98,7 +95,7 @@ const createComparison = async (writer, { rootDir }) => {
98
95
  }),
99
96
  },
100
97
  messages,
101
- plugins: [matchImagePlugin(pixelmatch), (0, analysis_1.analysisPlugin)()],
98
+ plugins: [matchImagePlugin(pixelmatch)],
102
99
  });
103
100
  };
104
101
  exports.createComparison = createComparison;
@@ -111,7 +108,7 @@ exports.createComparison = createComparison;
111
108
  */
112
109
  const compareImages = async (cfg, comparer) => {
113
110
  const diffPath = (0, exports.diffPathFor)(cfg.actualPath);
114
- const compare = () => comparer.compare({
111
+ const { entry, images } = await comparer.compare({
115
112
  name: cfg.name ?? path_1.default.basename(cfg.baselinePath, '.png'),
116
113
  // stamped once, so every file derived from it carries the package marker
117
114
  actual: (0, image_utils_1.addPNGMetadata)(cfg.imgNew),
@@ -135,16 +132,12 @@ const compareImages = async (cfg, comparer) => {
135
132
  onMissingBaseline: cfg.createMissingImages ? 'create' : 'fail',
136
133
  },
137
134
  }, { include: ['baseline', 'actual', 'diff'] });
138
- const { entry, images } = await (cfg.analysis === false
139
- ? compare()
140
- : (0, analysis_1.withAnalysis)(compare));
141
135
  const status = entry.status;
142
136
  const buffer = (bytes) => bytes ? Buffer.from(bytes) : undefined;
143
137
  return {
144
138
  status,
145
139
  error: status === 'failed' || status === 'missing-baseline',
146
140
  message: entry.message ?? '',
147
- description: (0, analysis_1.analysisOf)(entry)?.description,
148
141
  diffRatio: entry.comparison.diffRatio,
149
142
  threshold: cfg.maxDiffThreshold,
150
143
  baselineWritten: entry.baselineWritten,
package/dist/fixture.d.ts CHANGED
@@ -28,12 +28,6 @@ export type MatchImageOptions = {
28
28
  screenshotConfig?: PageScreenshotOptions & LocatorScreenshotOptions;
29
29
  /** Disables CSS animations and hides the caret for the screenshot. @default true */
30
30
  deterministicRendering?: boolean;
31
- /**
32
- * Describe what changed when a comparison finds differences (changed areas,
33
- * a layout shift, rendering noise). It never changes whether the comparison
34
- * passes. @default true
35
- */
36
- analysis?: boolean;
37
31
  };
38
32
  export type VisualRegressionOptions = MatchImageOptions;
39
33
  export type MatchImageResult = {
package/dist/fixture.js CHANGED
@@ -23,7 +23,6 @@ const withDefaults = (globals, options) => {
23
23
  matchAgainstPath: merged.matchAgainstPath,
24
24
  screenshotConfig: merged.screenshotConfig ?? {},
25
25
  deterministicRendering: merged.deterministicRendering ?? true,
26
- analysis: merged.analysis ?? true,
27
26
  };
28
27
  };
29
28
  exports.visualRegressionFixtures = {
@@ -107,7 +106,6 @@ exports.visualRegressionFixtures = {
107
106
  updateImages: cfg.updateImages,
108
107
  maxDiffThreshold: cfg.maxDiffThreshold,
109
108
  diffConfig: cfg.diffConfig,
110
- analysis: cfg.analysis,
111
109
  name,
112
110
  test: {
113
111
  filePath: testInfo.file,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pixsame/playwright-visual-regression-diff",
3
3
  "description": "Pixsame for Playwright: visual regression testing for Playwright with the matchImage flow, baseline layout, run manifest and CI tooling of @frsource/cypress-plugin-visual-regression-diff, plus a pinned remote browser in Docker for drift-free pixels.",
4
- "version": "0.0.0-canary-20261113-8e3iy1gd",
4
+ "version": "0.0.0",
5
5
  "author": "Jakub Freisler <jakub.freisler@frsource.org>",
6
6
  "homepage": "https://pixsame.com",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/pixsame/pixsame.git",
9
+ "url": "https://github.com/pixsame/cypress-plugin-visual-regression-diff.git",
10
10
  "directory": "packages/playwright-visual-regression-diff"
11
11
  },
12
12
  "license": "MIT",
@@ -30,7 +30,6 @@
30
30
  "@playwright/test": ">=1.40.0"
31
31
  },
32
32
  "dependencies": {
33
- "@pixsame/analysis": "0.0.0-canary-20261113-8e3iy1gd",
34
33
  "meta-png": "1.0.6",
35
34
  "pixelmatch": "7.2.0",
36
35
  "sanitize-filename": "1.6.4",
@@ -45,7 +44,7 @@
45
44
  "@vitest/coverage-v8": "4.1.11",
46
45
  "del-cli": "7.0.0",
47
46
  "prettier": "3.9.8",
48
- "sharp": "0.35.5",
47
+ "sharp": "0.35.4",
49
48
  "tmp-promise": "3.0.3",
50
49
  "typescript": "6.0.3",
51
50
  "vitest": "4.1.11"