@regressionbot/sdk 2.1.0 → 2.2.1
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 +19 -0
- package/dist/index.js +5 -6
- package/dist/types.d.ts +43 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,6 +74,25 @@ 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.1
|
|
78
|
+
|
|
79
|
+
- **A builder run with no `check()` or `scan()` no longer invents a home path.** It
|
|
80
|
+
used to send `paths: [{ path: '/', label: 'Home' }]`, which the API compared to the
|
|
81
|
+
saved project and rejected whenever the project stored anything other than exactly
|
|
82
|
+
`/`. Now `paths` is omitted, and the API fills it from the saved project. Needs an
|
|
83
|
+
API that fills omitted run params from the stored project (shipped alongside this
|
|
84
|
+
release); on an older API a scope-less run captures the home page only.
|
|
85
|
+
|
|
86
|
+
### 2.2.0
|
|
87
|
+
|
|
88
|
+
- **Six metadata `ChangeType`s added** (`meta-edit`, `meta-insert`, `meta-delete`,
|
|
89
|
+
`schema-edit`, `schema-insert`, `schema-delete`), plus `PageResult.metadataChanged`
|
|
90
|
+
and `Change.collapsed`. The API already returned the first two; the types never
|
|
91
|
+
declared them. None carry a `box`.
|
|
92
|
+
- **`downloadResults()` no longer saves a plain screenshot as a diff.** A page that
|
|
93
|
+
changed with no changed pixels has `diffUrl === currentUrl`; the diff download is
|
|
94
|
+
skipped for it, and `--full` still saves the capture as `_current_`.
|
|
95
|
+
|
|
77
96
|
### 2.0.1 — never published separately; included in 2.1.0
|
|
78
97
|
|
|
79
98
|
Upgrading from 2.0.0 goes straight to 2.1.0, so read this section as well as the
|
package/dist/index.js
CHANGED
|
@@ -173,10 +173,6 @@ class JobBuilder {
|
|
|
173
173
|
if (!this.manifest.projectId && !this.manifest.baseOrigin) {
|
|
174
174
|
throw new Error('Project ID is required. Use .forProject("id") or provide an origin to compare against using .against()');
|
|
175
175
|
}
|
|
176
|
-
// If no checks/scans provided, default to root
|
|
177
|
-
if (this.manifest.checks.length === 0 && this.manifest.scans.length === 0) {
|
|
178
|
-
this.manifest.checks.push({ path: '/', label: 'Home' });
|
|
179
|
-
}
|
|
180
176
|
// Every field present here is compared against the saved project config, and a
|
|
181
177
|
// value that differs fails the run rather than overriding it. So a field the
|
|
182
178
|
// caller never set must stay absent: an empty `devices` or a `concurrency` this
|
|
@@ -187,7 +183,7 @@ class JobBuilder {
|
|
|
187
183
|
sitemapUrl: this.manifest.sitemapUrl,
|
|
188
184
|
baseOrigin: this.manifest.baseOrigin,
|
|
189
185
|
devices: this.manifest.variants.length > 0 ? this.manifest.variants : undefined,
|
|
190
|
-
paths: this.manifest.checks,
|
|
186
|
+
paths: this.manifest.checks.length > 0 ? this.manifest.checks : undefined,
|
|
191
187
|
scans: this.manifest.scans.length > 0 ? this.manifest.scans : undefined,
|
|
192
188
|
concurrency: this.manifest.concurrency,
|
|
193
189
|
autoApprove: this.manifest.autoApprove,
|
|
@@ -264,7 +260,10 @@ class JobHandle {
|
|
|
264
260
|
for (const r of summary.regressions) {
|
|
265
261
|
const nameBase = (0, security_1.sanitizeUrlToPath)(r.url);
|
|
266
262
|
const safeVariant = (0, security_1.sanitizeFilename)(r.variantName);
|
|
267
|
-
|
|
263
|
+
// A change with no changed pixels has no diff image: its diffUrl is the current
|
|
264
|
+
// capture's link, so saving it under a _diff_ name would file the plain screenshot
|
|
265
|
+
// as a diff. Nothing to save there; --full still writes it as _current_.
|
|
266
|
+
if (r.diffUrl && r.diffUrl !== r.currentUrl)
|
|
268
267
|
await download(r.diffUrl, `${nameBase}_diff_${safeVariant}`);
|
|
269
268
|
if (options.full) {
|
|
270
269
|
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