@visual-check/cli 0.1.2 → 0.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.
Files changed (215) hide show
  1. package/dist/addon-child/image-files.js +1 -1
  2. package/dist/addon-child/image-files.js.map +1 -1
  3. package/dist/agent-skill/skill-files.d.ts +4 -0
  4. package/dist/agent-skill/skill-files.d.ts.map +1 -1
  5. package/dist/agent-skill/skill-files.js +4 -0
  6. package/dist/agent-skill/skill-files.js.map +1 -1
  7. package/dist/baselines/baseline-error.d.ts +15 -2
  8. package/dist/baselines/baseline-error.d.ts.map +1 -1
  9. package/dist/baselines/baseline-error.js +32 -2
  10. package/dist/baselines/baseline-error.js.map +1 -1
  11. package/dist/capture/capture-session.d.ts +161 -30
  12. package/dist/capture/capture-session.d.ts.map +1 -1
  13. package/dist/capture/capture-session.js +291 -72
  14. package/dist/capture/capture-session.js.map +1 -1
  15. package/dist/capture/driver/cdp/cdp-page.d.ts.map +1 -1
  16. package/dist/capture/driver/cdp/cdp-page.js +120 -31
  17. package/dist/capture/driver/cdp/cdp-page.js.map +1 -1
  18. package/dist/capture/driver/cdp/failed-loads.d.ts +16 -0
  19. package/dist/capture/driver/cdp/failed-loads.d.ts.map +1 -0
  20. package/dist/capture/driver/cdp/failed-loads.js +71 -0
  21. package/dist/capture/driver/cdp/failed-loads.js.map +1 -0
  22. package/dist/capture/driver/cdp/launch-arguments.d.ts +7 -1
  23. package/dist/capture/driver/cdp/launch-arguments.d.ts.map +1 -1
  24. package/dist/capture/driver/cdp/launch-arguments.js +8 -1
  25. package/dist/capture/driver/cdp/launch-arguments.js.map +1 -1
  26. package/dist/capture/driver/driver.d.ts +88 -4
  27. package/dist/capture/driver/driver.d.ts.map +1 -1
  28. package/dist/capture/driver/driver.js +33 -0
  29. package/dist/capture/driver/driver.js.map +1 -1
  30. package/dist/capture/frames.d.ts +10 -0
  31. package/dist/capture/frames.d.ts.map +1 -1
  32. package/dist/capture/frames.js +67 -0
  33. package/dist/capture/frames.js.map +1 -1
  34. package/dist/capture/page-script.d.ts +19 -8
  35. package/dist/capture/page-script.d.ts.map +1 -1
  36. package/dist/capture/page-script.js +46 -12
  37. package/dist/capture/page-script.js.map +1 -1
  38. package/dist/capture/prepare-capture.d.ts +50 -3
  39. package/dist/capture/prepare-capture.d.ts.map +1 -1
  40. package/dist/capture/prepare-capture.js +157 -16
  41. package/dist/capture/prepare-capture.js.map +1 -1
  42. package/dist/commands/check-storybooks.d.ts +5 -4
  43. package/dist/commands/check-storybooks.d.ts.map +1 -1
  44. package/dist/commands/check-storybooks.js +11 -8
  45. package/dist/commands/check-storybooks.js.map +1 -1
  46. package/dist/commands/consistency-output.d.ts.map +1 -1
  47. package/dist/commands/consistency-output.js +3 -3
  48. package/dist/commands/consistency-output.js.map +1 -1
  49. package/dist/commands/failed-loads-hint.d.ts +7 -0
  50. package/dist/commands/failed-loads-hint.d.ts.map +1 -0
  51. package/dist/commands/failed-loads-hint.js +16 -0
  52. package/dist/commands/failed-loads-hint.js.map +1 -0
  53. package/dist/commands/local-update.d.ts +22 -0
  54. package/dist/commands/local-update.d.ts.map +1 -0
  55. package/dist/commands/local-update.js +39 -0
  56. package/dist/commands/local-update.js.map +1 -0
  57. package/dist/commands/network-warning.d.ts.map +1 -1
  58. package/dist/commands/network-warning.js +2 -18
  59. package/dist/commands/network-warning.js.map +1 -1
  60. package/dist/commands/plan-snapshots.d.ts +23 -8
  61. package/dist/commands/plan-snapshots.d.ts.map +1 -1
  62. package/dist/commands/plan-snapshots.js +15 -9
  63. package/dist/commands/plan-snapshots.js.map +1 -1
  64. package/dist/commands/report-entries.d.ts +5 -2
  65. package/dist/commands/report-entries.d.ts.map +1 -1
  66. package/dist/commands/report-entries.js +63 -15
  67. package/dist/commands/report-entries.js.map +1 -1
  68. package/dist/commands/run-browser.d.ts +5 -5
  69. package/dist/commands/run-browser.d.ts.map +1 -1
  70. package/dist/commands/run-browser.js +1 -0
  71. package/dist/commands/run-browser.js.map +1 -1
  72. package/dist/commands/run-cli.d.ts +16 -5
  73. package/dist/commands/run-cli.d.ts.map +1 -1
  74. package/dist/commands/run-cli.js +74 -54
  75. package/dist/commands/run-cli.js.map +1 -1
  76. package/dist/commands/run-report.d.ts +3 -3
  77. package/dist/commands/run-report.d.ts.map +1 -1
  78. package/dist/commands/run-report.js +4 -2
  79. package/dist/commands/run-report.js.map +1 -1
  80. package/dist/commands/run-snapshots.d.ts +7 -4
  81. package/dist/commands/run-snapshots.d.ts.map +1 -1
  82. package/dist/commands/run-snapshots.js +49 -17
  83. package/dist/commands/run-snapshots.js.map +1 -1
  84. package/dist/commands/snapshot-result.d.ts +66 -9
  85. package/dist/commands/snapshot-result.d.ts.map +1 -1
  86. package/dist/commands/snapshot-result.js +46 -6
  87. package/dist/commands/snapshot-result.js.map +1 -1
  88. package/dist/commands/stop-message.d.ts.map +1 -1
  89. package/dist/commands/stop-message.js +6 -1
  90. package/dist/commands/stop-message.js.map +1 -1
  91. package/dist/commands/stopped-run.d.ts +10 -5
  92. package/dist/commands/stopped-run.d.ts.map +1 -1
  93. package/dist/commands/stopped-run.js +35 -22
  94. package/dist/commands/stopped-run.js.map +1 -1
  95. package/dist/commands/take-snapshot.d.ts +9 -6
  96. package/dist/commands/take-snapshot.d.ts.map +1 -1
  97. package/dist/commands/take-snapshot.js +16 -7
  98. package/dist/commands/take-snapshot.js.map +1 -1
  99. package/dist/commands/test-snapshot.d.ts +2 -2
  100. package/dist/commands/test-snapshot.d.ts.map +1 -1
  101. package/dist/commands/test-snapshot.js.map +1 -1
  102. package/dist/commands/update-baselines.d.ts.map +1 -1
  103. package/dist/commands/update-baselines.js +3 -2
  104. package/dist/commands/update-baselines.js.map +1 -1
  105. package/dist/commands/update-snapshot.d.ts +22 -4
  106. package/dist/commands/update-snapshot.d.ts.map +1 -1
  107. package/dist/commands/update-snapshot.js +79 -18
  108. package/dist/commands/update-snapshot.js.map +1 -1
  109. package/dist/config/checks.d.ts +26 -0
  110. package/dist/config/checks.d.ts.map +1 -1
  111. package/dist/config/checks.js +68 -6
  112. package/dist/config/checks.js.map +1 -1
  113. package/dist/config/define-config.d.ts +38 -2
  114. package/dist/config/define-config.d.ts.map +1 -1
  115. package/dist/config/define-config.js.map +1 -1
  116. package/dist/config/resolve-config.d.ts +15 -2
  117. package/dist/config/resolve-config.d.ts.map +1 -1
  118. package/dist/config/resolve-config.js +6 -0
  119. package/dist/config/resolve-config.js.map +1 -1
  120. package/dist/config/story-options.d.ts +32 -4
  121. package/dist/config/story-options.d.ts.map +1 -1
  122. package/dist/config/story-options.js +38 -7
  123. package/dist/config/story-options.js.map +1 -1
  124. package/dist/config/unrunnable-regexp.d.ts +22 -0
  125. package/dist/config/unrunnable-regexp.d.ts.map +1 -0
  126. package/dist/config/unrunnable-regexp.js +25 -0
  127. package/dist/config/unrunnable-regexp.js.map +1 -0
  128. package/dist/config/validate-config.d.ts.map +1 -1
  129. package/dist/config/validate-config.js +6 -21
  130. package/dist/config/validate-config.js.map +1 -1
  131. package/dist/index.d.ts +3 -3
  132. package/dist/index.d.ts.map +1 -1
  133. package/dist/index.js.map +1 -1
  134. package/dist/init/find-storybooks.d.ts +5 -0
  135. package/dist/init/find-storybooks.d.ts.map +1 -1
  136. package/dist/init/find-storybooks.js +8 -1
  137. package/dist/init/find-storybooks.js.map +1 -1
  138. package/dist/init/ignored-skill.d.ts +50 -0
  139. package/dist/init/ignored-skill.d.ts.map +1 -0
  140. package/dist/init/ignored-skill.js +61 -0
  141. package/dist/init/ignored-skill.js.map +1 -0
  142. package/dist/init/install.d.ts +24 -9
  143. package/dist/init/install.d.ts.map +1 -1
  144. package/dist/init/install.js +66 -26
  145. package/dist/init/install.js.map +1 -1
  146. package/dist/init/package-manager.d.ts +6 -0
  147. package/dist/init/package-manager.d.ts.map +1 -1
  148. package/dist/init/package-manager.js +4 -0
  149. package/dist/init/package-manager.js.map +1 -1
  150. package/dist/init/run-init.d.ts +17 -4
  151. package/dist/init/run-init.d.ts.map +1 -1
  152. package/dist/init/run-init.js +31 -11
  153. package/dist/init/run-init.js.map +1 -1
  154. package/dist/init/workspace.d.ts +2 -0
  155. package/dist/init/workspace.d.ts.map +1 -1
  156. package/dist/init/workspace.js +2 -0
  157. package/dist/init/workspace.js.map +1 -1
  158. package/dist/page-errors/judge-page-errors.d.ts +50 -0
  159. package/dist/page-errors/judge-page-errors.d.ts.map +1 -0
  160. package/dist/page-errors/judge-page-errors.js +39 -0
  161. package/dist/page-errors/judge-page-errors.js.map +1 -0
  162. package/dist/page-errors/page-error-policy.d.ts +36 -0
  163. package/dist/page-errors/page-error-policy.d.ts.map +1 -0
  164. package/dist/page-errors/page-error-policy.js +15 -0
  165. package/dist/page-errors/page-error-policy.js.map +1 -0
  166. package/dist/real-network-requests/judge-real-requests.d.ts +26 -0
  167. package/dist/real-network-requests/judge-real-requests.d.ts.map +1 -0
  168. package/dist/real-network-requests/judge-real-requests.js +17 -0
  169. package/dist/real-network-requests/judge-real-requests.js.map +1 -0
  170. package/dist/real-network-requests/real-request-policy.d.ts +29 -0
  171. package/dist/real-network-requests/real-request-policy.d.ts.map +1 -0
  172. package/dist/real-network-requests/real-request-policy.js +10 -0
  173. package/dist/real-network-requests/real-request-policy.js.map +1 -0
  174. package/dist/real-network-requests/silenced-hosts.d.ts +9 -0
  175. package/dist/real-network-requests/silenced-hosts.d.ts.map +1 -0
  176. package/dist/real-network-requests/silenced-hosts.js +28 -0
  177. package/dist/real-network-requests/silenced-hosts.js.map +1 -0
  178. package/dist/report/report-document.d.ts +154 -9
  179. package/dist/report/report-document.d.ts.map +1 -1
  180. package/dist/report/report-document.js +1 -1
  181. package/dist/report/report-document.js.map +1 -1
  182. package/dist/report/report-folder.d.ts +7 -3
  183. package/dist/report/report-folder.d.ts.map +1 -1
  184. package/dist/report/report-folder.js +5 -5
  185. package/dist/report/report-folder.js.map +1 -1
  186. package/dist/reporter/end-block.d.ts +32 -3
  187. package/dist/reporter/end-block.d.ts.map +1 -1
  188. package/dist/reporter/end-block.js +55 -3
  189. package/dist/reporter/end-block.js.map +1 -1
  190. package/dist/reporter/page-errors-block.d.ts +52 -0
  191. package/dist/reporter/page-errors-block.d.ts.map +1 -0
  192. package/dist/reporter/page-errors-block.js +98 -0
  193. package/dist/reporter/page-errors-block.js.map +1 -0
  194. package/dist/reporter/real-requests-block.d.ts +33 -0
  195. package/dist/reporter/real-requests-block.d.ts.map +1 -0
  196. package/dist/reporter/real-requests-block.js +53 -0
  197. package/dist/reporter/real-requests-block.js.map +1 -0
  198. package/dist/step-summary/step-summary.d.ts +27 -7
  199. package/dist/step-summary/step-summary.d.ts.map +1 -1
  200. package/dist/step-summary/step-summary.js +107 -15
  201. package/dist/step-summary/step-summary.js.map +1 -1
  202. package/dist/storybook/options-encoding.d.ts +18 -5
  203. package/dist/storybook/options-encoding.d.ts.map +1 -1
  204. package/dist/storybook/options-encoding.js +12 -4
  205. package/dist/storybook/options-encoding.js.map +1 -1
  206. package/dist/storybook/options-read.d.ts +3 -2
  207. package/dist/storybook/options-read.d.ts.map +1 -1
  208. package/dist/storybook/options-read.js +17 -0
  209. package/dist/storybook/options-read.js.map +1 -1
  210. package/dist/storybook/read-stories.d.ts +15 -0
  211. package/dist/storybook/read-stories.d.ts.map +1 -1
  212. package/dist/storybook/read-stories.js +60 -14
  213. package/dist/storybook/read-stories.js.map +1 -1
  214. package/package.json +2 -1
  215. 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 profile folder and the CDP pipe.
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,C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gBAAgB;QACnB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC5C,6BAA6B;QAC7B,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"}
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;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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`. Only `update` turns it on, since
114
- * watching has a cost: the browser reports every request, and the page attaches to the service workers of its
115
- * browser context. A page that doesn't watch turns on no request reporting and attaches to no service worker.
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. Fails with a `PageTimeoutError` when the browser doesn't answer within the driver's own fixed limit.
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":"driver.d.ts","sourceRoot":"","sources":["../../../src/capture/driver/driver.ts"],"names":[],"mappings":"AAAA,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O,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,EAK7G;CACF"}
@@ -61,6 +61,39 @@ export function readConsoleMessage(payload) {
61
61
  }
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;AAqLlE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAA;AAE5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA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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"}
@@ -15,4 +15,14 @@ export declare const taskFrameMs = 16;
15
15
  * either, and never stays pending.
16
16
  */
17
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
+ /**
19
+ * The source of a function, evaluated in the page as part of the page script, that gives `heightSettledBefore(deadline)`.
20
+ * It takes what the page script kept at document start: the browser's own `setTimer` and `clearTimer`, and the
21
+ * `framesPassedBefore` that `framesFunction` gives. `heightSettledBefore` lets two frames pass, so the page's observers
22
+ * and undebounced `resize` listeners react to the viewport, then reads the height of the document's scrolling element
23
+ * after each frame until it has stayed the same for 200 ms, or for at most 1 s, and resolves true. It resolves false as
24
+ * soon as `deadline`, a promise, settles first. A document it can't read counts as 0 px tall. It leaves no timer
25
+ * behind.
26
+ */
27
+ export declare const heightSettleFunction = "(context) => {\n const { setTimer, clearTimer, framesPassedBefore } = context\n\n const heightOf = () => {\n try {\n const root = document.scrollingElement ?? document.documentElement\n return root ? root.scrollHeight : 0\n } catch {\n return 0\n }\n }\n\n return async (deadline) => {\n if (!(await framesPassedBefore(2, deadline))) {\n return false\n }\n let quiet = false\n let capped = false\n let quietTimer\n const restartQuiet = () => {\n clearTimer(quietTimer)\n quietTimer = setTimer(() => {\n quiet = true\n }, 200)\n }\n const capTimer = setTimer(() => {\n capped = true\n }, 1000)\n try {\n let height = heightOf()\n restartQuiet()\n while (!quiet && !capped) {\n if (!(await framesPassedBefore(1, deadline))) {\n return false\n }\n const next = heightOf()\n if (next !== height) {\n height = next\n restartQuiet()\n }\n }\n return true\n } finally {\n clearTimer(quietTimer)\n clearTimer(capTimer)\n }\n }\n}";
18
28
  //# sourceMappingURL=frames.d.ts.map
@@ -1 +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"}
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;AAcF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,gmCA+C/B,CAAA"}
@@ -51,4 +51,71 @@ export const framesFunction = `(context) => {
51
51
  return true
52
52
  }
