@unotest/viewer 0.43.1 → 0.44.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 +60 -0
- package/dist/server/main.js +1 -1
- package/dist/server/session.js +1 -1
- package/dist/server/snapshot.js +1 -1
- package/dist/server/wire.js +1 -1
- package/dist/web/assets/{DslEditor-CapIr366.js → DslEditor-D7d2IbFu.js} +2 -2
- package/dist/web/assets/index-Ct3W5FAt.js +55 -0
- package/dist/web/index.html +1 -1
- package/package.json +6 -6
- package/dist/web/assets/index-CFs9jSgu.js +0 -55
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.44.0] - 2026-09-30
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 816e2ea: A second browser context in one test: two clients of the same app.
|
|
8
|
+
|
|
9
|
+
- **New DSL functions `newContext()` and `setContext(index)`.** `newContext()` opens another browser context with the same options as the first: base URL, viewport, `device`, time zone, locale and page clock. It has its own cookies, storage and tabs, makes it the active one and returns its number (the test's own context is `0`). `setContext(i)` switches. Each context keeps its own tab and frame, so a switch back lands where the scenario left off. At the end of the test every context is closed.
|
|
10
|
+
- **Config `maxContexts`** (default 4) caps contexts per test. The next `newContext()` is refused and the refusal names the key. On a browser profile (`launch.userDataDir`) `newContext()` is refused: every page there shares one context.
|
|
11
|
+
- **Run journal and failure bundle.** Once a second context exists, each step records the context it started in (`contextIndex`), and the viewer's Trace shows it as a `ctx N` chip. A failure bundles the active context's page, console and network, with `contextIndex` in `failure.json`. A one-context test writes exactly what it did before. Both fields are additive: an older viewer reads the new journal and a newer one reads the old.
|
|
12
|
+
- **MCP.** `explore_step` gains `newContext` and `setContext {index}`, recorded as the same DSL calls. The `new_context` tool still resets the browser. Intent grounding follows the active context. An agent joining a paused debug run (`take_wheel`, `attach_debug_session`) lands in the context the run is on (Chromium).
|
|
13
|
+
- **New lint rule `lint:shadows-dsl-function`** (warning): a function or variable of your own that has a DSL function's name.
|
|
14
|
+
|
|
15
|
+
**If your scenarios define their own `newContext` or `setContext`:** a call by that name still runs your function, so nothing changes at run time. The new DSL function is out of reach until you rename yours. `lint:shadows-dsl-function` points at the definition.
|
|
16
|
+
|
|
17
|
+
- 5ac6c72: `teardown("label", () => { … })` — give the stand back whatever happens.
|
|
18
|
+
|
|
19
|
+
- A scenario registers a rollback block where it turns something on; after the test body every registered block runs, newest first, whether the test passed, failed, ran out of time or was stopped — including a run stopped while paused at its failure (the debugger, `run_test`). One failing block does not stop the others. Flows and helpers can carry their own rollback.
|
|
20
|
+
- A green test whose teardown failed is failed; a failed test keeps its own error and lists the teardown failures next to it (CLI, `run_test` → `next.teardownFailures`, `runtime.json`). The failure bundle is taken before the rollback, so it shows the page the test broke on.
|
|
21
|
+
- The CLI prints `↺ teardown "…"` per block; the journal gets `teardown:started` / `teardown:finished` / `teardown:skipped` events and a `teardown` flag on the block frame; the viewer marks those frames and shows "returning the stand…" while a stopped run rolls back.
|
|
22
|
+
- Stop now rolls back first: the first Stop (viewer, `abort_runtime`, SIGTERM, Ctrl-C) plays the teardown blocks and then ends the run; a second Stop skips what is left and says so. `abort_runtime` answers `status: "returning the stand…"` while that happens.
|
|
23
|
+
- New config key `teardownTimeoutMs` (default 60000): the ceiling for all teardown blocks of a run, separate from the run's own time budget. A killed process, or blocks cut by this ceiling, leave the stand as the test set it — the run result names them.
|
|
24
|
+
- Lint: `teardown-shape` (string-literal label, no `return` / `break` out of the block, no nested teardown) and `teardown-name-conflict`.
|
|
25
|
+
|
|
26
|
+
**Breaking for scenarios that define their own `teardown`.** A function, parameter or variable named `teardown` is now a lint error (`teardown-name-conflict`), and a statement-level call `teardown(x)` no longer parses as a call. Rename it, e.g. to `undo_setup`.
|
|
27
|
+
|
|
28
|
+
- d1605b2: `assertScreenshot` — the page, or an element, against a PNG baseline in the repo.
|
|
29
|
+
|
|
30
|
+
- `assertScreenshot(name, options?)` / `assertScreenshot(locator, name, options?)` compares a snapshot with `unotest/e2e/<scenario>.screenshots/<name>.png` — a Figma export or a snapshot you accepted. A pixel differs when any channel differs by more than `threshold` (default 32); the assert fails when the share of differing pixels is more than `maxDiffRatio` (default 0) — exactly the limit passes. `mask: [locator…]` and `ignore: [{x, y, width, height}…]` leave areas out of the comparison on both sides. A different size fails at once with both sizes; nothing is resampled. `fullPage: true` compares the whole page.
|
|
31
|
+
- No baseline yet: the assert fails and the snapshot is saved in the run's artifacts as a candidate under the baseline's file name. `e2e --update-screenshots` (MCP: `run_test {updateScreenshots: true}`) writes the snapshots as baselines; it is refused on a box.
|
|
32
|
+
- A failed assert keeps `expected`, `actual` and `diff` pictures (per retry attempt); the viewer shows them side by side on the failed step with a "Download as baseline" button, the failure bundle points at them, and `run_test` returns them in `next.visual`. `box run --download` / `box_run_download` unpack baseline candidates next to the zip.
|
|
33
|
+
- A baseline is read as untrusted input: an image over 25 megapixels, or one whose data unpacks to more than its header allows, is refused before it is decoded.
|
|
34
|
+
- The journal gets a `visual-assert` event per assert; `runtime.json` carries the last failed one as `visual`.
|
|
35
|
+
- A suite over 128 MB is warned about before the upload — boxes accept 128 MB by default — naming its biggest files and baselines.
|
|
36
|
+
|
|
37
|
+
New dependency of `@unotest/web`: `pngjs` 7.0.0 (MIT, no dependencies of its own), the PNG codec behind the comparison.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- 3780074: A finished run opened from history keeps its rollback pass: the viewer no longer drops `teardown:started` / `teardown:finished` / `teardown:skipped` from a stored journal, so the teardown frames of a stopped run show next to the step it was stopped in — not inside it — as they do while the run is live.
|
|
42
|
+
- Updated dependencies [816e2ea]
|
|
43
|
+
- Updated dependencies [565ef67]
|
|
44
|
+
- Updated dependencies [5ac6c72]
|
|
45
|
+
- Updated dependencies [d1605b2]
|
|
46
|
+
- Updated dependencies [99ba57f]
|
|
47
|
+
- Updated dependencies [d66cf72]
|
|
48
|
+
- Updated dependencies [832c101]
|
|
49
|
+
- @unotest/protocol@0.44.0
|
|
50
|
+
- @unotest/dsl@0.44.0
|
|
51
|
+
- @unotest/core@0.44.0
|
|
52
|
+
|
|
53
|
+
## [0.43.2] - 2026-09-30
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [665da8f]
|
|
58
|
+
- Updated dependencies [56c899c]
|
|
59
|
+
- @unotest/core@0.43.2
|
|
60
|
+
- @unotest/protocol@0.43.2
|
|
61
|
+
- @unotest/dsl@0.43.2
|
|
62
|
+
|
|
3
63
|
## [0.43.1] - 2026-09-29
|
|
4
64
|
|
|
5
65
|
### Patch Changes
|