@zappie/verify 0.2.8 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @zappie/verify
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d1c8b1d: V14's `menuJsKbGz` now measures the same build the same way on every run. It counts the JavaScript the menu needs to start: the scripts and module preloads the server's document names, read when the document is parsed. Chunks the running page imports later, when it hydrates, in its effects, or on idle or intent, no longer count toward it. Before, they counted only when they happened to load inside the measurement window, so one build of a site measured anywhere from 163.5 to 194.6 KiB. The 200 KiB budget applies to the new figure. `menuJsLoadedKbGz` counts every script loaded once the network goes quiet, later imports included. V14 fails it past 350 KiB with `loaded_js_too_large`, and `findRegressions` compares it with the baseline, allowing 10% or 10 KiB of growth, whichever is larger. A site's `menuJsKbGz` drops on this release, so record a new baseline from its first run.
8
+ - 5a2bce9: Verify can start somewhere other than `/`, for a site whose root is a directory of its menus. Set `verify.startPath` in `zappie.config.ts`, or pass `startPath` to `verify()` or `verifyProject()`. Every check that opened `/` as the menu opens that route instead. Set `verify.cataloguePath`, such as `/menu?menu={menu}`, when each menu has its own page: V03 then needs 95% of each menu's available items on that menu's page, instead of 95% of the branch's items on one page, and the checks that use an item open the page of a menu that holds it. A route must start with one `/` and contain no backslash. A site that sets neither runs as before. The report's `environment` records `startPath`, and `cataloguePath` when it is set. When `--store` is passed and `zappie.config.ts` exists but can't be read, the report's `warnings` says its verify settings were ignored. The `@zappie/sdk` site config and `zappie check` accept the `verify` settings, so a site that adds them needs `@zappie/sdk` 0.1.14 and `@zappie/check` 0.2.4 in the same change. This is a minor release, so a regression comparison doesn't compare these reports with reports from 0.2.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [5a2bce9]
13
+ - @zappie/sdk@0.1.14
14
+
15
+ ## 0.2.9
16
+
17
+ ### Patch Changes
18
+
19
+ - 9b25eb7: The packages now live in zappie/storefront-packages, and each package's repository, homepage and issues links point there. This release is the first one published from that repository.
20
+ - Updated dependencies [9b25eb7]
21
+ - @zappie/sdk@0.1.13
22
+
3
23
  ## 0.2.8
4
24
 
5
25
  ### Patch Changes
package/README.md CHANGED
@@ -24,6 +24,7 @@ With no URL, it builds your project, starts a local preview, runs the checks and
24
24
  | -------------------------------- | ------------------------------------------------------------------------------------- |
25
25
  | `--suite standard` or `extended` | The standard checks, or those plus the extended ones |
26
26
  | `--only <checks>` | Run only these checks: IDs such as `V01,V04`, or a set such as `quick` |
27
+ | `--start <path>` | The route verify opens as the menu. Default: `verify.startPath`, then `/` |
27
28
  | `--report <file>` | Save the full report as JSON |
28
29
  | `--json` | Print the report as JSON |
29
30
  | `--no-build` | Serve the project's existing build instead of building it again. Local mode only |
@@ -33,6 +34,23 @@ With no URL, it builds your project, starts a local preview, runs the checks and
33
34
 
34
35
  The `quick` set is V01 to V07, V09, V10 and V13: the fast journey checks without V14 to V18. V18 stays outside build-blocking quick runs while security headers are report-only. The set is exported as `CHECK_SETS.quick`.
35
36
 
37
+ ### Where the storefront starts
38
+
39
+ Verify opens `/` as the menu. A site whose root is something else, such as a directory of its menus, tells verify where to start in `zappie.config.ts`:
40
+
41
+ ```ts
42
+ export default {
43
+ store: "your-store",
44
+ theme: "./theme.json",
45
+ verify: { startPath: "/menu", cataloguePath: "/menu?menu={menu}" },
46
+ } satisfies ZappieSiteConfig;
47
+ ```
48
+
49
+ - `startPath` is the route verify opens wherever it opened `/`. It must list items. `--start` wins over it.
50
+ - `cataloguePath` is the page of each menu: `{menu}` stands for the menu id and `{branch}`, when you use it, for the branch id. With it, V03 opens every menu's page and needs 95% of that menu's available items on it, instead of 95% of the branch's items on one page. V04, V05, V13, V16 and V17 open the page of a menu that holds the item they use. An item that sits in no category of any menu belongs to no menu's page, so V03 doesn't judge it.
51
+
52
+ Without them, verify runs as before. The report's `environment` records `startPath`, and `cataloguePath` when it is set.
53
+
36
54
  ### Chromium
