snapdrift 0.9.0 → 0.11.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/CHANGELOG.md +67 -0
- package/README.md +5 -4
- package/action.yml +2 -2
- package/actions/comment/action.yml +6 -0
- package/actions/compare/action.yml +6 -0
- package/actions/pr-diff/action.yml +10 -3
- package/actions/stage/action.yml +7 -1
- package/docs/contracts.md +59 -3
- package/docs/integration-guide.md +34 -9
- package/docs/local-cli.md +18 -3
- package/docs/workflow-templates/refresh-baseline-on-merge.yml +1 -1
- package/lib/cli.mjs +15 -11
- package/lib/provider.mjs +12 -8
- package/lib/report.mjs +3 -2
- package/lib/snap-provider.mjs +495 -428
- package/package.json +5 -5
- package/types/visual-diff-types.d.ts +28 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snapdrift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "SnapDrift captures, compares, and reports UI drift for Playwright-based app checks.",
|
|
@@ -102,10 +102,10 @@
|
|
|
102
102
|
"registry": "https://registry.npmjs.org"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
-
"@snapdrift/adapter-fs": "^1.
|
|
106
|
-
"@snapdrift/adapter-report-md": "^1.
|
|
107
|
-
"@snapdrift/compare-core": "^1.
|
|
108
|
-
"@snapdrift/manifest": "^1.
|
|
105
|
+
"@snapdrift/adapter-fs": "^1.3.0",
|
|
106
|
+
"@snapdrift/adapter-report-md": "^1.2.0",
|
|
107
|
+
"@snapdrift/compare-core": "^1.2.0",
|
|
108
|
+
"@snapdrift/manifest": "^1.4.0",
|
|
109
109
|
"js-yaml": "^5.4.0",
|
|
110
110
|
"playwright": "^1.59.1",
|
|
111
111
|
"pngjs": "^7.0.0"
|
|
@@ -4,7 +4,10 @@ import type { SnapConfig } from '@snapdrift/manifest';
|
|
|
4
4
|
export type JsonObject = Record<string, any>;
|
|
5
5
|
|
|
6
6
|
export type VisualViewportPreset = 'desktop' | 'mobile';
|
|
7
|
-
export interface VisualCustomViewport {
|
|
7
|
+
export interface VisualCustomViewport {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
8
11
|
export type VisualViewport = VisualViewportPreset | VisualCustomViewport;
|
|
9
12
|
|
|
10
13
|
export interface VisualRegressionSelectionConfig {
|
|
@@ -12,6 +15,24 @@ export interface VisualRegressionSelectionConfig {
|
|
|
12
15
|
sharedExact?: string[];
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
export interface ComparisonPolicy {
|
|
19
|
+
version: 1;
|
|
20
|
+
threshold: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ComparisonDimensions {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ComparisonMetadata {
|
|
29
|
+
baseline: ComparisonDimensions;
|
|
30
|
+
current: ComparisonDimensions;
|
|
31
|
+
canvas: ComparisonDimensions;
|
|
32
|
+
dimensionsChanged: boolean;
|
|
33
|
+
totalPixels: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
15
36
|
export interface VisualRegressionRouteConfig {
|
|
16
37
|
id: string;
|
|
17
38
|
path: string;
|
|
@@ -31,6 +52,7 @@ export interface VisualRegressionConfig {
|
|
|
31
52
|
diff: {
|
|
32
53
|
threshold: number;
|
|
33
54
|
mode: 'report-only' | 'fail-on-changes' | 'fail-on-incomplete' | 'strict';
|
|
55
|
+
comparisonPolicy?: ComparisonPolicy;
|
|
34
56
|
};
|
|
35
57
|
selection?: VisualRegressionSelectionConfig;
|
|
36
58
|
provider?: 'local' | 'snap';
|
|
@@ -88,6 +110,8 @@ export interface SnapRunMetadata {
|
|
|
88
110
|
runId: string;
|
|
89
111
|
projectId: string;
|
|
90
112
|
purpose: 'baseline' | 'capture' | 'diff';
|
|
113
|
+
/** Exact comparison policy acknowledged by Snap for updated clients. */
|
|
114
|
+
comparisonPolicy?: ComparisonPolicy;
|
|
91
115
|
/** CI source branch for hosted baseline runs; omitted for ordinary diff runs. */
|
|
92
116
|
refBranch?: string;
|
|
93
117
|
/** Resolved 40-character CI commit for hosted baseline runs. */
|
|
@@ -141,6 +165,8 @@ export interface VisualDiffChangedItem {
|
|
|
141
165
|
totalPixels: number;
|
|
142
166
|
mismatchRatio: number;
|
|
143
167
|
status: 'changed';
|
|
168
|
+
comparison?: ComparisonMetadata;
|
|
169
|
+
diffImagePath?: string;
|
|
144
170
|
}
|
|
145
171
|
|
|
146
172
|
export interface VisualDiffSummary {
|
|
@@ -167,6 +193,7 @@ export interface VisualDiffSummary {
|
|
|
167
193
|
missing: VisualDiffMissingItem[];
|
|
168
194
|
errors: VisualDiffErrorItem[];
|
|
169
195
|
dimensionChanges: VisualDiffDimensionItem[];
|
|
196
|
+
comparisonPolicy?: ComparisonPolicy;
|
|
170
197
|
message?: string;
|
|
171
198
|
/** Link to the provider's run detail page. Set by SnapProvider during diff(); undefined for LocalProvider. */
|
|
172
199
|
dashboardUrl?: string;
|