53
53
  }`;
54
+ /**
55
+ * How long, in ms, the page's height must stay the same once the viewport was set again after the wait hook before
56
+ * it's measured: longer than a typical debounced `resize` handler takes to answer, so the page's reaction lands first.
57
+ */
58
+ const settleQuietMs = 200;
59
+ /**
60
+ * How long, in ms, the page's height is watched at most once the viewport was set again after the wait hook. A page
61
+ * whose height still changes then is measured as it is.
62
+ */
63
+ const settleCapMs = 1000;
64
+ /**
65
+ * The source of a function, evaluated in the page as part of the page script, that gives `heightSettledBefore(deadline)`.
66
+ * It takes what the page script kept at document start: the browser's own `setTimer` and `clearTimer`, and the
67
+ * `framesPassedBefore` that `framesFunction` gives. `heightSettledBefore` lets two frames pass, so the page's observers
68
+ * and undebounced `resize` listeners react to the viewport, then reads the height of the document's scrolling element
69
+ * after each frame until it has stayed the same for 200 ms, or for at most 1 s, and resolves true. It resolves false as
70
+ * soon as `deadline`, a promise, settles first. A document it can't read counts as 0 px tall. It leaves no timer
71
+ * behind.
72
+ */
73
+ export const heightSettleFunction = `(context) => {
74
+ const { setTimer, clearTimer, framesPassedBefore } = context
75
+
76
+ const heightOf = () => {
77
+ try {
78
+ const root = document.scrollingElement ?? document.documentElement
79
+ return root ? root.scrollHeight : 0
80
+ } catch {
81
+ return 0
82
+ }
83
+ }
84
+
85
+ return async (deadline) => {
86
+ if (!(await framesPassedBefore(2, deadline))) {
87
+ return false
88
+ }
89
+ let quiet = false
90
+ let capped = false
91
+ let quietTimer
92
+ const restartQuiet = () => {
93
+ clearTimer(quietTimer)
94
+ quietTimer = setTimer(() => {
95
+ quiet = true
96
+ }, ${settleQuietMs})
97
+ }
98
+ const capTimer = setTimer(() => {
99
+ capped = true
100
+ }, ${settleCapMs})
101
+ try {
102
+ let height = heightOf()
103
+ restartQuiet()
104
+ while (!quiet && !capped) {
105
+ if (!(await framesPassedBefore(1, deadline))) {
106
+ return false
107
+ }
108
+ const next = heightOf()
109
+ if (next !== height) {
110
+ height = next
111
+ restartQuiet()
112
+ }
113
+ }
114
+ return true
115
+ } finally {
116
+ clearTimer(quietTimer)
117
+ clearTimer(capTimer)
118
+ }
119
+ }
120
+ }`;
54
121
  //# sourceMappingURL=frames.js.map
@@ -1 +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"}
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;AAEF;;;GAGG;AACH,MAAM,aAAa,GAAG,GAAG,CAAA;AAEzB;;;GAGG;AACH,MAAM,WAAW,GAAG,IAAI,CAAA;AAExB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;WAuBzB,aAAa;;;;SAIf,WAAW;;;;;;;;;;;;;;;;;;;;EAoBlB,CAAA"}
@@ -3,7 +3,7 @@ import { type CapturePrepRequest } from './prepare-capture.js';
3
3
  * The script that runs at the start of every document of a page, before the page's own scripts, in every driver. Until
4
4
  * capture, it changes no styles except emptying Storybook 9.1 and 10's pause stylesheets. It reads the document only
5
5
  * once the story finished: in the Storybook adapter's part, in the wait for images and fonts, which also makes lazy
6
- * images eager, in the end state, in the remote content search and in the capture preparation, which paints the masks
6
+ * images eager, in the wait for the page's height to settle, in the end state, in the remote content search and in the capture preparation, which paints the masks
7
7
  * and hides the caret. It does only this, keeping its own state under one non-enumerable global:
8
8
  *
9
9
  * - wraps `Element.prototype.attachShadow` to record every shadow root it creates, closed ones included, in
@@ -30,9 +30,13 @@ 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, so the page reacts to the new
34
- * size before anything goes on: an `IntersectionObserver`, a `ResizeObserver` or a `resize` listener calls back,
35
- * and the render it causes is done. It lets the frames pass as `framesFunction` says, within a time limit;
33
+ * - gives `letFramesPass`, which the frames expression calls once the viewport grew, and once it grew 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;
37
+ * - gives `letHeightSettle`, which the settle expression calls once the viewport was set again after the wait hook,
38
+ * before the page is measured, so a page sized by a debounced `resize` handler has shrunk back first. It waits as
39
+ * `heightSettleFunction` says, within a time limit;
36
40
  * - gives `bringToEndState`, which the end state expression calls at capture. It brings every animation in the
37
41
  * document and in every shadow root to its end state, then freezes their videos, SVGs, inline or as CSS images, and
38
42
  * GIFs, then brings the animations that freezing them started to their end state too, as `endStateFunction` says,
@@ -121,13 +125,20 @@ export type FramesPassed = {
121
125
  outcome: 'script-missing';
122
126
  };
123
127
  /**
124
- * Builds the expression that lets two frames pass in the page once the viewport grew, so the page reacts to the new
125
- * size, or gives up once `timeoutMs` passes, rounded up to whole ms. Its value is the page's answer, which
126
- * `readFramesPassed` reads.
128
+ * Builds the expression that lets two frames pass in the page once the viewport grew, or grew after the wait
129
+ * hook, so the page reacts to the new size, or gives up once `timeoutMs` passes, rounded up to whole ms. Its value is
130
+ * the page's answer, which `readFramesPassed` reads.
127
131
  */
128
132
  export declare function framesAfterGrowthExpression(timeoutMs: number): string;
129
133
  /**
130
- * Reads the value the frames expression gave. Throws, quoting the value, when it's not an answer the page gives.
134
+ * Builds the expression that waits in the page, once the viewport was set again after the wait hook, until the page
135
+ * reacted to it and its height stayed the same for 200 ms, or for at most 1 s, or gives up once `timeoutMs` passes,
136
+ * rounded up to whole ms. Its value is the page's answer, which `readFramesPassed` reads: `passed` once the height
137
+ * settled or the second ran out.
138
+ */
139
+ export declare function heightSettledExpression(timeoutMs: number): string;
140
+ /**
141
+ * Reads the value the frames expression or the settle expression gave. Throws, quoting the value, when it's not an answer the page gives.
131
142
  */
132
143
  export declare function readFramesPassed(value: unknown): FramesPassed;
133
144
  /**
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;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;CA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AY,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;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOjE;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,7 +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
+ import { framesFunction, heightSettleFunction } from './frames.js';
5
5
  import { prepareCaptureFunction } from './prepare-capture.js';
6
6
  import { remoteContentFunction } from './remote-content.js';
7
7
  /**
@@ -12,7 +12,7 @@ const stateGlobal = '__visualCheck';
12
12
  * The script that runs at the start of every document of a page, before the page's own scripts, in every driver. Until
13
13
  * capture, it changes no styles except emptying Storybook 9.1 and 10's pause stylesheets. It reads the document only
14
14
  * once the story finished: in the Storybook adapter's part, in the wait for images and fonts, which also makes lazy
15
- * images eager, in the end state, in the remote content search and in the capture preparation, which paints the masks
15
+ * images eager, in the wait for the page's height to settle, in the end state, in the remote content search and in the capture preparation, which paints the masks
16
16
  * and hides the caret. It does only this, keeping its own state under one non-enumerable global:
17
17
  *
18
18
  * - wraps `Element.prototype.attachShadow` to record every shadow root it creates, closed ones included, in
@@ -39,9 +39,13 @@ const stateGlobal = '__visualCheck';
39
39
  * decoded again. Then it forces layout, so the fonts the layout needs start loading, and waits for
40
40
  * `document.fonts.ready`. One time limit covers both. A page without an API it uses, such as `document.fonts`, has
41
41
  * nothing to wait for there;
42
- * - gives `letFramesPass`, which the frames expression calls once the viewport grew, so the page reacts to the new
43
- * size before anything goes on: an `IntersectionObserver`, a `ResizeObserver` or a `resize` listener calls back,
44
- * and the render it causes is done. It lets the frames pass as `framesFunction` says, within a time limit;
42
+ * - gives `letFramesPass`, which the frames expression calls once the viewport grew, and once it grew 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;
46
+ * - gives `letHeightSettle`, which the settle expression calls once the viewport was set again after the wait hook,
47
+ * before the page is measured, so a page sized by a debounced `resize` handler has shrunk back first. It waits as
48
+ * `heightSettleFunction` says, within a time limit;
45
49
  * - gives `bringToEndState`, which the end state expression calls at capture. It brings every animation in the
46
50
  * document and in every shadow root to its end state, then freezes their videos, SVGs, inline or as CSS images, and
47
51
  * GIFs, then brings the animations that freezing them started to their end state too, as `endStateFunction` says,
@@ -296,7 +300,7 @@ ${storybookPageScript};
296
300
  }
297
301
  }
298
302
 
299
- // Letting frames pass, so the page reacts to a viewport that grew.
303
+ // Letting frames pass, so the page reacts to a viewport that grew or was set again.
300
304
 
301
305
  const framesPassedBefore = (${framesFunction})({ setTimer, requestFrame })
302
306
 
@@ -312,6 +316,22 @@ ${storybookPageScript};
312
316
  }
313
317
  }
314
318
 
319
+ // Letting the page's height settle, so it has reacted to a viewport set again before it's measured.
320
+
321
+ const heightSettledBefore = (${heightSettleFunction})({ setTimer, clearTimer, framesPassedBefore })
322
+
323
+ const letHeightSettle = async (timeoutMs) => {
324
+ let timer
325
+ const deadline = new Promise((resolve) => {
326
+ timer = setTimer(resolve, timeoutMs)
327
+ })
328
+ try {
329
+ return (await heightSettledBefore(deadline)) ? { outcome: 'passed' } : { outcome: 'timed-out' }
330
+ } finally {
331
+ clearTimer(timer)
332
+ }
333
+ }
334
+
315
335
  // The end state, brought about only at capture.
316
336
 
317
337
  const bringToEndState = (${endStateFunction})({
@@ -347,6 +367,7 @@ ${storybookPageScript};
347
367
  messages,
348
368
  waitForAssets,
349
369
  letFramesPass,
370
+ letHeightSettle,
350
371
  bringToEndState,
351
372
  findRemoteContent,
352
373
  prepareCapture,
@@ -374,14 +395,14 @@ export function assetsReadyExpression(timeoutMs) {
374
395
  })()`;
