@keboola/validate-ui 0.4.0 → 0.5.2
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/AGENTS.md +13 -0
- package/CHANGELOG.md +116 -0
- package/dist/cli.cjs +118 -1066
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +118 -1057
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +40 -1015
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -159
- package/dist/index.d.ts +177 -159
- package/dist/index.js +10 -978
- package/dist/index.js.map +1 -1
- package/dist/runner-CM9sF-C8.cjs +1518 -0
- package/dist/runner-CM9sF-C8.cjs.map +1 -0
- package/dist/runner-ZOonToZg.js +1308 -0
- package/dist/runner-ZOonToZg.js.map +1 -0
- package/package.json +14 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z } from
|
|
3
|
-
|
|
1
|
+
import { Browser, Page } from "playwright";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import "@keboola/brand-registry";
|
|
4
|
+
//#region src/compare/types.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Backend/render state of a region. A region that rendered its data is `ok`;
|
|
6
7
|
* `empty`/`error`/`loading` are non-data states — an old→new transition into one
|
|
7
8
|
* of them is a degrade, not a value regression (a backend was unavailable, or an
|
|
8
9
|
* intentional empty state is showing).
|
|
9
10
|
*/
|
|
10
|
-
declare const REGION_STATES: readonly [
|
|
11
|
+
declare const REGION_STATES: readonly ['ok', 'empty', 'error', 'loading'];
|
|
11
12
|
type RegionState = (typeof REGION_STATES)[number];
|
|
12
13
|
/** One diffable region of a page — a landmark, labelled section, or component. */
|
|
13
14
|
declare const Region: z.ZodObject<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
key: z.ZodString;
|
|
16
|
+
label: z.ZodString;
|
|
17
|
+
state: z.ZodEnum<{
|
|
18
|
+
empty: "empty";
|
|
19
|
+
error: "error";
|
|
20
|
+
loading: "loading";
|
|
21
|
+
ok: "ok";
|
|
22
|
+
}>;
|
|
23
|
+
values: z.ZodArray<z.ZodString>;
|
|
23
24
|
}, z.core.$strip>;
|
|
24
25
|
type Region = z.infer<typeof Region>;
|
|
25
26
|
/**
|
|
@@ -28,30 +29,30 @@ type Region = z.infer<typeof Region>;
|
|
|
28
29
|
* it is safe to serialize to disk and re-load; {@link loadSnapshot} validates it.
|
|
29
30
|
*/
|
|
30
31
|
declare const CompareSnapshot: z.ZodObject<{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
route: z.ZodString;
|
|
33
|
+
regions: z.ZodArray<z.ZodObject<{
|
|
34
|
+
key: z.ZodString;
|
|
35
|
+
label: z.ZodString;
|
|
36
|
+
state: z.ZodEnum<{
|
|
37
|
+
empty: "empty";
|
|
38
|
+
error: "error";
|
|
39
|
+
loading: "loading";
|
|
40
|
+
ok: "ok";
|
|
41
|
+
}>;
|
|
42
|
+
values: z.ZodArray<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
43
44
|
}, z.core.$strip>;
|
|
44
45
|
type CompareSnapshot = z.infer<typeof CompareSnapshot>;
|
|
45
46
|
/** One old-vs-new delta, always attributed to a region. */
|
|
46
47
|
type CompareFinding = Finding & {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
regionKey: string;
|
|
49
|
+
kind: 'region-removed' | 'region-degraded' | 'value-missing' | 'region-added';
|
|
50
|
+
/** Stable signature of the delta — identical across routes for shared chrome. */
|
|
51
|
+
valueSignature: string;
|
|
52
|
+
/** Present when a config rule suppressed this delta; it never fails the verdict. */
|
|
53
|
+
suppressed?: {
|
|
54
|
+
reason: string;
|
|
55
|
+
};
|
|
55
56
|
};
|
|
56
57
|
/**
|
|
57
58
|
* One expected-absent rule. `region` (exact or `*`-glob against {@link Region.key})
|
|
@@ -60,42 +61,43 @@ type CompareFinding = Finding & {
|
|
|
60
61
|
* surfaced in the report so suppression is auditable, never silent.
|
|
61
62
|
*/
|
|
62
63
|
declare const ExpectedAbsentRule: z.ZodObject<{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
region: z.ZodOptional<z.ZodString>;
|
|
65
|
+
value: z.ZodOptional<z.ZodString>;
|
|
66
|
+
reason: z.ZodString;
|
|
66
67
|
}, z.core.$strip>;
|
|
67
68
|
type ExpectedAbsentRule = z.infer<typeof ExpectedAbsentRule>;
|
|
68
69
|
/** Semantic-compare configuration — the allowlist plus extra state markers. */
|
|
69
70
|
declare const CompareConfig: z.ZodObject<{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
expectedAbsent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
72
|
+
region: z.ZodOptional<z.ZodString>;
|
|
73
|
+
value: z.ZodOptional<z.ZodString>;
|
|
74
|
+
reason: z.ZodString;
|
|
75
|
+
}, z.core.$strip>>>;
|
|
76
|
+
emptyStateMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
+
errorStateMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
78
|
}, z.core.$strip>;
|
|
78
79
|
type CompareConfig = z.infer<typeof CompareConfig>;
|
|
79
|
-
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/types.d.ts
|
|
80
82
|
/** A named viewport the harness renders and captures at. */
|
|
81
83
|
type Viewport = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
label: string;
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
85
87
|
};
|
|
86
88
|
/** A single console / page-error message emitted while the page loaded. */
|
|
87
89
|
type ConsoleEntry = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
type: string;
|
|
91
|
+
text: string;
|
|
92
|
+
location?: string;
|
|
91
93
|
};
|
|
92
94
|
/** A network response or failed request observed during load. */
|
|
93
95
|
type NetworkEntry = {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
url: string;
|
|
97
|
+
method: string;
|
|
98
|
+
/** HTTP status, or 0 for a request that failed before a response. */
|
|
99
|
+
status: number;
|
|
100
|
+
failure?: string;
|
|
99
101
|
};
|
|
100
102
|
/**
|
|
101
103
|
* Ground truth captured from a rendered page — the input every verdict axis
|
|
@@ -103,43 +105,43 @@ type NetworkEntry = {
|
|
|
103
105
|
* so it is safe to serialize and pass to a VLM.
|
|
104
106
|
*/
|
|
105
107
|
type CaptureArtifact = {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
url: string;
|
|
109
|
+
viewport: Viewport;
|
|
110
|
+
/** Full-page PNG bytes. */
|
|
111
|
+
screenshot: Uint8Array;
|
|
112
|
+
/** Serialized outer HTML of the document after load. */
|
|
113
|
+
dom: string;
|
|
114
|
+
/**
|
|
115
|
+
* Trimmed `body.innerText` read from the live DOM when available. An empty
|
|
116
|
+
* string is a reliable white-screen signal — more robust than parsing
|
|
117
|
+
* {@link dom}. Absent only when an artifact is built without a live page.
|
|
118
|
+
*/
|
|
119
|
+
renderedText?: string;
|
|
120
|
+
console: ConsoleEntry[];
|
|
121
|
+
network: NetworkEntry[];
|
|
120
122
|
};
|
|
121
|
-
declare const SEVERITIES: readonly [
|
|
123
|
+
declare const SEVERITIES: readonly ['critical', 'serious', 'moderate', 'minor'];
|
|
122
124
|
type Severity = (typeof SEVERITIES)[number];
|
|
123
125
|
/** One problem an axis found. */
|
|
124
126
|
type Finding = {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
message: string;
|
|
128
|
+
severity: Severity;
|
|
129
|
+
/** Optional extra context — a stack, a WCAG id, a selector, a diff ratio. */
|
|
130
|
+
detail?: string;
|
|
131
|
+
/** Optional pointer — WCAG ref, DOM selector, request URL, etc. */
|
|
132
|
+
ref?: string;
|
|
131
133
|
};
|
|
132
134
|
/** The result of running one axis against one page. */
|
|
133
135
|
type Verdict = {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
axis: string;
|
|
137
|
+
pass: boolean;
|
|
138
|
+
findings: Finding[];
|
|
137
139
|
};
|
|
138
140
|
/** The combined result of running every axis against one page. */
|
|
139
141
|
type AggregateVerdict = {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
url: string;
|
|
143
|
+
pass: boolean;
|
|
144
|
+
verdicts: Verdict[];
|
|
143
145
|
};
|
|
144
146
|
/**
|
|
145
147
|
* Everything an axis may need. Different axes use different fields — a11y and
|
|
@@ -150,21 +152,21 @@ type AggregateVerdict = {
|
|
|
150
152
|
* missing.
|
|
151
153
|
*/
|
|
152
154
|
type AxisContext = {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
155
|
+
artifact: CaptureArtifact;
|
|
156
|
+
/** Live page for the primary capture, when the run keeps a browser open. */
|
|
157
|
+
page?: Page;
|
|
158
|
+
/** Shared browser, for axes that need to render additional pages. */
|
|
159
|
+
browser?: Browser;
|
|
160
|
+
/** The natural-language brief the UI was generated from. */
|
|
161
|
+
brief?: string;
|
|
162
|
+
/** A prior screenshot to diff the current one against. */
|
|
163
|
+
baseline?: Uint8Array;
|
|
164
|
+
/** Re-render the same route under a different brand id and capture it. */
|
|
165
|
+
captureUnderBrand?: (brand: string) => Promise<CaptureArtifact>;
|
|
166
|
+
/** The "old" UI reduced to regions — enables the compare axis when present. */
|
|
167
|
+
comparison?: CompareSnapshot;
|
|
168
|
+
/** Allowlist + state markers for the compare axis. */
|
|
169
|
+
compareConfig?: CompareConfig;
|
|
168
170
|
};
|
|
169
171
|
/**
|
|
170
172
|
* A verdict axis. Each of the axes (runtime-health, accessibility,
|
|
@@ -174,10 +176,11 @@ type AxisContext = {
|
|
|
174
176
|
* into a failing verdict, but a clear finding is better.
|
|
175
177
|
*/
|
|
176
178
|
type Axis = {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
+
name: string;
|
|
180
|
+
run: (context: AxisContext) => Promise<Verdict>;
|
|
179
181
|
};
|
|
180
|
-
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/capture.d.ts
|
|
181
184
|
declare const DESKTOP_VIEWPORT: Viewport;
|
|
182
185
|
declare const MOBILE_VIEWPORT: Viewport;
|
|
183
186
|
declare const DEFAULT_VIEWPORTS: Viewport[];
|
|
@@ -189,27 +192,29 @@ declare const DEFAULT_VIEWPORTS: Viewport[];
|
|
|
189
192
|
*/
|
|
190
193
|
declare const capturePage: (page: Page, url: string, viewport: Viewport, timeoutMs?: number) => Promise<CaptureArtifact>;
|
|
191
194
|
type CaptureOptions = {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
viewports?: Viewport[];
|
|
196
|
+
/** Reuse an existing browser instead of launching (and closing) one. */
|
|
197
|
+
browser?: Browser;
|
|
198
|
+
timeoutMs?: number;
|
|
196
199
|
};
|
|
197
200
|
/**
|
|
198
201
|
* Launch a headless browser (unless one is supplied), render `url` at each
|
|
199
202
|
* viewport in a fresh context, and return one artifact per viewport.
|
|
200
203
|
*/
|
|
201
204
|
declare const capture: (url: string, options?: CaptureOptions) => Promise<CaptureArtifact[]>;
|
|
202
|
-
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/prepare-screenshot.d.ts
|
|
203
207
|
/**
|
|
204
208
|
* Settle the page before a screenshot: freeze animations first (so parking the
|
|
205
209
|
* mouse can't trigger a transition), park the cursor off any element, and wait
|
|
206
210
|
* for web fonts. Deterministic output makes visual diffs meaningful.
|
|
207
211
|
*/
|
|
208
212
|
declare const prepareForScreenshot: (page: Page) => Promise<void>;
|
|
209
|
-
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/serve.d.ts
|
|
210
215
|
type StaticServer = {
|
|
211
|
-
|
|
212
|
-
|
|
216
|
+
url: string;
|
|
217
|
+
close: () => Promise<void>;
|
|
213
218
|
};
|
|
214
219
|
/**
|
|
215
220
|
* Serve a built SPA directory (e.g. `apps/boilerplate/dist`) on an ephemeral
|
|
@@ -218,7 +223,8 @@ type StaticServer = {
|
|
|
218
223
|
* dependency added.
|
|
219
224
|
*/
|
|
220
225
|
declare const serveStatic: (rootDir: string) => Promise<StaticServer>;
|
|
221
|
-
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/aggregate.d.ts
|
|
222
228
|
/**
|
|
223
229
|
* Run each axis against the shared context, isolating failures: an axis that
|
|
224
230
|
* throws becomes a failing verdict instead of aborting the whole run. The error
|
|
@@ -228,20 +234,20 @@ declare const runAxes: (axes: Axis[], context: AxisContext) => Promise<Verdict[]
|
|
|
228
234
|
/** A run passes only when every axis passed. */
|
|
229
235
|
declare const aggregatePass: (verdicts: Verdict[]) => boolean;
|
|
230
236
|
type ValidateOptions = {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
237
|
+
url: string;
|
|
238
|
+
brief?: string;
|
|
239
|
+
baseline?: Uint8Array;
|
|
240
|
+
/** Viewport axes run against (a11y/visual use one). Defaults to desktop. */
|
|
241
|
+
viewport?: Viewport;
|
|
242
|
+
/** Override the axis set — defaults to all four registered axes. */
|
|
243
|
+
axes?: Axis[];
|
|
244
|
+
/** Reuse a browser instead of launching one. */
|
|
245
|
+
browser?: Browser;
|
|
246
|
+
timeoutMs?: number;
|
|
247
|
+
/** The "old" UI reduced to regions — enables the compare axis when present. */
|
|
248
|
+
comparison?: CompareSnapshot;
|
|
249
|
+
/** Allowlist + state markers for the compare axis. */
|
|
250
|
+
compareConfig?: CompareConfig;
|
|
245
251
|
};
|
|
246
252
|
/**
|
|
247
253
|
* The closed loop: render `url`, capture ground truth, and run every axis over
|
|
@@ -250,11 +256,14 @@ type ValidateOptions = {
|
|
|
250
256
|
* `captureUnderBrand` for the alt-brand fitness function.
|
|
251
257
|
*/
|
|
252
258
|
declare const validate: (options: ValidateOptions) => Promise<AggregateVerdict>;
|
|
253
|
-
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/axes/accessibility.d.ts
|
|
254
261
|
declare const accessibilityAxis: Axis;
|
|
255
|
-
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/axes/brief-conformance.d.ts
|
|
256
264
|
declare const briefConformanceAxis: Axis;
|
|
257
|
-
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/axes/compare.d.ts
|
|
258
267
|
/**
|
|
259
268
|
* A5 · Semantic old-vs-new compare verdict — UT-4572.
|
|
260
269
|
*
|
|
@@ -266,7 +275,8 @@ declare const briefConformanceAxis: Axis;
|
|
|
266
275
|
* to an empty/error state is reported informationally rather than as value loss.
|
|
267
276
|
*/
|
|
268
277
|
declare const compareAxis: Axis;
|
|
269
|
-
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/axes/runtime-health.d.ts
|
|
270
280
|
/**
|
|
271
281
|
* A2 · Runtime-health verdict — UT-4493.
|
|
272
282
|
*
|
|
@@ -275,7 +285,8 @@ declare const compareAxis: Axis;
|
|
|
275
285
|
* signals into `findings`.
|
|
276
286
|
*/
|
|
277
287
|
declare const runtimeHealthAxis: Axis;
|
|
278
|
-
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/axes/visual-brand.d.ts
|
|
279
290
|
/**
|
|
280
291
|
* A4 · Visual & brand-correctness verdict — UT-4495.
|
|
281
292
|
*
|
|
@@ -287,14 +298,16 @@ declare const runtimeHealthAxis: Axis;
|
|
|
287
298
|
* stay fixed pixel-wise is future work; see `altBrandFinding`.)
|
|
288
299
|
*/
|
|
289
300
|
declare const visualBrandAxis: Axis;
|
|
290
|
-
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/axes/index.d.ts
|
|
291
303
|
/**
|
|
292
304
|
* The registered axes, in report order. `compare` runs last and only activates
|
|
293
305
|
* when a comparison snapshot is supplied, so ordinary single-page runs are
|
|
294
306
|
* unaffected.
|
|
295
307
|
*/
|
|
296
308
|
declare const ALL_AXES: Axis[];
|
|
297
|
-
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/compare/diff.d.ts
|
|
298
311
|
/**
|
|
299
312
|
* Semantic old-vs-new diff of two snapshots. Walks regions by key and localizes
|
|
300
313
|
* every delta to a region: a removed region is `serious` unless allowlisted; a
|
|
@@ -306,17 +319,18 @@ declare const ALL_AXES: Axis[];
|
|
|
306
319
|
declare const diffSnapshots: (oldSnap: CompareSnapshot, newSnap: CompareSnapshot, config?: CompareConfig) => CompareFinding[];
|
|
307
320
|
/** A compare run passes when no active (non-suppressed) delta is serious/critical. */
|
|
308
321
|
declare const comparePass: (findings: CompareFinding[]) => boolean;
|
|
309
|
-
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/compare/dedup.d.ts
|
|
310
324
|
/** One route's compare findings. */
|
|
311
325
|
type RouteFindings = {
|
|
312
|
-
|
|
313
|
-
|
|
326
|
+
route: string;
|
|
327
|
+
findings: CompareFinding[];
|
|
314
328
|
};
|
|
315
329
|
type DedupResult = {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
330
|
+
/** Findings seen on ≥2 routes, collapsed to one entry tagged with the route count. */
|
|
331
|
+
sharedChrome: CompareFinding[];
|
|
332
|
+
/** Per-route findings with the shared-chrome copies removed. */
|
|
333
|
+
perRoute: RouteFindings[];
|
|
320
334
|
};
|
|
321
335
|
/**
|
|
322
336
|
* Collapse deltas that recur across routes into a single `shared-chrome` finding.
|
|
@@ -326,7 +340,8 @@ type DedupResult = {
|
|
|
326
340
|
* from each route's own list. Pure — no browser, no I/O.
|
|
327
341
|
*/
|
|
328
342
|
declare const dedupeSharedChrome: (perRoute: RouteFindings[]) => DedupResult;
|
|
329
|
-
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region src/compare/regions.d.ts
|
|
330
345
|
/**
|
|
331
346
|
* Reduce the live page to its diffable regions, in the browser. An explicit
|
|
332
347
|
* `[data-region]` is an authoritative boundary (its subtree is one region);
|
|
@@ -338,34 +353,35 @@ declare const dedupeSharedChrome: (perRoute: RouteFindings[]) => DedupResult;
|
|
|
338
353
|
* tokens. Symmetric across old and new so the two sides diff cleanly.
|
|
339
354
|
*/
|
|
340
355
|
declare const extractRegions: (page: Page, config?: CompareConfig) => Promise<Region[]>;
|
|
341
|
-
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/compare/runner.d.ts
|
|
342
358
|
/** How the "old" side is sourced — booted live or loaded from recorded snapshots, never both. */
|
|
343
359
|
type OldSource = {
|
|
344
|
-
|
|
345
|
-
|
|
360
|
+
oldBaseUrl: string;
|
|
361
|
+
oldSnapshotDir?: never;
|
|
346
362
|
} | {
|
|
347
|
-
|
|
348
|
-
|
|
363
|
+
oldSnapshotDir: string;
|
|
364
|
+
oldBaseUrl?: never;
|
|
349
365
|
};
|
|
350
366
|
type CompareRoutesOptions = OldSource & {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
367
|
+
/** Base URL of the new build, joined with each route. */
|
|
368
|
+
newBaseUrl: string;
|
|
369
|
+
routes: string[];
|
|
370
|
+
config?: CompareConfig;
|
|
371
|
+
browser?: Browser;
|
|
372
|
+
viewport?: Viewport;
|
|
373
|
+
timeoutMs?: number;
|
|
358
374
|
};
|
|
359
375
|
type RouteCompareResult = {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
376
|
+
route: string;
|
|
377
|
+
findings: CompareFinding[];
|
|
378
|
+
pass: boolean;
|
|
363
379
|
};
|
|
364
380
|
type CompareRoutesResult = {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
381
|
+
routes: RouteCompareResult[];
|
|
382
|
+
/** Deltas seen on ≥2 routes, reported once (e.g. shared chrome / daily-brief). */
|
|
383
|
+
sharedChrome: CompareFinding[];
|
|
384
|
+
pass: boolean;
|
|
369
385
|
};
|
|
370
386
|
/** Recorded old snapshot filename for a route: `/a/b` → `a_b.json`, `/` → `index.json`. */
|
|
371
387
|
declare const routeSnapshotFile: (route: string) => string;
|
|
@@ -377,12 +393,14 @@ declare const routeSnapshotFile: (route: string) => string;
|
|
|
377
393
|
* `oldBaseUrl` / `oldSnapshotDir` must be given.
|
|
378
394
|
*/
|
|
379
395
|
declare const compareRoutes: (options: CompareRoutesOptions) => Promise<CompareRoutesResult>;
|
|
380
|
-
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/compare/snapshot.d.ts
|
|
381
398
|
/** Reduce a loaded live page to a {@link CompareSnapshot} for the given route. */
|
|
382
399
|
declare const captureSnapshot: (page: Page, route: string, config?: CompareConfig) => Promise<CompareSnapshot>;
|
|
383
400
|
/** Persist a snapshot as pretty JSON so an "old" side can be recorded once and re-diffed. */
|
|
384
401
|
declare const saveSnapshot: (snapshot: CompareSnapshot, path: string) => Promise<void>;
|
|
385
402
|
/** Read and validate a recorded snapshot from disk. */
|
|
386
403
|
declare const loadSnapshot: (path: string) => Promise<CompareSnapshot>;
|
|
387
|
-
|
|
404
|
+
//#endregion
|
|
388
405
|
export { ALL_AXES, type AggregateVerdict, type Axis, type AxisContext, type CaptureArtifact, type CaptureOptions, CompareConfig, type CompareFinding, type CompareRoutesOptions, type CompareRoutesResult, CompareSnapshot, type ConsoleEntry, DEFAULT_VIEWPORTS, DESKTOP_VIEWPORT, type DedupResult, ExpectedAbsentRule, type Finding, MOBILE_VIEWPORT, type NetworkEntry, REGION_STATES, Region, type RegionState, type RouteCompareResult, type RouteFindings, SEVERITIES, type Severity, type StaticServer, type ValidateOptions, type Verdict, type Viewport, accessibilityAxis, aggregatePass, briefConformanceAxis, capture, capturePage, captureSnapshot, compareAxis, comparePass, compareRoutes, dedupeSharedChrome, diffSnapshots, extractRegions, loadSnapshot, prepareForScreenshot, routeSnapshotFile, runAxes, runtimeHealthAxis, saveSnapshot, serveStatic, validate, visualBrandAxis };
|
|
406
|
+
//# sourceMappingURL=index.d.ts.map
|