37
55
 
38
56
  Verify launches Playwright's own Chromium. To use another one, such as a system Chromium on a build machine, set `ZAPPIE_VERIFY_CHROMIUM` to its executable, or pass `browserExecutablePath` from code, which wins over the variable. The report's `environment.browser` then names the executable after the version.
@@ -63,7 +81,7 @@ const report = await verifyProject({
63
81
  console.log(printSummary(report));
64
82
  ```
65
83
 
66
- `verifyProject` also takes `build: false`, `port`, `only`, `runner`, `artifactsDir` and `browserExecutablePath`, the options behind the flags above. To verify a site you serve yourself, call `verify({ url, key, store, suite })` instead.
84
+ `verifyProject` also takes `build: false`, `port`, `only`, `startPath`, `cataloguePath`, `runner`, `artifactsDir` and `browserExecutablePath`, the options behind the flags above. It reads `startPath` and `cataloguePath` from `zappie.config.ts` when you don't pass them. To verify a site you serve yourself, call `verify({ url, key, store, suite })` instead, with `startPath` and `cataloguePath` when the site sets them.
67
85
 
68
86
  The report's shape is the JSON Schema at `@zappie/verify/schema/verify-report.v1.json`.
69
87
 
@@ -92,6 +110,10 @@ V13 scans each page and overlay once its entry animations have finished, so a fa
92
110
  | `data-zappie-action="add-to-cart"` | Checks that the keyboard reaches an Add control. On a menu without quick add, it tabs to an item without required options, opens it with Enter and tabs to its Add. |
93
111
  | `data-zappie-checkout` | Checks that the keyboard reaches the enabled checkout control on `/checkout`. |
94
112
 
113
+ ## Menu JavaScript
114
+
115
+ V14 opens the menu on a phone profile and fails when `menuJsKbGz` passes 200 KiB gzipped. It counts the JavaScript the menu needs to start: the scripts and module preloads the server's document names. Chunks the running page imports later, when it hydrates, in its effects, or on idle or intent, don't count, so one build measures the same on every run. `menuJsLoadedKbGz` counts every script loaded once the network goes quiet, those later imports included. It fails V14 past 350 KiB, and `findRegressions` compares it with the baseline, so code moved out of the document into late imports still counts.
116
+
95
117
  ## Overlays
96
118
 
97
119
  Mark each control that opens an overlay with `data-zappie-overlay-trigger="bag"`, `"branch"`, `"search"` or `"item"`, and the overlay's `role="dialog"` element with `data-zappie-overlay` and the same name. V16 waits until the menu has hydrated and its idle work, such as overlay preloads, and the downloads that work starts are done, as they would be for a shopper who has read the menu. Then it taps each marked trigger on a phone profile with the CPU slowed four times, and fails when the overlay takes more than 100 ms to paint. Anything the tap itself loads counts toward that time. Each tap is a shopper's first open on a first visit: V16 opens every overlay in a new browser context, so the checks before it can't warm it. It opens each overlay up to three times, each in its own context, and judges the median, so one slow sample on a busy machine doesn't fail it. It stops after two samples on the same side of the budget, because the third can't change the median. The CPU slowdown is calibrated to the machine: before the checks run, verify scores the browser's CPU with a short fixed benchmark and sets the throttling rate so that V14, V15 and V16 see the same phone everywhere. A developer laptop gets about four times, a slower CI runner less, between one and eight times. The report's `environment` records `cpuBenchmark` and the `cpuThrottlingRate` the checks used. The report's `overlayOpenMs` holds the medians and `overlayOpenSamplesMs` holds every sample, in the order they ran. V17 opens each one from the keyboard, in a new browser context too, and checks that focus moves in, Tab stays in, the page behind doesn't scroll, Escape closes it and focus returns to the trigger. Both are skipped while the menu has no markers.
@@ -109,6 +131,8 @@ const regressions = findRegressions(baselineReport, report);
109
131
 
110
132
  A metric regresses when it grows by more than its relative threshold or its absolute floor, whichever is larger. The defaults are in `DEFAULT_REGRESSION_THRESHOLDS`. A metric the baseline records and the new report doesn't also counts as a regression.
111
133
 
134
+ Compare only reports with the same `environment.startPath`, and `cataloguePath`. A report without `startPath` started at `/`. Metrics measured from another page don't compare.
135
+
112
136
  ## Docs
113
137
 
114
138
  - [CLI: zappie verify](https://docs.zappie.ai/cli/verify)
package/dist/index.d.ts CHANGED
@@ -44,6 +44,13 @@ type VerifyReport = {
44
44
  cpuBenchmark?: number;
45
45
  /** The CPU throttling rate the timed checks ran at, calibrated from `cpuBenchmark`. */
46
46
  cpuThrottlingRate?: number;
47
+ /**
48
+ * The route the checks opened as the menu. Reports from before verify 0.3.0 have none, and
49
+ * started at `/`. Metrics measured from different start paths don't compare.
50
+ */
51
+ startPath?: string;
52
+ /** The catalogue path V03 and the item checks used, when the run had one. */
53
+ cataloguePath?: string;
47
54
  };
48
55
  startedAt: string;
49
56
  durationMs: number;
@@ -54,8 +61,22 @@ type VerifyReport = {
54
61
  skipped: number;
55
62
  };
56
63
  checks: CheckResult[];
64
+ /** Findings about the run itself, such as settings verify could not read. */
65
+ warnings?: {
66
+ code: string;
67
+ message: string;
68
+ }[];
57
69
  metrics: {
70
+ /**
71
+ * Gzipped JavaScript the menu needs to start: the scripts and module preloads its server
72
+ * document names. Budgeted.
73
+ */
58
74
  menuJsKbGz?: number;
75
+ /**
76
+ * Every script loaded once the network goes quiet, idle and intent preloads included. Held to
77
+ * a loose 350 KiB budget and compared with a baseline, so code moved out of the document counts.
78
+ */
79
+ menuJsLoadedKbGz?: number;
59
80
  lcpMs?: number;
60
81
  cls?: number;
61
82
  productCardTappableMs?: number;
@@ -79,6 +100,23 @@ type VerifyOptions = {
79
100
  deploymentId?: string;
80
101
  /** Check IDs to run, such as `V01`, or a named set such as `quick`. All checks when unset. */
81
102
  only?: string[];
103
+ /**
104
+ * The route verify opens as the storefront's menu, such as `/menu`, for a site whose root is
105
+ * a directory rather than a menu. It must list items. Defaults to `/`.
106
+ */
107
+ startPath?: string;
108
+ /**
109
+ * The page of each menu, with `{menu}` where the menu id goes and, optionally, `{branch}` for
110
+ * the branch id, such as `/menu?menu={menu}`. With it, V03 judges each menu on its own page,
111
+ * and a check that needs an item opens the page of a menu that holds it. Without it, V03
112
+ * judges every item of the branch on the start page.
113
+ */
114
+ cataloguePath?: string;
115
+ /** Findings about the run to record in the report's `warnings`. */
116
+ warnings?: {
117
+ code: string;
118
+ message: string;
119
+ }[];
82
120
  viewports?: Viewport[];
83
121
  artifactsDir?: string;
84
122
  timeoutMs?: number;
@@ -147,7 +185,7 @@ type RegressionThreshold = {
147
185
  /** Growth always allowed, in the metric's own unit, so small values don't trip on noise. */
148
186
  absolute: number;
149
187
  };
150
- type RegressionMetric = "menuJsKbGz" | "menuCssKbGz" | "lcpMs" | "cls" | "productCardTappableMs" | "productCardOpenMs" | "overlayOpenMs";
188
+ type RegressionMetric = "menuJsKbGz" | "menuJsLoadedKbGz" | "menuCssKbGz" | "lcpMs" | "cls" | "productCardTappableMs" | "productCardOpenMs" | "overlayOpenMs";
151
189
  /**
152
190
  * A metric regresses when `head - base > max(absolute, relative × base)`. Sizes are
153
191
  * deterministic, so their allowance is small; timings carry runner noise, so theirs is wider.