@visual-check/cli 0.1.1 → 0.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/dist/addon-child/image-files.js +1 -1
- package/dist/addon-child/image-files.js.map +1 -1
- package/dist/agent-skill/skill-files.d.ts +4 -0
- package/dist/agent-skill/skill-files.d.ts.map +1 -1
- package/dist/agent-skill/skill-files.js +4 -0
- package/dist/agent-skill/skill-files.js.map +1 -1
- package/dist/baselines/baseline-error.d.ts +15 -2
- package/dist/baselines/baseline-error.d.ts.map +1 -1
- package/dist/baselines/baseline-error.js +32 -2
- package/dist/baselines/baseline-error.js.map +1 -1
- package/dist/capture/capture-session.d.ts +161 -30
- package/dist/capture/capture-session.d.ts.map +1 -1
- package/dist/capture/capture-session.js +284 -64
- package/dist/capture/capture-session.js.map +1 -1
- package/dist/capture/driver/cdp/cdp-page.d.ts.map +1 -1
- package/dist/capture/driver/cdp/cdp-page.js +120 -31
- package/dist/capture/driver/cdp/cdp-page.js.map +1 -1
- package/dist/capture/driver/cdp/failed-loads.d.ts +16 -0
- package/dist/capture/driver/cdp/failed-loads.d.ts.map +1 -0
- package/dist/capture/driver/cdp/failed-loads.js +71 -0
- package/dist/capture/driver/cdp/failed-loads.js.map +1 -0
- package/dist/capture/driver/cdp/launch-arguments.d.ts +7 -1
- package/dist/capture/driver/cdp/launch-arguments.d.ts.map +1 -1
- package/dist/capture/driver/cdp/launch-arguments.js +8 -1
- package/dist/capture/driver/cdp/launch-arguments.js.map +1 -1
- package/dist/capture/driver/driver.d.ts +88 -4
- package/dist/capture/driver/driver.d.ts.map +1 -1
- package/dist/capture/driver/driver.js +33 -0
- package/dist/capture/driver/driver.js.map +1 -1
- package/dist/capture/end-state.d.ts +3 -5
- package/dist/capture/end-state.d.ts.map +1 -1
- package/dist/capture/end-state.js +7 -43
- package/dist/capture/end-state.js.map +1 -1
- package/dist/capture/frames.d.ts +18 -0
- package/dist/capture/frames.d.ts.map +1 -0
- package/dist/capture/frames.js +54 -0
- package/dist/capture/frames.js.map +1 -0
- package/dist/capture/page-script.d.ts +34 -1
- package/dist/capture/page-script.d.ts.map +1 -1
- package/dist/capture/page-script.js +58 -2
- package/dist/capture/page-script.js.map +1 -1
- package/dist/capture/prepare-capture.d.ts +50 -3
- package/dist/capture/prepare-capture.d.ts.map +1 -1
- package/dist/capture/prepare-capture.js +157 -16
- package/dist/capture/prepare-capture.js.map +1 -1
- package/dist/commands/check-storybooks.d.ts +5 -4
- package/dist/commands/check-storybooks.d.ts.map +1 -1
- package/dist/commands/check-storybooks.js +11 -8
- package/dist/commands/check-storybooks.js.map +1 -1
- package/dist/commands/consistency-output.d.ts.map +1 -1
- package/dist/commands/consistency-output.js +3 -3
- package/dist/commands/consistency-output.js.map +1 -1
- package/dist/commands/failed-loads-hint.d.ts +7 -0
- package/dist/commands/failed-loads-hint.d.ts.map +1 -0
- package/dist/commands/failed-loads-hint.js +16 -0
- package/dist/commands/failed-loads-hint.js.map +1 -0
- package/dist/commands/local-update.d.ts +22 -0
- package/dist/commands/local-update.d.ts.map +1 -0
- package/dist/commands/local-update.js +39 -0
- package/dist/commands/local-update.js.map +1 -0
- package/dist/commands/network-warning.d.ts.map +1 -1
- package/dist/commands/network-warning.js +2 -18
- package/dist/commands/network-warning.js.map +1 -1
- package/dist/commands/plan-snapshots.d.ts +23 -8
- package/dist/commands/plan-snapshots.d.ts.map +1 -1
- package/dist/commands/plan-snapshots.js +15 -9
- package/dist/commands/plan-snapshots.js.map +1 -1
- package/dist/commands/report-entries.d.ts +5 -2
- package/dist/commands/report-entries.d.ts.map +1 -1
- package/dist/commands/report-entries.js +63 -15
- package/dist/commands/report-entries.js.map +1 -1
- package/dist/commands/run-browser.d.ts +5 -5
- package/dist/commands/run-browser.d.ts.map +1 -1
- package/dist/commands/run-browser.js +1 -0
- package/dist/commands/run-browser.js.map +1 -1
- package/dist/commands/run-cli.d.ts +16 -5
- package/dist/commands/run-cli.d.ts.map +1 -1
- package/dist/commands/run-cli.js +74 -54
- package/dist/commands/run-cli.js.map +1 -1
- package/dist/commands/run-report.d.ts +3 -3
- package/dist/commands/run-report.d.ts.map +1 -1
- package/dist/commands/run-report.js +4 -2
- package/dist/commands/run-report.js.map +1 -1
- package/dist/commands/run-snapshots.d.ts +7 -4
- package/dist/commands/run-snapshots.d.ts.map +1 -1
- package/dist/commands/run-snapshots.js +49 -17
- package/dist/commands/run-snapshots.js.map +1 -1
- package/dist/commands/snapshot-result.d.ts +66 -9
- package/dist/commands/snapshot-result.d.ts.map +1 -1
- package/dist/commands/snapshot-result.js +46 -6
- package/dist/commands/snapshot-result.js.map +1 -1
- package/dist/commands/stop-message.d.ts.map +1 -1
- package/dist/commands/stop-message.js +6 -1
- package/dist/commands/stop-message.js.map +1 -1
- package/dist/commands/stopped-run.d.ts +10 -5
- package/dist/commands/stopped-run.d.ts.map +1 -1
- package/dist/commands/stopped-run.js +35 -22
- package/dist/commands/stopped-run.js.map +1 -1
- package/dist/commands/take-snapshot.d.ts +9 -6
- package/dist/commands/take-snapshot.d.ts.map +1 -1
- package/dist/commands/take-snapshot.js +16 -7
- package/dist/commands/take-snapshot.js.map +1 -1
- package/dist/commands/test-snapshot.d.ts +2 -2
- package/dist/commands/test-snapshot.d.ts.map +1 -1
- package/dist/commands/test-snapshot.js.map +1 -1
- package/dist/commands/update-baselines.d.ts.map +1 -1
- package/dist/commands/update-baselines.js +3 -2
- package/dist/commands/update-baselines.js.map +1 -1
- package/dist/commands/update-snapshot.d.ts +22 -4
- package/dist/commands/update-snapshot.d.ts.map +1 -1
- package/dist/commands/update-snapshot.js +79 -18
- package/dist/commands/update-snapshot.js.map +1 -1
- package/dist/config/checks.d.ts +26 -0
- package/dist/config/checks.d.ts.map +1 -1
- package/dist/config/checks.js +68 -6
- package/dist/config/checks.js.map +1 -1
- package/dist/config/define-config.d.ts +38 -2
- package/dist/config/define-config.d.ts.map +1 -1
- package/dist/config/define-config.js.map +1 -1
- package/dist/config/resolve-config.d.ts +15 -2
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/config/resolve-config.js +6 -0
- package/dist/config/resolve-config.js.map +1 -1
- package/dist/config/story-options.d.ts +32 -4
- package/dist/config/story-options.d.ts.map +1 -1
- package/dist/config/story-options.js +38 -7
- package/dist/config/story-options.js.map +1 -1
- package/dist/config/unrunnable-regexp.d.ts +22 -0
- package/dist/config/unrunnable-regexp.d.ts.map +1 -0
- package/dist/config/unrunnable-regexp.js +25 -0
- package/dist/config/unrunnable-regexp.js.map +1 -0
- package/dist/config/validate-config.d.ts.map +1 -1
- package/dist/config/validate-config.js +6 -21
- package/dist/config/validate-config.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/init/find-storybooks.d.ts +5 -0
- package/dist/init/find-storybooks.d.ts.map +1 -1
- package/dist/init/find-storybooks.js +8 -1
- package/dist/init/find-storybooks.js.map +1 -1
- package/dist/init/ignored-skill.d.ts +50 -0
- package/dist/init/ignored-skill.d.ts.map +1 -0
- package/dist/init/ignored-skill.js +61 -0
- package/dist/init/ignored-skill.js.map +1 -0
- package/dist/init/install.d.ts +24 -9
- package/dist/init/install.d.ts.map +1 -1
- package/dist/init/install.js +66 -26
- package/dist/init/install.js.map +1 -1
- package/dist/init/package-manager.d.ts +6 -0
- package/dist/init/package-manager.d.ts.map +1 -1
- package/dist/init/package-manager.js +4 -0
- package/dist/init/package-manager.js.map +1 -1
- package/dist/init/run-init.d.ts +17 -4
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +31 -11
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/workspace.d.ts +2 -0
- package/dist/init/workspace.d.ts.map +1 -1
- package/dist/init/workspace.js +2 -0
- package/dist/init/workspace.js.map +1 -1
- package/dist/page-errors/judge-page-errors.d.ts +50 -0
- package/dist/page-errors/judge-page-errors.d.ts.map +1 -0
- package/dist/page-errors/judge-page-errors.js +39 -0
- package/dist/page-errors/judge-page-errors.js.map +1 -0
- package/dist/page-errors/page-error-policy.d.ts +36 -0
- package/dist/page-errors/page-error-policy.d.ts.map +1 -0
- package/dist/page-errors/page-error-policy.js +15 -0
- package/dist/page-errors/page-error-policy.js.map +1 -0
- package/dist/real-network-requests/judge-real-requests.d.ts +26 -0
- package/dist/real-network-requests/judge-real-requests.d.ts.map +1 -0
- package/dist/real-network-requests/judge-real-requests.js +17 -0
- package/dist/real-network-requests/judge-real-requests.js.map +1 -0
- package/dist/real-network-requests/real-request-policy.d.ts +29 -0
- package/dist/real-network-requests/real-request-policy.d.ts.map +1 -0
- package/dist/real-network-requests/real-request-policy.js +10 -0
- package/dist/real-network-requests/real-request-policy.js.map +1 -0
- package/dist/real-network-requests/silenced-hosts.d.ts +9 -0
- package/dist/real-network-requests/silenced-hosts.d.ts.map +1 -0
- package/dist/real-network-requests/silenced-hosts.js +28 -0
- package/dist/real-network-requests/silenced-hosts.js.map +1 -0
- package/dist/report/report-document.d.ts +154 -9
- package/dist/report/report-document.d.ts.map +1 -1
- package/dist/report/report-document.js +1 -1
- package/dist/report/report-document.js.map +1 -1
- package/dist/report/report-folder.d.ts +7 -3
- package/dist/report/report-folder.d.ts.map +1 -1
- package/dist/report/report-folder.js +5 -5
- package/dist/report/report-folder.js.map +1 -1
- package/dist/reporter/end-block.d.ts +32 -3
- package/dist/reporter/end-block.d.ts.map +1 -1
- package/dist/reporter/end-block.js +55 -3
- package/dist/reporter/end-block.js.map +1 -1
- package/dist/reporter/page-errors-block.d.ts +52 -0
- package/dist/reporter/page-errors-block.d.ts.map +1 -0
- package/dist/reporter/page-errors-block.js +98 -0
- package/dist/reporter/page-errors-block.js.map +1 -0
- package/dist/reporter/real-requests-block.d.ts +33 -0
- package/dist/reporter/real-requests-block.d.ts.map +1 -0
- package/dist/reporter/real-requests-block.js +53 -0
- package/dist/reporter/real-requests-block.js.map +1 -0
- package/dist/step-summary/step-summary.d.ts +27 -7
- package/dist/step-summary/step-summary.d.ts.map +1 -1
- package/dist/step-summary/step-summary.js +107 -15
- package/dist/step-summary/step-summary.js.map +1 -1
- package/dist/storybook/options-encoding.d.ts +18 -5
- package/dist/storybook/options-encoding.d.ts.map +1 -1
- package/dist/storybook/options-encoding.js +12 -4
- package/dist/storybook/options-encoding.js.map +1 -1
- package/dist/storybook/options-read.d.ts +3 -2
- package/dist/storybook/options-read.d.ts.map +1 -1
- package/dist/storybook/options-read.js +17 -0
- package/dist/storybook/options-read.js.map +1 -1
- package/dist/storybook/read-stories.d.ts +15 -0
- package/dist/storybook/read-stories.d.ts.map +1 -1
- package/dist/storybook/read-stories.js +60 -14
- package/dist/storybook/read-stories.js.map +1 -1
- package/package.json +2 -1
- package/skill/SKILL.md +25 -7
|
@@ -117,11 +117,17 @@ const headlessSwitches = [
|
|
|
117
117
|
];
|
|
118
118
|
/**
|
|
119
119
|
* Builds the arguments Chromium is launched with: Playwright's switches for a headless launch, `--no-sandbox` when the
|
|
120
|
-
* sandbox is off, `--disable-skia-runtime-opts`, the proxy when one is given, then the
|
|
120
|
+
* sandbox is off, `--disable-skia-runtime-opts` and `--disable-partial-raster`, the proxy when one is given, then the
|
|
121
|
+
* profile folder and the CDP pipe.
|
|
121
122
|
*
|
|
122
123
|
* `--disable-skia-runtime-opts` is visual-check's own: it turns off Skia's code paths picked by CPU at run time, so
|
|
123
124
|
* gradients come out the same under Rosetta as on real amd64 runners.
|
|
124
125
|
*
|
|
126
|
+
* `--disable-partial-raster` is visual-check's own too: a tile the page changed is rastered whole, not only inside the
|
|
127
|
+
* change's rectangle. Chromium's rectangle for text leaves out the fringe of LCD antialiasing, so with partial raster a
|
|
128
|
+
* text that gets shorter can leave a pixel of the old text's fringe behind, and now and then Chromium rasters the tile
|
|
129
|
+
* whole anyway, so the same story gave one capture or the other.
|
|
130
|
+
*
|
|
125
131
|
* The proxy is `--proxy-server` with `--proxy-bypass-list=<-loopback>`, which removes Chromium's implicit bypass of
|
|
126
132
|
* loopback addresses, so a Storybook on `localhost` is reached through the proxy too.
|
|
127
133
|
*/
|
|
@@ -131,6 +137,7 @@ export function launchArguments(options) {
|
|
|
131
137
|
...headlessSwitches,
|
|
132
138
|
...(options.sandbox ? [] : ['--no-sandbox']),
|
|
133
139
|
'--disable-skia-runtime-opts',
|
|
140
|
+
'--disable-partial-raster',
|
|
134
141
|
...(options.proxyServer === undefined
|
|
135
142
|
? []
|
|
136
143
|
: [`--proxy-server=${options.proxyServer}`, '--proxy-bypass-list=<-loopback>']),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch-arguments.js","sourceRoot":"","sources":["../../../../src/capture/driver/cdp/launch-arguments.ts"],"names":[],"mappings":"AAAA,wHAAwH;AACxH,qHAAqH;AACrH,4FAA4F;AAC5F,wHAAwH;AACxH,gHAAgH;AAChH,iHAAiH;AACjH,8DAA8D;AAE9D;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,uDAAuD;IACvD,uCAAuC;IACvC,8BAA8B;IAC9B,0EAA0E;IAC1E,uDAAuD;IACvD,eAAe;IACf,kCAAkC;IAClC,uEAAuE;IACvE,aAAa;IACb,6DAA6D;IAC7D,aAAa;IACb,yGAAyG;IACzG,cAAc;IACd,wFAAwF;IACxF,+BAA+B;IAC/B,sGAAsG;IACtG,uDAAuD;IACvD,qCAAqC;IACrC,6GAA6G;IAC7G,yBAAyB;IACzB,+GAA+G;IAC/G,mGAAmG;IACnG,mBAAmB;IACnB,4BAA4B;IAC5B,YAAY;IACZ,oBAAoB;IACpB,0FAA0F;IAC1F,sBAAsB;IACtB,4CAA4C;CAC7C,CAAA;AAED;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,kFAAkF;IAClF,yBAAyB;IACzB,mEAAmE;IACnE,iGAAiG;IACjG,oCAAoC;CACrC,CAAA;AAED;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,8EAA8E;IAC9E,wFAAwF;IACxF,8BAA8B;IAC9B,iCAAiC;IACjC,uCAAuC;IACvC,0CAA0C;IAC1C,iGAAiG;IACjG,8BAA8B;IAC9B,oBAAoB;IACpB,sDAAsD;IACtD,wCAAwC;IACxC,4BAA4B;IAC5B,4BAA4B;IAC5B,wBAAwB;IACxB,yBAAyB;IACzB,2BAA2B;IAC3B,uBAAuB;IACvB,sBAAsB;IACtB,sBAAsB,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;IAClD,qBAAqB,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;IAChD,0BAA0B;IAC1B,wBAAwB;IACxB,mCAAmC;IACnC,0BAA0B;IAC1B,4BAA4B;IAC5B,kCAAkC;IAClC,kDAAkD;IAClD,6BAA6B;IAC7B,4BAA4B;IAC5B,0BAA0B;IAC1B,gBAAgB;IAChB,wBAAwB;IACxB,qBAAqB;IACrB,oEAAoE;IACpE,sBAAsB;IACtB,oEAAoE;IACpE,uCAAuC;IACvC,uCAAuC;IACvC,+CAA+C;IAC/C,8DAA8D;IAC9D,6BAA6B;IAC7B,yEAAyE;IACzE,mCAAmC;IACnC,sEAAsE;IACtE,uDAAuD;IACvD,0BAA0B;IAC1B,6EAA6E;IAC7E,oBAAoB;IACpB,qEAAqE;IACrE,gBAAgB;IAChB,oHAAoH;IACpH,qBAAqB;CACtB,CAAA;AAED;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,YAAY;IACZ,mBAAmB;IACnB,cAAc;IACd,wGAAwG;CACzG,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"launch-arguments.js","sourceRoot":"","sources":["../../../../src/capture/driver/cdp/launch-arguments.ts"],"names":[],"mappings":"AAAA,wHAAwH;AACxH,qHAAqH;AACrH,4FAA4F;AAC5F,wHAAwH;AACxH,gHAAgH;AAChH,iHAAiH;AACjH,8DAA8D;AAE9D;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,uDAAuD;IACvD,uCAAuC;IACvC,8BAA8B;IAC9B,0EAA0E;IAC1E,uDAAuD;IACvD,eAAe;IACf,kCAAkC;IAClC,uE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D,0BAA0B;IAC1B,6EAA6E;IAC7E,oBAAoB;IACpB,qEAAqE;IACrE,gBAAgB;IAChB,oHAAoH;IACpH,qBAAqB;CACtB,CAAA;AAED;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,YAAY;IACZ,mBAAmB;IACnB,cAAc;IACd,wGAAwG;CACzG,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAAC,OAAuE;IACrG,OAAO;QACL,GAAG,gBAAgB;QACnB,GAAG,gBAAgB;QACnB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC5C,6BAA6B;QAC7B,0BAA0B;QAC1B,GAAG,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS;YACnC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,kBAAkB,OAAO,CAAC,WAAW,EAAE,EAAE,iCAAiC,CAAC,CAAC;QACjF,mBAAmB,OAAO,CAAC,UAAU,EAAE;QACvC,yBAAyB;QACzB,qBAAqB;KACtB,CAAA;AACH,CAAC"}
|
|
@@ -110,9 +110,10 @@ export interface PageSetup {
|
|
|
110
110
|
*/
|
|
111
111
|
initScript: string;
|
|
112
112
|
/**
|
|
113
|
-
* Whether the page watches the real network requests it makes, for `requestHosts`.
|
|
114
|
-
*
|
|
115
|
-
*
|
|
113
|
+
* Whether the page watches the real network requests it makes, for `requestHosts`. `update` turns it on for every
|
|
114
|
+
* page, and `test` only for the snapshots that check real network requests, since watching has a cost: the browser
|
|
115
|
+
* reports every request, and the page attaches to the service workers of its browser context. A page that doesn't
|
|
116
|
+
* watch turns on no request reporting and attaches to no service worker.
|
|
116
117
|
*/
|
|
117
118
|
watchRequests: boolean;
|
|
118
119
|
}
|
|
@@ -214,6 +215,60 @@ export interface ConsoleMessage {
|
|
|
214
215
|
* @public
|
|
215
216
|
*/
|
|
216
217
|
export declare function readConsoleMessage(payload: string): ConsoleMessage | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* How many page errors a page keeps: the first ones.
|
|
220
|
+
*/
|
|
221
|
+
export declare const keptPageErrors = 50;
|
|
222
|
+
/**
|
|
223
|
+
* A page error: a `console.error`, an uncaught error or an unhandled rejection a page raised, or a load of a file from
|
|
224
|
+
* its document's origin that failed at the network level or got an HTTP error status. See GLOSSARY.md.
|
|
225
|
+
*
|
|
226
|
+
* @public
|
|
227
|
+
*/
|
|
228
|
+
export interface PageError {
|
|
229
|
+
/**
|
|
230
|
+
* `console.error`, an uncaught error (`error`), an unhandled rejection (`unhandledrejection`), or a load of a file
|
|
231
|
+
* (`load`).
|
|
232
|
+
*/
|
|
233
|
+
kind: 'console.error' | 'error' | 'unhandledrejection' | 'load';
|
|
234
|
+
/**
|
|
235
|
+
* The message, up to 500 characters, or a load's full URL. A `console.error`'s arguments are joined by spaces, and an
|
|
236
|
+
* error, thrown, rejected or logged, is described by its stack, whose first line is `Name: message`. Expected page
|
|
237
|
+
* errors are matched against it.
|
|
238
|
+
*/
|
|
239
|
+
text: string;
|
|
240
|
+
/**
|
|
241
|
+
* A load's network error, such as `net::ERR_EMPTY_RESPONSE`, or its HTTP status, such as `HTTP 404`. Only on a load.
|
|
242
|
+
*/
|
|
243
|
+
loadError?: string;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Gives the page error a console message or error is, the same kind and text, or undefined for a message that's none:
|
|
247
|
+
* a `console.debug`, `console.info`, `console.log` or `console.warn`.
|
|
248
|
+
*/
|
|
249
|
+
export declare function pageErrorOf(message: ConsoleMessage): PageError | undefined;
|
|
250
|
+
/**
|
|
251
|
+
* Gives the page errors of every list, each once, in the order first seen: a page error the same as one before it, in
|
|
252
|
+
* its kind, text and load error, is left out.
|
|
253
|
+
*
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
export declare function eachPageErrorOnce(...lists: readonly (readonly PageError[])[]): PageError[];
|
|
257
|
+
/**
|
|
258
|
+
* A load of a file that failed at the network level on a page.
|
|
259
|
+
*
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
262
|
+
export interface FailedLoad {
|
|
263
|
+
/**
|
|
264
|
+
* The file's full URL.
|
|
265
|
+
*/
|
|
266
|
+
url: string;
|
|
267
|
+
/**
|
|
268
|
+
* The browser's network error, such as `net::ERR_EMPTY_RESPONSE`.
|
|
269
|
+
*/
|
|
270
|
+
error: string;
|
|
271
|
+
}
|
|
217
272
|
/**
|
|
218
273
|
* A page in a browser context of its own, set up once, that stories are loaded and captured in. It emulates
|
|
219
274
|
* `prefers-reduced-motion: no-preference` and keeps focus as if its window were focused.
|
|
@@ -253,12 +308,22 @@ export declare function readConsoleMessage(payload: string): ConsoleMessage | un
|
|
|
253
308
|
* MSW's mocks are, doesn't count, and fonts, stylesheets, images and scripts never do. A page that doesn't watch turns
|
|
254
309
|
* on no request reporting and attaches to no service worker, so it costs nothing.
|
|
255
310
|
*
|
|
311
|
+
* Every page keeps its page errors, which `pageErrors` gives, and the loads of its document's origin that failed at the
|
|
312
|
+
* network level, which `failedLoads` gives. Both read loads from the browser's log, which reports only problems, so
|
|
313
|
+
* watching it costs a page nothing, unlike watching requests: no page turns on request reporting for them. The log
|
|
314
|
+
* reports an error status a service worker's own response gives just as it reports a server's, so an error response
|
|
315
|
+
* MSW mocks is a page error. Probed on 2026-11-28 with Chromium 157.0.8103.78's headless shell: a 404 or 500 response
|
|
316
|
+
* a worker built, to a `fetch` and to an `<img>`, is logged once, at the `error` level, with the full URL, as
|
|
317
|
+
* `Failed to load resource: the server responded with a status of 404 ()`, with no status text where a server's
|
|
318
|
+
* response gives one, such as `(Not Found)`.
|
|
319
|
+
*
|
|
256
320
|
* @public
|
|
257
321
|
*/
|
|
258
322
|
export interface Page {
|
|
259
323
|
/**
|
|
260
324
|
* Sets the size the page lays out and renders at, and turns touch and mobile emulation on or off as the viewport
|
|
261
|
-
* says.
|
|
325
|
+
* says. Setting a viewport again on a loaded page, with the same touch, keeps the page's hover and pointer media.
|
|
326
|
+
* Fails with a `PageTimeoutError` when the browser doesn't answer within the driver's own fixed limit.
|
|
262
327
|
*/
|
|
263
328
|
setViewport: (viewport: PageViewport) => Promise<void>;
|
|
264
329
|
/**
|
|
@@ -324,6 +389,25 @@ export interface Page {
|
|
|
324
389
|
* reads them once a call failed, before it closes the page. Never fails.
|
|
325
390
|
*/
|
|
326
391
|
consoleMessages: () => ConsoleMessage[];
|
|
392
|
+
/**
|
|
393
|
+
* Gives the loads that failed at the network level since the last `goto` started, such as a dropped or refused
|
|
394
|
+
* connection, each of the origin of the document the main frame showed when it failed: that `goto`'s, or one the page
|
|
395
|
+
* went to since. The first 10 of them, each URL once, in order: a failure of another origin, such as a CDN's, is never
|
|
396
|
+
* kept, so it never crowds out one of the story's own. A cancellation and an HTTP error status don't count. They are
|
|
397
|
+
* kept after the page can no longer be used too, so a caller reads them once a call failed. Never fails.
|
|
398
|
+
*/
|
|
399
|
+
failedLoads: () => FailedLoad[];
|
|
400
|
+
/**
|
|
401
|
+
* Gives the first 50 page errors the page raised since the last `goto` started, or since the page opened before any,
|
|
402
|
+
* each once, in order: the same kind, text and load error count once. The `console.error`, `error` and
|
|
403
|
+
* `unhandledrejection` messages count as `consoleMessages` takes them in, from the main frame's main world, but in a
|
|
404
|
+
* list of their own, so no number of other console messages ever crowds one out. A load counts when it failed at
|
|
405
|
+
* the network level, a cancellation (`net::ERR_ABORTED`) aside, or got an HTTP status of 400 or over, a response a
|
|
406
|
+
* service worker built included, and was of the origin of the document the main frame showed then, as for
|
|
407
|
+
* `failedLoads`: a load of another origin never counts. They are kept after the page can no longer be used too, so a
|
|
408
|
+
* caller reads them once a call failed, before it closes the page. Never fails.
|
|
409
|
+
*/
|
|
410
|
+
pageErrors: () => PageError[];
|
|
327
411
|
/**
|
|
328
412
|
* Closes the page and its browser context. Every call in flight and every later call fails. Calling it again returns
|
|
329
413
|
* the same promise.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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
|
|
62
62
|
return { kind, text: text.slice(0, keptConsoleMessageCharacters) };
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* How many page errors a page keeps: the first ones.
|
|
66
|
+
*/
|
|
67
|
+
export const keptPageErrors = 50;
|
|
68
|
+
/**
|
|
69
|
+
* Gives the page error a console message or error is, the same kind and text, or undefined for a message that's none:
|
|
70
|
+
* a `console.debug`, `console.info`, `console.log` or `console.warn`.
|
|
71
|
+
*/
|
|
72
|
+
export function pageErrorOf(message) {
|
|
73
|
+
const { kind, text } = message;
|
|
74
|
+
return kind === 'console.error' || kind === 'error' || kind === 'unhandledrejection' ? { kind, text } : undefined;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Says whether two page errors are the same one: the same kind, text and load error.
|
|
78
|
+
*/
|
|
79
|
+
function isSamePageError(one, other) {
|
|
80
|
+
return one.kind === other.kind && one.text === other.text && one.loadError === other.loadError;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Gives the page errors of every list, each once, in the order first seen: a page error the same as one before it, in
|
|
84
|
+
* its kind, text and load error, is left out.
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export function eachPageErrorOnce(...lists) {
|
|
89
|
+
const once = [];
|
|
90
|
+
for (const error of lists.flat()) {
|
|
91
|
+
if (!once.some((kept) => isSamePageError(kept, error))) {
|
|
92
|
+
once.push(error);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return once;
|
|
96
|
+
}
|
|
64
97
|
/**
|
|
65
98
|
* Says how the browser's process ended, and when: that it couldn't start and why, or its exit code, or the signal that
|
|
66
99
|
* ended it, such as "The browser exited with code 1 while in use."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../../src/capture/driver/driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,QAAQ,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+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AAK,CAAC,0BAA0B,GAAG,KAAK,MAAM,EAAE,CAAC,CAAA;QACjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C;;OAEG;IACM,IAAI,GAAG,wBAAwB,CAAA;IAExC;;OAEG;IACM,GAAG,CAAQ;IAEpB;;OAEG;IACH,YAAY,GAAW,EAAE,OAAe;QACtC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C;;OAEG;IACM,IAAI,GAAG,oBAAoB,CAAA;IAEpC;;;OAGG;IACM,MAAM,CAAmB;IAElC;;;OAGG;IACM,MAAM,CAAS;IAExB;;;OAGG;IACM,cAAc,CAAS;IAEhC;;;OAGG;IACH,YAAY,OAAe,EAAE,MAAyB,EAAE,OAAsD;QAC5G,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,KAAK,CAAA;IACvD,CAAC;CACF"}
|
|
@@ -71,11 +71,9 @@
|
|
|
71
71
|
* 6. Lets two more frames pass when it changed anything, as a change made just before capture can still be rastering
|
|
72
72
|
* on a busy machine.
|
|
73
73
|
*
|
|
74
|
-
* A frame is
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* scroll-driven and view-driven ones, and those with no timeline, are left alone, and so are those the page paused
|
|
78
|
-
* itself, Storybook 11's aside. Only `finish()` calls made in the top document are noted: a frame's own calls aren't,
|
|
74
|
+
* A frame is as `framesFunction` says. Only animations on their document's timeline are touched, a frame's own for one
|
|
75
|
+
* in a frame: scroll-driven and view-driven ones, and those with no timeline, are left alone, and so are those the page
|
|
76
|
+
* paused itself, Storybook 11's aside. Only `finish()` calls made in the top document are noted: a frame's own calls aren't,
|
|
79
77
|
* though the end state's calls on a frame's animations still wait two quiet checks a frame apart.
|
|
80
78
|
*
|
|
81
79
|
* Left to the project, through a mask or a `wait` hook: SVG in `<img>`, SVG with SMIL animation behind a URL whose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-state.d.ts","sourceRoot":"","sources":["../../src/capture/end-state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"end-state.d.ts","sourceRoot":"","sources":["../../src/capture/end-state.ts"],"names":[],"mappings":"AAsCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,eAAO,MAAM,gBAAgB,QAkoB3B,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB;IACE;;OAEG;IACH,OAAO,EAAE,SAAS,CAAA;IAClB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAA;CACjB,GACD;IACE;;OAEG;IACH,OAAO,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,IAAI,EAAE,YAAY,GAAG,OAAO,CAAA;CAC7B,GACD;IACE;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAEL;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAgBrD"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import { framesFunction, taskFrameMs } from './frames.js';
|
|
1
2
|
import { pageRootsFunction } from './page-roots.js';
|
|
2
3
|
/**
|
|
3
4
|
* How many rounds of finishing animations the end state runs at most.
|
|
4
5
|
*/
|
|
5
6
|
const maxRounds = 20;
|
|
6
|
-
/**
|
|
7
|
-
* How long each of a frame's two tasks lasts in a page without `requestAnimationFrame`, in ms.
|
|
8
|
-
*/
|
|
9
|
-
const taskFrameMs = 16;
|
|
10
7
|
/**
|
|
11
8
|
* The SMIL animation elements an SVG holds.
|
|
12
9
|
*/
|
|
@@ -104,11 +101,9 @@ const cssEscapePattern = String.raw `/\\(?:([0-9a-fA-F]{1,6}) ?|([^]))/g`;
|
|
|
104
101
|
* 6. Lets two more frames pass when it changed anything, as a change made just before capture can still be rastering
|
|
105
102
|
* on a busy machine.
|
|
106
103
|
*
|
|
107
|
-
* A frame is
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* scroll-driven and view-driven ones, and those with no timeline, are left alone, and so are those the page paused
|
|
111
|
-
* itself, Storybook 11's aside. Only `finish()` calls made in the top document are noted: a frame's own calls aren't,
|
|
104
|
+
* A frame is as `framesFunction` says. Only animations on their document's timeline are touched, a frame's own for one
|
|
105
|
+
* in a frame: scroll-driven and view-driven ones, and those with no timeline, are left alone, and so are those the page
|
|
106
|
+
* paused itself, Storybook 11's aside. Only `finish()` calls made in the top document are noted: a frame's own calls aren't,
|
|
112
107
|
* though the end state's calls on a frame's animations still wait two quiet checks a frame apart.
|
|
113
108
|
*
|
|
114
109
|
* Left to the project, through a mask or a `wait` hook: SVG in `<img>`, SVG with SMIL animation behind a URL whose
|
|
@@ -674,47 +669,16 @@ export const endStateFunction = `(context) => {
|
|
|
674
669
|
]
|
|
675
670
|
}
|
|
676
671
|
|
|
677
|
-
//
|
|
678
|
-
// frame throws, it goes on with two tasks of 16 ms instead. A task that can't be scheduled ends the frame at once, so
|
|
679
|
-
// a frame never throws, in its callbacks either, and never stays pending.
|
|
672
|
+
// Letting frames pass, as framesFunction says.
|
|
680
673
|
|
|
681
|
-
const
|
|
682
|
-
new Promise((resolve) => {
|
|
683
|
-
const task = (callback, ms) => {
|
|
684
|
-
try {
|
|
685
|
-
setTimer(callback, ms)
|
|
686
|
-
} catch {
|
|
687
|
-
resolve()
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
const tasks = () => task(() => task(resolve, ${taskFrameMs}), ${taskFrameMs})
|
|
691
|
-
const animationFrame = (callback) => {
|
|
692
|
-
if (requestFrame === undefined) {
|
|
693
|
-
tasks()
|
|
694
|
-
return
|
|
695
|
-
}
|
|
696
|
-
try {
|
|
697
|
-
requestFrame(callback)
|
|
698
|
-
} catch {
|
|
699
|
-
tasks()
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
animationFrame(() => animationFrame(() => task(resolve, 0)))
|
|
703
|
-
})
|
|
674
|
+
const framesPassedBefore = (${framesFunction})({ setTimer, requestFrame })
|
|
704
675
|
|
|
705
676
|
return async (timeoutMs) => {
|
|
706
677
|
let timer
|
|
707
678
|
const deadline = new Promise((resolve) => {
|
|
708
679
|
timer = setTimer(() => resolve(timedOut), timeoutMs)
|
|
709
680
|
})
|
|
710
|
-
const framesPassed =
|
|
711
|
-
for (let passed = 0; passed < count; passed += 1) {
|
|
712
|
-
if ((await Promise.race([frame(), deadline])) === timedOut) {
|
|
713
|
-
return false
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
return true
|
|
717
|
-
}
|
|
681
|
+
const framesPassed = (count) => framesPassedBefore(count, deadline)
|
|
718
682
|
// Animations whose finish() threw, such as one with a playback rate of 0, aren't finished again: they're put on
|
|
719
683
|
// their first keyframe with the infinite ones.
|
|
720
684
|
const unfinishable = new Set()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-state.js","sourceRoot":"","sources":["../../src/capture/end-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"end-state.js","sourceRoot":"","sources":["../../src/capture/end-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD;;GAEG;AACH,MAAM,SAAS,GAAG,EAAE,CAAA;AAEpB;;GAEG;AACH,MAAM,YAAY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long each of a frame's two tasks lasts in a page without `requestAnimationFrame`, in ms.
|
|
3
|
+
*/
|
|
4
|
+
export declare const taskFrameMs = 16;
|
|
5
|
+
/**
|
|
6
|
+
* The source of a function, evaluated in the page as part of the page script, that gives `framesPassedBefore(count,
|
|
7
|
+
* deadline)`. It takes what the page script kept at document start: the browser's own `setTimer` and `requestFrame`
|
|
8
|
+
* (`undefined` in a page without `requestAnimationFrame`). `framesPassedBefore` lets `count` frames pass, one after
|
|
9
|
+
* the other, and resolves true, or false as soon as `deadline`, a promise, settles first.
|
|
10
|
+
*
|
|
11
|
+
* A frame is two `requestFrame` callbacks, then a task, so a rendering update runs and the page logic it queues, such as
|
|
12
|
+
* an `IntersectionObserver`'s callback, runs after it. In a page without `requestFrame`, or when asking for the first
|
|
13
|
+
* callback throws, it's two tasks of 16 ms, and when only asking for the second throws, it's one callback, then two
|
|
14
|
+
* tasks of 16 ms. A task that can't be scheduled ends the frame at once, so a frame never throws, in its callbacks
|
|
15
|
+
* either, and never stays pending.
|
|
16
|
+
*/
|
|
17
|
+
export declare const framesFunction = "(context) => {\n const { setTimer, requestFrame } = context\n const passed = Symbol('passed')\n\n const frame = () =>\n new Promise((resolve) => {\n const task = (callback, ms) => {\n try {\n setTimer(callback, ms)\n } catch {\n resolve()\n }\n }\n const tasks = () => task(() => task(resolve, 16), 16)\n const animationFrame = (callback) => {\n if (requestFrame === undefined) {\n tasks()\n return\n }\n try {\n requestFrame(callback)\n } catch {\n tasks()\n }\n }\n animationFrame(() => animationFrame(() => task(resolve, 0)))\n })\n\n return async (count, deadline) => {\n for (let frames = 0; frames < count; frames += 1) {\n if ((await Promise.race([frame().then(() => passed), deadline])) !== passed) {\n return false\n }\n }\n return true\n }\n}";
|
|
18
|
+
//# sourceMappingURL=frames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../src/capture/frames.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,s6BAoCzB,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long each of a frame's two tasks lasts in a page without `requestAnimationFrame`, in ms.
|
|
3
|
+
*/
|
|
4
|
+
export const taskFrameMs = 16;
|
|
5
|
+
/**
|
|
6
|
+
* The source of a function, evaluated in the page as part of the page script, that gives `framesPassedBefore(count,
|
|
7
|
+
* deadline)`. It takes what the page script kept at document start: the browser's own `setTimer` and `requestFrame`
|
|
8
|
+
* (`undefined` in a page without `requestAnimationFrame`). `framesPassedBefore` lets `count` frames pass, one after
|
|
9
|
+
* the other, and resolves true, or false as soon as `deadline`, a promise, settles first.
|
|
10
|
+
*
|
|
11
|
+
* A frame is two `requestFrame` callbacks, then a task, so a rendering update runs and the page logic it queues, such as
|
|
12
|
+
* an `IntersectionObserver`'s callback, runs after it. In a page without `requestFrame`, or when asking for the first
|
|
13
|
+
* callback throws, it's two tasks of 16 ms, and when only asking for the second throws, it's one callback, then two
|
|
14
|
+
* tasks of 16 ms. A task that can't be scheduled ends the frame at once, so a frame never throws, in its callbacks
|
|
15
|
+
* either, and never stays pending.
|
|
16
|
+
*/
|
|
17
|
+
export const framesFunction = `(context) => {
|
|
18
|
+
const { setTimer, requestFrame } = context
|
|
19
|
+
const passed = Symbol('passed')
|
|
20
|
+
|
|
21
|
+
const frame = () =>
|
|
22
|
+
new Promise((resolve) => {
|
|
23
|
+
const task = (callback, ms) => {
|
|
24
|
+
try {
|
|
25
|
+
setTimer(callback, ms)
|
|
26
|
+
} catch {
|
|
27
|
+
resolve()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const tasks = () => task(() => task(resolve, ${taskFrameMs}), ${taskFrameMs})
|
|
31
|
+
const animationFrame = (callback) => {
|
|
32
|
+
if (requestFrame === undefined) {
|
|
33
|
+
tasks()
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
requestFrame(callback)
|
|
38
|
+
} catch {
|
|
39
|
+
tasks()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
animationFrame(() => animationFrame(() => task(resolve, 0)))
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
return async (count, deadline) => {
|
|
46
|
+
for (let frames = 0; frames < count; frames += 1) {
|
|
47
|
+
if ((await Promise.race([frame().then(() => passed), deadline])) !== passed) {
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return true
|
|
52
|
+
}
|
|
53
|
+
}`;
|
|
54
|
+
//# sourceMappingURL=frames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../src/capture/frames.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAA;AAE7B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;qDAauB,WAAW,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;EAuB/E,CAAA"}
|
|
@@ -30,6 +30,10 @@ import { type CapturePrepRequest } from './prepare-capture.js';
|
|
|
30
30
|
* decoded again. Then it forces layout, so the fonts the layout needs start loading, and waits for
|
|
31
31
|
* `document.fonts.ready`. One time limit covers both. A page without an API it uses, such as `document.fonts`, has
|
|
32
32
|
* nothing to wait for there;
|
|
33
|
+
* - gives `letFramesPass`, which the frames expression calls once the viewport grew, and once it was set again after
|
|
34
|
+
* the wait hook, so the page reacts to the new size before anything goes on: an `IntersectionObserver`, a
|
|
35
|
+
* `ResizeObserver` or a `resize` listener calls back, and the render it causes is done. It lets the frames pass as
|
|
36
|
+
* `framesFunction` says, within a time limit;
|
|
33
37
|
* - gives `bringToEndState`, which the end state expression calls at capture. It brings every animation in the
|
|
34
38
|
* document and in every shadow root to its end state, then freezes their videos, SVGs, inline or as CSS images, and
|
|
35
39
|
* GIFs, then brings the animations that freezing them started to their end state too, as `endStateFunction` says,
|
|
@@ -43,7 +47,7 @@ import { type CapturePrepRequest } from './prepare-capture.js';
|
|
|
43
47
|
* `prepareCaptureFunction` says.
|
|
44
48
|
*
|
|
45
49
|
* It keeps the browser's own `setTimeout`, `clearTimeout` and `requestAnimationFrame`, so a story that fakes or
|
|
46
|
-
* replaces timers or frames doesn't stall the
|
|
50
|
+
* replaces timers or frames doesn't stall the waits, the end state or the remote content search, its own `fetch`, so a
|
|
47
51
|
* story that mocks it doesn't answer the end state's requests for SVG files, and its own `JSON.stringify`, so a page
|
|
48
52
|
* that replaces it can't change what is sent. It takes and hides the message function
|
|
49
53
|
* before anything else runs, so a failure anywhere still leaves the page's own scripts without it. The adapter's
|
|
@@ -98,6 +102,35 @@ export type AssetsReadiness = {
|
|
|
98
102
|
* rounded up to whole ms. Its value is the page's answer, which `readAssetsReadiness` reads.
|
|
99
103
|
*/
|
|
100
104
|
export declare function assetsReadyExpression(timeoutMs: number): string;
|
|
105
|
+
/**
|
|
106
|
+
* What letting frames pass found in the page.
|
|
107
|
+
*/
|
|
108
|
+
export type FramesPassed = {
|
|
109
|
+
/**
|
|
110
|
+
* The frames passed.
|
|
111
|
+
*/
|
|
112
|
+
outcome: 'passed';
|
|
113
|
+
} | {
|
|
114
|
+
/**
|
|
115
|
+
* The time limit passed first.
|
|
116
|
+
*/
|
|
117
|
+
outcome: 'timed-out';
|
|
118
|
+
} | {
|
|
119
|
+
/**
|
|
120
|
+
* The page script hadn't run in the page, so there was nothing to let the frames pass with.
|
|
121
|
+
*/
|
|
122
|
+
outcome: 'script-missing';
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Builds the expression that lets two frames pass in the page once the viewport grew, or was set again after the wait
|
|
126
|
+
* hook, so the page reacts to the new size, or gives up once `timeoutMs` passes, rounded up to whole ms. Its value is
|
|
127
|
+
* the page's answer, which `readFramesPassed` reads.
|
|
128
|
+
*/
|
|
129
|
+
export declare function framesAfterGrowthExpression(timeoutMs: number): string;
|
|
130
|
+
/**
|
|
131
|
+
* Reads the value the frames expression gave. Throws, quoting the value, when it's not an answer the page gives.
|
|
132
|
+
*/
|
|
133
|
+
export declare function readFramesPassed(value: unknown): FramesPassed;
|
|
101
134
|
/**
|
|
102
135
|
* Builds the expression that brings the page to its end state at capture, or gives up once `timeoutMs` passes, rounded
|
|
103
136
|
* up to whole ms. Its value is the page's answer, which `readEndState` reads.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-script.d.ts","sourceRoot":"","sources":["../../src/capture/page-script.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page-script.d.ts","sourceRoot":"","sources":["../../src/capture/page-script.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,sBAAsB,CAAA;AAQtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,cAAc,QA2SrB,CAAA;AAEN;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB;IACE;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;CACjB,GACD;IACE;;OAEG;IACH,OAAO,EAAE,WAAW,CAAA;IACpB;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAA;IACd;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,GACD;IACE;;OAEG;IACH,OAAO,EAAE,WAAW,CAAA;IACpB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB,GACD;IACE;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAEL;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAO/D;AAQD;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB;IACE;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAA;CAClB,GACD;IACE;;OAEG;IACH,OAAO,EAAE,WAAW,CAAA;CACrB,GACD;IACE;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAEL;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOrE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAQ7D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAS/F;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CA8BnE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { parkedByStorybookSource, storybookPageScript } from '../storybook/preview-script.js';
|
|
2
2
|
import { consoleMessageFunction, keptConsoleMessageCharacters, keptConsoleMessages } from './driver/driver.js';
|
|
3
3
|
import { endStateFunction } from './end-state.js';
|
|
4
|
+
import { framesFunction } from './frames.js';
|
|
4
5
|
import { prepareCaptureFunction } from './prepare-capture.js';
|
|
5
6
|
import { remoteContentFunction } from './remote-content.js';
|
|
6
7
|
/**
|
|
@@ -38,6 +39,10 @@ const stateGlobal = '__visualCheck';
|
|
|
38
39
|
* decoded again. Then it forces layout, so the fonts the layout needs start loading, and waits for
|
|
39
40
|
* `document.fonts.ready`. One time limit covers both. A page without an API it uses, such as `document.fonts`, has
|
|
40
41
|
* nothing to wait for there;
|
|
42
|
+
* - gives `letFramesPass`, which the frames expression calls once the viewport grew, and once it was set again after
|
|
43
|
+
* the wait hook, so the page reacts to the new size before anything goes on: an `IntersectionObserver`, a
|
|
44
|
+
* `ResizeObserver` or a `resize` listener calls back, and the render it causes is done. It lets the frames pass as
|
|
45
|
+
* `framesFunction` says, within a time limit;
|
|
41
46
|
* - gives `bringToEndState`, which the end state expression calls at capture. It brings every animation in the
|
|
42
47
|
* document and in every shadow root to its end state, then freezes their videos, SVGs, inline or as CSS images, and
|
|
43
48
|
* GIFs, then brings the animations that freezing them started to their end state too, as `endStateFunction` says,
|
|
@@ -51,7 +56,7 @@ const stateGlobal = '__visualCheck';
|
|
|
51
56
|
* `prepareCaptureFunction` says.
|
|
52
57
|
*
|
|
53
58
|
* It keeps the browser's own `setTimeout`, `clearTimeout` and `requestAnimationFrame`, so a story that fakes or
|
|
54
|
-
* replaces timers or frames doesn't stall the
|
|
59
|
+
* replaces timers or frames doesn't stall the waits, the end state or the remote content search, its own `fetch`, so a
|
|
55
60
|
* story that mocks it doesn't answer the end state's requests for SVG files, and its own `JSON.stringify`, so a page
|
|
56
61
|
* that replaces it can't change what is sent. It takes and hides the message function
|
|
57
62
|
* before anything else runs, so a failure anywhere still leaves the page's own scripts without it. The adapter's
|
|
@@ -292,6 +297,22 @@ ${storybookPageScript};
|
|
|
292
297
|
}
|
|
293
298
|
}
|
|
294
299
|
|
|
300
|
+
// Letting frames pass, so the page reacts to a viewport that grew or was set again.
|
|
301
|
+
|
|
302
|
+
const framesPassedBefore = (${framesFunction})({ setTimer, requestFrame })
|
|
303
|
+
|
|
304
|
+
const letFramesPass = async (count, timeoutMs) => {
|
|
305
|
+
let timer
|
|
306
|
+
const deadline = new Promise((resolve) => {
|
|
307
|
+
timer = setTimer(resolve, timeoutMs)
|
|
308
|
+
})
|
|
309
|
+
try {
|
|
310
|
+
return (await framesPassedBefore(count, deadline)) ? { outcome: 'passed' } : { outcome: 'timed-out' }
|
|
311
|
+
} finally {
|
|
312
|
+
clearTimer(timer)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
295
316
|
// The end state, brought about only at capture.
|
|
296
317
|
|
|
297
318
|
const bringToEndState = (${endStateFunction})({
|
|
@@ -322,7 +343,15 @@ ${storybookPageScript};
|
|
|
322
343
|
})
|
|
323
344
|
|
|
324
345
|
Object.defineProperty(globalThis, '${stateGlobal}', {
|
|
325
|
-
value: Object.freeze({
|
|
346
|
+
value: Object.freeze({
|
|
347
|
+
shadowRoots,
|
|
348
|
+
messages,
|
|
349
|
+
waitForAssets,
|
|
350
|
+
letFramesPass,
|
|
351
|
+
bringToEndState,
|
|
352
|
+
findRemoteContent,
|
|
353
|
+
prepareCapture,
|
|
354
|
+
}),
|
|
326
355
|
})
|
|
327
356
|
})()
|
|
328
357
|
})((() => {
|
|
@@ -345,6 +374,33 @@ export function assetsReadyExpression(timeoutMs) {
|
|
|
345
374
|
return state === undefined ? { outcome: 'script-missing' } : state.waitForAssets(${limit})
|
|
346
375
|
})()`;
|
|
347
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* How many frames pass once the viewport grew, or was set again after the wait hook: the first runs the rendering
|
|
379
|
+
* update that calls the page's observers back, the second paints what their render changed.
|
|
380
|
+
*/
|
|
381
|
+
const framesAfterGrowth = 2;
|
|
382
|
+
/**
|
|
383
|
+
* Builds the expression that lets two frames pass in the page once the viewport grew, or was set again after the wait
|
|
384
|
+
* hook, so the page reacts to the new size, or gives up once `timeoutMs` passes, rounded up to whole ms. Its value is
|
|
385
|
+
* the page's answer, which `readFramesPassed` reads.
|
|
386
|
+
*/
|
|
387
|
+
export function framesAfterGrowthExpression(timeoutMs) {
|
|
388
|
+
const limit = Math.max(0, Math.ceil(timeoutMs));
|
|
389
|
+
return `(async () => {
|
|
390
|
+
const state = globalThis.${stateGlobal}
|
|
391
|
+
return state === undefined ? { outcome: 'script-missing' } : state.letFramesPass(${framesAfterGrowth}, ${limit})
|
|
392
|
+
})()`;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Reads the value the frames expression gave. Throws, quoting the value, when it's not an answer the page gives.
|
|
396
|
+
*/
|
|
397
|
+
export function readFramesPassed(value) {
|
|
398
|
+
const answer = typeof value === 'object' && value !== null ? { ...value } : {};
|
|
399
|
+
if (answer.outcome === 'passed' || answer.outcome === 'timed-out' || answer.outcome === 'script-missing') {
|
|
400
|
+
return { outcome: answer.outcome };
|
|
401
|
+
}
|
|
402
|
+
throw new Error(`Letting frames pass in the page gave an answer visual-check doesn't know: ${JSON.stringify(value)}.`);
|
|
403
|
+
}
|
|
348
404
|
/**
|
|
349
405
|
* Builds the expression that brings the page to its end state at capture, or gives up once `timeoutMs` passes, rounded
|
|
350
406
|
* up to whole ms. Its value is the page's answer, which `readEndState` reads.
|