@regressionbot/sdk 2.1.0 → 2.2.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 +10 -0
- package/dist/index.js +4 -1
- package/dist/types.d.ts +43 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,6 +74,16 @@ the builder, intent-aware verdicts, environment gates, baseline policies, and
|
|
|
74
74
|
scheduling. `scheduleHourUtc` needs API 2.7.0 or later — on an older API the
|
|
75
75
|
field is accepted and ignored, and the schedule stays anchored to its first run.
|
|
76
76
|
|
|
77
|
+
### 2.2.0
|
|
78
|
+
|
|
79
|
+
- **Six metadata `ChangeType`s added** (`meta-edit`, `meta-insert`, `meta-delete`,
|
|
80
|
+
`schema-edit`, `schema-insert`, `schema-delete`), plus `PageResult.metadataChanged`
|
|
81
|
+
and `Change.collapsed`. The API already returned the first two; the types never
|
|
82
|
+
declared them. None carry a `box`.
|
|
83
|
+
- **`downloadResults()` no longer saves a plain screenshot as a diff.** A page that
|
|
84
|
+
changed with no changed pixels has `diffUrl === currentUrl`; the diff download is
|
|
85
|
+
skipped for it, and `--full` still saves the capture as `_current_`.
|
|
86
|
+
|
|
77
87
|
### 2.0.1 — never published separately; included in 2.1.0
|
|
78
88
|
|
|
79
89
|
Upgrading from 2.0.0 goes straight to 2.1.0, so read this section as well as the
|
package/dist/index.js
CHANGED
|
@@ -264,7 +264,10 @@ class JobHandle {
|
|
|
264
264
|
for (const r of summary.regressions) {
|
|
265
265
|
const nameBase = (0, security_1.sanitizeUrlToPath)(r.url);
|
|
266
266
|
const safeVariant = (0, security_1.sanitizeFilename)(r.variantName);
|
|
267
|
-
|
|
267
|
+
// A change with no changed pixels has no diff image: its diffUrl is the current
|
|
268
|
+
// capture's link, so saving it under a _diff_ name would file the plain screenshot
|
|
269
|
+
// as a diff. Nothing to save there; --full still writes it as _current_.
|
|
270
|
+
if (r.diffUrl && r.diffUrl !== r.currentUrl)
|
|
268
271
|
await download(r.diffUrl, `${nameBase}_diff_${safeVariant}`);
|
|
269
272
|
if (options.full) {
|
|
270
273
|
if (r.baselineUrl)
|
package/dist/types.d.ts
CHANGED
|
@@ -207,7 +207,14 @@ export interface ResultVerdict {
|
|
|
207
207
|
* `sticky-reposition` is a move of a positioned element, and `reflow-displacement` is
|
|
208
208
|
* content pushed by a change elsewhere — both are consequences, not edits.
|
|
209
209
|
*/
|
|
210
|
-
export type ChangeType = 'text-edit' | 'insert' | 'delete' | 'style-only' | 'image-change' | 'move' | 'move-with-edit' | 'sticky-reposition' | 'reflow-displacement'
|
|
210
|
+
export type ChangeType = 'text-edit' | 'insert' | 'delete' | 'style-only' | 'image-change' | 'move' | 'move-with-edit' | 'sticky-reposition' | 'reflow-displacement'
|
|
211
|
+
/**
|
|
212
|
+
* The six metadata types: the page's head or its structured data changed while nothing
|
|
213
|
+
* visible moved — a title edited, a canonical rewritten, a JSON-LD block dropped. They
|
|
214
|
+
* carry no `box`, because they paint nothing; `element` names the field instead
|
|
215
|
+
* (`title`, `meta[description]`, `link[rel=canonical]`, `ld+json[FAQPage]`).
|
|
216
|
+
*/
|
|
217
|
+
| 'meta-edit' | 'meta-insert' | 'meta-delete' | 'schema-edit' | 'schema-insert' | 'schema-delete';
|
|
211
218
|
/** One changed CSS property, as `[from, to]`. */
|
|
212
219
|
export type StyleDelta = [from: string, to: string];
|
|
213
220
|
/** A rectangle in the capture, in CSS pixels. See {@link Change.box}. */
|
|
@@ -225,12 +232,19 @@ export interface Change {
|
|
|
225
232
|
type: ChangeType;
|
|
226
233
|
/**
|
|
227
234
|
* Tag name only, lowercase, e.g. `div` — not a CSS selector and not unique on the page.
|
|
228
|
-
* For something you can query
|
|
235
|
+
* For a metadata type, the field that changed instead. For something you can query
|
|
236
|
+
* with, see `PageResult.elementsChanged`.
|
|
229
237
|
*/
|
|
230
238
|
element: string;
|
|
231
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* The text before the edit. Absent on an insert.
|
|
241
|
+
*
|
|
242
|
+
* Clipped to 200 characters. A long passage with one edit deep inside it is quoted from
|
|
243
|
+
* where the two sides diverge, with a leading `…`, so `before` and `after` always show
|
|
244
|
+
* the words that changed rather than a shared opening that hides them.
|
|
245
|
+
*/
|
|
232
246
|
before?: string;
|
|
233
|
-
/** The text after the edit. Absent on a delete. */
|
|
247
|
+
/** The text after the edit. Absent on a delete. Clipped the same way as `before`. */
|
|
234
248
|
after?: string;
|
|
235
249
|
/** Changed computed styles, keyed by CSS property name. */
|
|
236
250
|
style?: Record<string, StyleDelta>;
|
|
@@ -243,9 +257,19 @@ export interface Change {
|
|
|
243
257
|
*
|
|
244
258
|
* Absent on a delete, and absent whenever the element's position cannot be trusted:
|
|
245
259
|
* an out-of-flow element reports a viewport-relative rect that would point at empty
|
|
246
|
-
* space in a full-page image, so the box is omitted rather than sent wrong.
|
|
260
|
+
* space in a full-page image, so the box is omitted rather than sent wrong. Always
|
|
261
|
+
* absent on the metadata types and on a {@link Change.collapsed} change, which paint
|
|
262
|
+
* nothing. A filter written as `c.box && c.box.y < N` silently drops all of those.
|
|
247
263
|
*/
|
|
248
264
|
box?: ChangeBox;
|
|
265
|
+
/**
|
|
266
|
+
* Present and true when the element sits inside a closed `<details>`. The browser lays
|
|
267
|
+
* such content out but never paints it, so the change is real and in the document while
|
|
268
|
+
* nothing in either capture shows it — an edited FAQ answer nobody expanded. Say
|
|
269
|
+
* "inside a collapsed section" when reporting it; a reader sent to the screenshot will
|
|
270
|
+
* not find it there.
|
|
271
|
+
*/
|
|
272
|
+
collapsed?: boolean;
|
|
249
273
|
/**
|
|
250
274
|
* Where it was in the baseline, in the same coordinate space, present only when it
|
|
251
275
|
* differs from `box` in position or size. Subtract for the move vector
|
|
@@ -289,6 +313,12 @@ export interface PageResult {
|
|
|
289
313
|
* reason a page can be `changed` at a `diffPercentage` of 0.
|
|
290
314
|
*/
|
|
291
315
|
contentChanged?: true;
|
|
316
|
+
/**
|
|
317
|
+
* Present and true when the head or structured data changed while nothing visible
|
|
318
|
+
* moved. There is nothing to see in the images for these; read `changes`. Absent on a
|
|
319
|
+
* page whose baseline predates metadata capture, which is silence rather than "no".
|
|
320
|
+
*/
|
|
321
|
+
metadataChanged?: true;
|
|
292
322
|
/**
|
|
293
323
|
* Percentage of pixels that differed from the baseline. Not a change test on its own:
|
|
294
324
|
* 0 does not mean identical — see `changed`.
|
|
@@ -332,7 +362,14 @@ export interface PageResult {
|
|
|
332
362
|
baselineUrl: string | null;
|
|
333
363
|
/** Pre-signed URL for the newly captured screenshot. */
|
|
334
364
|
currentUrl: string | null;
|
|
335
|
-
/**
|
|
365
|
+
/**
|
|
366
|
+
* The page's inspect link. Fetched, it returns the side-by-side annotated diff image;
|
|
367
|
+
* opened in a browser it goes to the inspect view. Null for an unchanged page.
|
|
368
|
+
*
|
|
369
|
+
* A page that changed with no changed pixels — a text edit inside a collapsed section,
|
|
370
|
+
* a metadata change — has no diff image, so this is the current capture's link instead
|
|
371
|
+
* and equals `currentUrl`. It still opens the inspect view with the document diff.
|
|
372
|
+
*/
|
|
336
373
|
diffUrl: string | null;
|
|
337
374
|
}
|
|
338
375
|
export interface JobProgress {
|
package/package.json
CHANGED