375
396
  }
376
397
  /**
377
- * How many frames pass once the viewport grew: the first runs the rendering update that calls the page's observers
378
- * back, the second paints what their render changed.
398
+ * How many frames pass once the viewport grew, or grew after the wait hook: the first runs the rendering update
399
+ * that calls the page's observers back, the second paints what their render changed.
379
400
  */
380
401
  const framesAfterGrowth = 2;
381
402
  /**
382
- * Builds the expression that lets two frames pass in the page once the viewport grew, so the page reacts to the new
383
- * size, or gives up once `timeoutMs` passes, rounded up to whole ms. Its value is the page's answer, which
384
- * `readFramesPassed` reads.
403
+ * Builds the expression that lets two frames pass in the page once the viewport grew, or grew after the wait
404
+ * hook, so the page reacts to the new size, or gives up once `timeoutMs` passes, rounded up to whole ms. Its value is
405
+ * the page's answer, which `readFramesPassed` reads.
385
406
  */
386
407
  export function framesAfterGrowthExpression(timeoutMs) {
387
408
  const limit = Math.max(0, Math.ceil(timeoutMs));
@@ -391,7 +412,20 @@ export function framesAfterGrowthExpression(timeoutMs) {
391
412
  })()`;
392
413
  }
393
414
  /**
394
- * Reads the value the frames expression gave. Throws, quoting the value, when it's not an answer the page gives.
415
+ * Builds the expression that waits in the page, once the viewport was set again after the wait hook, until the page
416
+ * reacted to it and its height stayed the same for 200 ms, or for at most 1 s, or gives up once `timeoutMs` passes,
417
+ * rounded up to whole ms. Its value is the page's answer, which `readFramesPassed` reads: `passed` once the height
418
+ * settled or the second ran out.
419
+ */
420
+ export function heightSettledExpression(timeoutMs) {
421
+ const limit = Math.max(0, Math.ceil(timeoutMs));
422
+ return `(async () => {
423
+ const state = globalThis.${stateGlobal}
424
+ return state === undefined ? { outcome: 'script-missing' } : state.letHeightSettle(${limit})
425
+ })()`;
426
+ }
427
+ /**
428
+ * Reads the value the frames expression or the settle expression gave. Throws, quoting the value, when it's not an answer the page gives.
395
429
  */
396
430
  export function readFramesPassed(value) {
397
431
  const answer = typeof value === 'object' && value !== null ? { ...value } : {};
@@ -1 +1 @@
1
- {"version":3,"file":"page-script.js","sourceRoot":"","sources":["../../src/capture/page-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAC7F,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAA2B,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,GAAG,eAAe,CAAA;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;EAC5B,mBAAmB;;0DAEqC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA4B7B,4BAA4B;;;;;;;;;;;;;;;;oDAgBhB,4BAA4B;;;;;;;;;;;;;;;;;;;;gCAoBhD,4BAA4B;;;;;;;;;;;;;8EAakB,4BAA4B;;8BAE5E,mB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