@unotest/web 0.49.2 → 0.51.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/.claude/skills/write-e2e-test/SKILL.md +6 -7
- package/.claude/skills/write-e2e-test-ground/SKILL.md +6 -7
- package/CHANGELOG.md +349 -3
- package/README.md +25 -0
- package/dist/config/schema.d.ts +40 -18
- package/dist/config/schema.js +1 -1
- package/dist/driver/index.d.ts +13 -2
- package/dist/driver/index.js +1 -1
- package/dist/dsl/index.d.ts +388 -28
- package/dist/dsl/index.js +1 -1
- package/dist/dsl/web-dsl-language-service.d.ts +18 -6
- package/dist/dsl/web-dsl-language-service.js +1 -1
- package/dist/inspection/page-inject.d.ts +34 -7
- package/dist/inspection/page-inject.js +69 -4
- package/dist/{interfaces-mlRtu8mL.d.ts → interfaces-BSGmF_Tv.d.ts} +99 -3
- package/dist/{linter-RrjB1n9R.d.ts → linter-CYRlmOLy.d.ts} +32 -5
- package/dist/mcp/server.js +1 -1
- package/dist/runner/cli.d.ts +1 -1
- package/dist/runner/cli.js +1 -1
- package/dist/runner/init/chrome-probe.js +1 -1
- package/dist/runner/init.js +1 -1
- package/dist/runner/install-chromium.js +1 -1
- package/dist/runner/prepare-fix.js +1 -1
- package/dist/runner/scaffold-workspace.js +1 -1
- package/dist/runner/serve-fixture.js +1 -1
- package/dist/runner/web-runner-adapter.js +1 -1
- package/guides/agent-integration.md +25 -2
- package/guides/dsl-reference.md +1139 -293
- package/llms.txt +223 -0
- package/package.json +9 -8
- package/types/unotest-dsl.d.ts +350 -106
- package/types/unotest-lib.d.ts +1289 -0
|
@@ -442,13 +442,12 @@ State reads:
|
|
|
442
442
|
value there is no polling assert: read it in a loop —
|
|
443
443
|
`for (i = 0; i < 20; i = i + 1) { if (textContains(getInputValue(loc), 'x')) { break; } pause(200); // lint-ok: polling a textarea value }`
|
|
444
444
|
— then assert.
|
|
445
|
-
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
(`assertHidden`, `assertCount`, `.filter({hasText})`, `textContains`).
|
|
445
|
+
- A scenario is JavaScript: `!`, `JSON.stringify`, `Math.max`,
|
|
446
|
+
`Math.random`, `new Map()` / `new Set()`, string and array methods work
|
|
447
|
+
as they do in JS. `Date` and timers are left out; `unotest-web lint`
|
|
448
|
+
names what to use instead (`clockFreeze`, `pause(ms)`). Prefer an
|
|
449
|
+
assertion or a locator to a hand-written check (`assertHidden`,
|
|
450
|
+
`assertCount`, `.filter({hasText})`).
|
|
452
451
|
|
|
453
452
|
Sandbox primitives:
|
|
454
453
|
- `shell("cmd", "arg", …, options?)` — `execFile` style, no shell interpretation. Non-zero exit fails the step; pass `{allowNonZero: true}` to inspect `res.code` yourself. Wall-clock budget `{timeoutMs}` (default 120s).
|
|
@@ -573,13 +573,12 @@ State reads:
|
|
|
573
573
|
value there is no polling assert: read it in a loop —
|
|
574
574
|
`for (i = 0; i < 20; i = i + 1) { if (textContains(getInputValue(loc), 'x')) { break; } pause(200); // lint-ok: polling a textarea value }`
|
|
575
575
|
— then assert.
|
|
576
|
-
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
(`assertHidden`, `assertCount`, `.filter({hasText})`, `textContains`).
|
|
576
|
+
- A scenario is JavaScript: `!`, `JSON.stringify`, `Math.max`,
|
|
577
|
+
`Math.random`, `new Map()` / `new Set()`, string and array methods work
|
|
578
|
+
as they do in JS. `Date` and timers are left out; `unotest-web lint`
|
|
579
|
+
names what to use instead (`clockFreeze`, `pause(ms)`). Prefer an
|
|
580
|
+
assertion or a locator to a hand-written check (`assertHidden`,
|
|
581
|
+
`assertCount`, `.filter({hasText})`).
|
|
583
582
|
|
|
584
583
|
Sandbox primitives:
|
|
585
584
|
- `shell("cmd", "arg", …, options?)` — `execFile` style, no shell interpretation. Non-zero exit fails the step; pass `{allowNonZero: true}` to inspect `res.code` yourself. Wall-clock budget `{timeoutMs}` (default 120s).
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,351 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.51.0] - 2026-10-15
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c9dfb29: New: `animations(getByTestId('status'))` returns every animation of the element and its descendants as `[{name, kind, playState, currentTime?, infinite}]`, the typed read of what is moving and how. replaces: evaluateOnLocator with getAnimations. `name` is the keyframes name, the property a transition moves, or a script animation's id. Infinite and paused animations are listed too, marked by `infinite` and `playState`; `hasAnimation` and `waitForAnimations` count only the running ones that end by themselves, as before.
|
|
8
|
+
- 7ffd47b: New: `npx @unotest/web api [word...]` finds the DSL function for what you mean. replaces: searching the reference by a name you do not know yet. It prints one line per function: signature, the keys its options take, the release that added it, and when you need it. Search by the habit you know: `api wait animation` gives waitForAnimations, `api not appear` gives assertNeverAppears, `api sleep` gives pause; every word must match the name, a synonym or the description. Without a word it lists every function by section. The same index ships as `llms.txt` at the package root and as the first screen of the README, "What unotest can do".
|
|
9
|
+
- 81a97d6: New: `apiCall('POST', '/live/start', body, null, {timeoutMs: 150000})` gives one call a budget of its own, the reply body included. replaces: nothing (a call waited as long as the step and the test allowed, and `{timeout}` was refused). Past the budget the request is aborted and the step fails as a timeout naming the call by method and path, without the base or the query. Without `{timeoutMs}` a call behaves as before. It combines with `{base}` in the same options object.
|
|
10
|
+
- 17f4bc2: New: `assertFileLacks('logs', API_TOKEN)` and `assertFileHas('tmp/dump.sql', /v1:[A-Za-z0-9+\/=]{20,}/)` check that a string or a regex is absent from, or present in, a file or a whole directory tree. replaces: shell with grep after the run, outside the report. A string is searched as bytes, so binary files count; a regex reads files as UTF-8. `assertFileHas` waits up to `{timeoutMs}` (default 20 s). `assertFileLacks` searches once, or watches `{withinMs}`, and a path that does not exist fails rather than passes. A hit names the file and the line, with the matched bytes replaced by `‹match, N bytes›`, so a regex that catches an unregistered secret does not copy it into the report. Paths follow the same rules as `readFile`; symlinks inside a directory are not followed.
|
|
11
|
+
- 6ea4085: New: `assertNever(() => apiCall('GET', '/me').status == 200, {withinMs: 5000})`, a negative window for a condition, the pair of `assertNeverAppears` for anything that is not a locator. replaces: pause. The body (an expression, or a block that `return`s its value) is polled for the whole window; the step fails the moment it is truthy, naming the value and the time into the window, and passes when the window elapsed clean. `pause(ms)` followed by one assertion misses an event that came and went during the pause. `withinMs` is required, `intervalMs` defaults to 250. A malformed call is reported under the new validator rule `validator:assert-never-shape`. A suite function of its own named `assertNever` keeps running as before.
|
|
12
|
+
- 45dbd8b: New: `assertClipboard(/\/invite\/\d+$/)` waits until the clipboard holds the text a "copy" button wrote, and `clipboardRead()` returns that text. replaces: evaluate replacing navigator.clipboard.writeText in the page. A string is the whole text, a regex a match; `{timeoutMs}` defaults to 5 s. Works in Chromium and Firefox on an https or localhost page. WebKit does not let a page read the clipboard, and the call fails naming the engine instead of returning an empty string. In Chromium every new browser context now has clipboard read and write access, so a page's own copy button succeeds in a headless run, as it does for a person in desktop Chrome. The clipboard belongs to the browser, so tests running in parallel in one browser share it.
|
|
13
|
+
- ac8f70a: BREAKING: a DSL call now checks, when it runs, the kind of every argument lint could not see: a variable, a field of an API reply, a value built in a loop. One of another kind stops the step on its line with the sentence lint shows for a literal: `fill(): argument 2 (text) must be a string value, got number 42`, `click(): option timeoutMs must be a number, got a string "5000"`. Before, some functions refused such a value in words of their own and some coerced it: `getByText('Total', {exact: e})` with `e` holding the string `"no"` matched exactly and failed seconds later as `locator not visible within timeout`. A condition is still read by truthiness, so only a number, a string or a locator passed as one is refused. Where a client's suite relied on a coercion, the call still runs with a warning ending in `an error from 0.52.0`.
|
|
14
|
+
|
|
15
|
+
Migration: convert the value where it is made, `String(total)` for text, `Number(env('WAIT_MS'))` for a time limit, a comparison for a condition. Run the suite once and fix every line the run stops on or warns about.
|
|
16
|
+
|
|
17
|
+
Changed: lint now checks `setViewport` and `emulateMedia` arguments before the run, as the run already did: a misspelt key (`{heigth}`), a value `emulateMedia` does not take (`{colorScheme: 'blue'}`) or anything but a size or `null` for `setViewport` is named on its line. The editor types follow: `setViewport(size: {width, height} | null)`, and `emulateMedia` offers its values.
|
|
18
|
+
|
|
19
|
+
Signatures, the API index (`npx @unotest/web api`, `llms.txt`) and the DSL reference now name the time limit `timeoutMs`, the key the option lists and refusals already used. `timeout` still works as an alias; the index marks it once per function: `options {state?, timeoutMs?} (alias: timeout → timeoutMs)`. Signatures that missed keys their function takes now list them (`waitUntil` on goBack, goForward and waitForUrl; `force` on selectOption; `position` and `modifiers` on doubleClick), and `waitForText` no longer offers `first`, which has been refused since 0.50.0.
|
|
20
|
+
|
|
21
|
+
The DSL reference has a Signatures section: every function with the types it takes, generated from the same contract lint and the run check against, so it cannot drift from them.
|
|
22
|
+
|
|
23
|
+
Changed: `waitUntil` (goto, reload, goBack, goForward, waitForUrl) takes `'load'`, `'domcontentloaded'`, `'networkidle'` or `'commit'`, and lint and the run name a misspelt one on its line: `goto(): option waitUntil must be one of: load, domcontentloaded, networkidle, commit`. Before, it reached the browser, which failed the step with its own message. The reference now lists `'commit'` and the editor offers the four values.
|
|
24
|
+
|
|
25
|
+
`@unotest/dsl`: the argument kind `'null'`, for a slot that takes `null` as one member of a `{oneOf}`; `hint` on an argument, a sentence lint and the run append to a refused value (`round(): argument 1 (n) must be a number, got a string "2.5" — read text with toNumber(text) first`), and option notes appended the same way to a key's refused value; `canonicalOptionKeys`, the keys of an options schema without their aliases.
|
|
26
|
+
|
|
27
|
+
- 1c16eba: New: a `collection` run says how long it took. The summary line ends with the wall clock of the whole run, every worker at once — `collection regress: failed — pass=21, fail=1, time=252.3s` — and each test of a file of several gets its own time beside its name, as the file's line already had: `✓ test_checkout (812ms)`. replaces: wrapping the run in `time` and adding up the per-file lines. The collection's journal carries the same total on its last line (`durationMs`), and each test's time in the file's entry, for whatever reads the run afterwards.
|
|
28
|
+
- 809c738: New: MCP tool `dsl_lookup({task: 'wait until the dialog stops animating'})` answers "how do I" in plain words with the 1-3 DSL functions for it, best first: signature, option keys, the release that added it, one example line and where the shipped guide describes it. replaces: guessing a function name, or writing pause, page code or shell for a step the language already has. Words no function holds return none and a hint. It is part of the core toolset too. The answers come from the same index as `npx @unotest/web api`, which now also matches a longer form of a word (`animating` finds waitForAnimations).
|
|
29
|
+
- cb1161b: New: `lint:external-variable-no-value` reports a variable that only `unotest/.env.example` or `.secrets.example` declares while no file, overlay or the shell gives it a value. replaces: `lint:external-variable-undeclared` for that case, whose text sent the author to add a name that was already declared. The message names the template and where to set the value: `unotest/.env`, the active overlay, or the shell. A run reports it (`run_test`, the pre-run check of `e2e`); the `lint` command reads files alone and counts a template name as declared, so a value a CI runner exports does not turn it red. `lint:external-variable-undeclared` now means a name no file declares at all.
|
|
30
|
+
|
|
31
|
+
Fixed: the run header lists only the files values come from, in order, and names `.env.example` / `.secrets.example` apart as `declared names only`; a placeholder value in a template never reaches the run.
|
|
32
|
+
|
|
33
|
+
- 8b70693: New: config key `profile: "ios"` runs the suite in WebKit as an iPhone (the `"iPhone 15"` preset: size, scale, touch, mobile mode, user agent) launched from the home screen, in one line; `browsers` or `device` next to it is refused. replaces: `browsers: ["webkit"]` with `device` and a page-side `navigator.standalone` stub. Config key `displayMode: 'browser' | 'standalone' | 'minimal-ui' | 'fullscreen'` sets the launch mode the page's scripts see from the first document on: `matchMedia('(display-mode: standalone)')` answers for it, and in WebKit `navigator.standalone` is `true`. No engine emulates the feature itself, so CSS `@media (display-mode: …)` still sees a browser tab. Playwright WebKit is not Safari on iOS: no zoom on focus, no on-screen keyboard.
|
|
34
|
+
- 7630fbf: New: linter rule `lint:typed-step-available` (info) names the typed step for code a scenario wrote by hand, e.g. `pause(5000); assertHidden(getByText('Error'))` → `assertNeverAppears(getByText('Error'), {withinMs: 5000})`. replaces: pause before an absence check, pause to let an animation settle, evaluate with getComputedStyle, evaluate with naturalWidth.
|
|
35
|
+
|
|
36
|
+
It reports `getComputedStyle` in page code (use `computedStyle(locator, property)`), `naturalWidth` / `complete` (use `getImageSize(locator)`), a `pause` before `assertHidden` or `assertCount(…, 0)` (use `assertNeverAppears(locator, {withinMs})`), and a `pause` whose step label or comment mentions a fade, an animation or a control being enabled (use `waitForAnimations(locator)` or `waitFor(locator, {state: 'enabled'})`). Each message names the section of `node_modules/@unotest/web/guides/dsl-reference.md` that describes the step. Set the rule to `off` in `linter.rules` to silence it.
|
|
37
|
+
|
|
38
|
+
- 099b79f: New: MCP client steps — a scenario starts a stdio MCP server, calls its tools and waits for its notifications: `const srv = mcpStart('node', ['server.js']); mcpCall(srv, 'echo', {text: 'hi'}); mcpWaitNotification(srv, 'notifications/message', {match: {'data.echoed': 'hi'}})`. Every call, result and notification is a note in the run's report; a failing step (JSON-RPC error, timeout, a result marked `isError` unless `{allowError: true}`, the server exiting) quotes the server's last MCP message, so the failure bundle shows it. `mcpStop(srv)` is optional: a server the test leaves running is stopped when the test ends, passed or failed. `env` passed to `mcpStart` is named in the report, never its values. replaces: bun scripts next to the suite.
|
|
39
|
+
- 355f512: BREAKING: page code given to `evaluate`, `evaluateOnLocator` or `evaluateInServiceWorker` as a string is now parsed by the validator. A string that is not one JavaScript expression is refused before the run as `validator:page-code-syntax`, with the line and column inside the string, e.g. `evaluateOnLocator(locator('body'), '(b) => b.querySelectorAll("li").')`. Such a step used to fail only when the run reached it.
|
|
40
|
+
|
|
41
|
+
A string that parses gets an info, `validator:page-code-string`, with the rewrite to a function literal: a function in quotes loses the quotes, an expression becomes `() => …`. A function literal is checked with the file. Text built with `+` or held in a variable is not parsed.
|
|
42
|
+
|
|
43
|
+
Migration: fix the syntax the message points at, or write the page code as a function literal: `evaluateOnLocator(loc, (el) => el.textContent)`. A regular expression inside a backtick template is a common case: `\/` there reads as `/`, so `` `… /^a\/(b)/ …` `` reaches the page as an unterminated group — the step failed at run time already, now it is named before the run. Write `\\/` or use `` String.raw`…` ``. Set `validator:page-code-string` to `off` in `linter.rules` to silence the info.
|
|
44
|
+
|
|
45
|
+
- 10551d7: New: `setPageHidden(hidden, index?)` sends a tab to the background as the page's scripts see it, and brings it back. `setPageHidden(true)` makes `document.hidden` true and `visibilityState` `'hidden'`, `document.hasFocus()` false, and fires `blur` then `visibilitychange`; `setPageHidden(false)` fires `visibilitychange` then `focus`. The state holds across navigations and in frames until the tab is shown again. replaces: overriding `document.hidden` by hand in `evaluate`, or handing the check to a person.
|
|
46
|
+
|
|
47
|
+
It emulates visibility for the page's scripts in Chromium, Firefox and WebKit alike — no engine hides a tab of a headless browser. What the browser itself does to a background tab is not emulated: timers are not throttled, animation frames keep running, the page is not frozen, and a service worker's `clients.matchAll()` still reports it visible. `setPage` and `bringToFront` do not show a hidden tab.
|
|
48
|
+
|
|
49
|
+
- a081f17: New: `TestRuntimeManager.inspectState(id)` returns a runtime's snapshot without `vars` — state, last event, failure, result, rollback — and does not walk the scenario's variables. replaces: `inspect(id)` for callers that never read `vars`. Example: `manager.inspectState(id).lastResult`. `inspect(id)` is unchanged and still returns the whole snapshot. The runner's own polls now use it, so a paused or running test builds its variables once per tick instead of three times.
|
|
50
|
+
- c63e688: New: `selectOption(getByLabel('Folder'), {label: 'Archive'})` picks an option by its visible text, and `{index: 0}` by its position, next to the value forms (a string, `{value}`, or an array for a multi-select). replaces: evaluateOnLocator reading an option's value by its text. The call waits for the option; a label or index no option has fails naming the labels the element holds instead of a bare timeout. The validator now checks the value: a misspelt key such as `{lable}` is `validator:options`, before the run and during it, and a number is `validator:arg-kind`. The `explore_step` MCP tool takes the same forms for `select_option`.
|
|
51
|
+
- ceaf212: New: virtual machine steps over Tart — a scenario clones a ready image, boots it and reaches it by IP: `skip('no tart', !vmAvailable()); const vm = vmClone('clean-mac'); const ip = vmRun(vm);`. Each VM is named `unotest-<id>-<n>`, the id random per test, so parallel runs never meet; every VM the test cloned is stopped and deleted when it ends, passed or failed. `vmIp`, `vmStop` and `vmDelete` take only a name `vmClone` returned in the same test — other VMs on the machine are refused, never touched. A boot that fails errors `vmRun` at once with Tart's output instead of waiting out the timeout (default 180 s). Clone and boot are notes in the run's report. replaces: tart by hand.
|
|
52
|
+
- 9e742ac: New: terminal steps drive a real Terminal.app or iTerm2 window on macOS: real key events, the screen read as text, the window framed — `openTerminal('Terminal'); terminalType('my-cli'); terminalPress('Shift+Enter'); terminalWaitForText(/ready/)`. replaces: osascript and expect outside unotest.
|
|
53
|
+
|
|
54
|
+
`openTerminal(app, {host})` opens the window on this Mac, or on another Mac over ssh (`{host: 'admin@192.168.64.38'}`, a Tart VM) through a controller it starts in that Mac's logged-in session; the key comes from your ssh agent or `~/.ssh`. The steps: `openTerminal`, `setTerminal`, `closeTerminal`, `terminalType`, `terminalPress`, `terminalWaitForText`, `terminalAssertText`, `terminalResize`, `terminalScreenshot`. Each lands in the run report like a page step, and a failed test keeps the window's last frame, its screen text and its host in the failure bundle (`terminal.png`, `terminal.txt`, `terminal.json`). Every window a test opened is closed when it ends. A local run takes the keyboard while it types; keys are sent only while the terminal window is in front.
|
|
55
|
+
|
|
56
|
+
- 02e6384: New: `npx @unotest/web upgrade-hints` finds the places in `unotest/e2e/` that do by hand what a typed step does. replaces: reading `lint` info lines one file at a time. It prints the count per pattern, the step to write instead with its section in the DSL guide, and every file and line: a `pause` before checking that an element is absent (`assertNeverAppears`), a `pause` to let an animation settle (`waitForAnimations`) or a control become enabled (`waitFor {state: 'enabled'}`), `getComputedStyle` or `naturalWidth` in page code (`computedStyle`, `getImageSize`), and page code written as a string (a function literal). It shows these rows even when `linter.rules` turns their rule off; a line marked `// lint-ok` is not counted. The first run on a new version shows the counts once: `e2e` prints them, and the MCP `run_test` reply carries them as `upgradeHints` {state: "typed-steps-available", version, hints, next}.
|
|
57
|
+
- bff95c9: BREAKING: `waitForRequest` with a `ws://` or `wss://` mask is refused before the run as `validator:arg-kind`, and by the run, with `WebSockets are not requests: use waitForWebSocket`. A socket's upgrade is no request and the page's request events never see it, so such a wait used to spend its whole timeout and fail.
|
|
58
|
+
|
|
59
|
+
Migration: `waitForRequest('ws://…')` → `waitForWebSocket('ws://…')`.
|
|
60
|
+
|
|
61
|
+
- 52cf309: New: `waitForWebSocket(glob, {timeoutMs?}) → {url}` waits until the active page has opened a WebSocket whose URL matches the mask and returns its URL. A socket the page opened as it loaded counts, so the wait may come after it; a new document starts the list again. A timeout names the mask and the sockets the page did open. replaces: `waitForRequest` on a socket mask, which waited its whole timeout and never saw the socket.
|
|
62
|
+
|
|
63
|
+
Changed: `mockRoute` with a `ws://` or `wss://` mask runs as before and is named with a warning, since it has never had an effect. The reference no longer says a mask reaches WebSockets.
|
|
64
|
+
|
|
65
|
+
`@unotest/dsl`: `refuse` on an argument, strings of the right kind the slot still turns down by how they start, with a sentence and an error or warning level; `refusalMessage`, the text lint and the run give for one.
|
|
66
|
+
|
|
67
|
+
- 80ff1fa: New: `addVirtualAuthenticator()` gives the page a passkey with no person at a device: a virtual WebAuthn authenticator answers `navigator.credentials.create()` and `.get()`. `virtualCredentials(id)` lists what it holds, by base64url id, rpId and sign count, and `removeVirtualAuthenticator(id)` takes it off. replaces: signing in with a passkey by hand in your own browser. Chromium only; Firefox and WebKit fail the call naming the engine. New: `grantPermissions(['notifications'], {origin?})` grants browser permissions to the context; a name the engine does not know fails naming the engine, and earlier grants stay. `setOffline(true)` cuts the context off the network and `setOffline(false)` connects it again. replaces: nothing. Authenticators, permissions and offline are all undone when the context closes.
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- 85c9f78: New: `@unotest/dsl/validator` exports `chainReceiverIsArgument(contract)`: whether a chained call of a vocab method gets the receiver as its first argument. replaces: repeating the rule next to the validator. A chain step such as `filter` declares the receiver in its signature. A chainable builder such as `getByRole` keeps the arguments as written. The validator and tools that read a scenario line arguments up by this one rule.
|
|
72
|
+
- 6cd513a: Changed: `dsl_lookup` and `npx @unotest/web api` weigh each word of a query by how few functions hold it, so a rare word decides over common ones: "send the tab to the background and back" now finds `setPageHidden` first instead of `newPage`, `goBack` and `dragAndDrop`. A word that names an option key exactly (`hasNot`, `waitUntil`) counts for the functions that take it: "locator that contains a child element (has, hasNot)" finds `filter` and `locator`. New search words: `background`, `visibility` and `tab hidden` for `setPageHidden`, `faded in` for `waitForAnimations`.
|
|
73
|
+
- f136ad0: Fixed: the refusal of `new X(…)` names the constructors the library has — `new X(…) is not part of the scenario language — use new Map / new Set, the constructors the library has; for anything else …` — so `new Set([1])` running beside a refused `new Error('x')` reads as one rule. The DSL reference and the language page list the constructors from the library itself, and the check that keeps the editor typings fresh keeps that list fresh too.
|
|
74
|
+
- 8d7770d: Fixed: `validator:template-escape-changed` no longer warns on an escape already migrated. It now reports only a backslash escape JavaScript drops — `\s` reads as `s`, `\.` as `.` — the regex text a backtick template used to keep and now silently loses. `\\s`, `\n`, `A` and the other escapes JavaScript reads as meant stay quiet, so doubling the backslash clears the warning without `String.raw` or switching the rule off.
|
|
75
|
+
- 4dec5fc: Fixed: `openTerminal` on a freshly booted macOS VM no longer fails now and then with "Terminal.app cannot be opened … is someone logged in?". The VM answers ssh before its automatic login has made the GUI session; the step now waits for that session (up to 90 s) instead of a fixed 15 s for a single attempt. An image that logs no one in fails the step with what was waited for and how long.
|
|
76
|
+
|
|
77
|
+
Fixed: when `openTerminal(app, {host})` cannot log in to a VM with a key, the hint now gives the commands for the image the VM was cloned from (`tart run <image> &`, `ssh-copy-id admin@$(tart ip --wait 120 <image>)`, `tart stop <image>`) instead of an `ssh-copy-id` to the clone's address, which the run has already deleted, and says that `ssh-copy-id` asks for the image's password.
|
|
78
|
+
|
|
79
|
+
- 7770b39: Fixed: `terminalType` typed the letters of the Mac's current keyboard layout, so under a Russian or another non-US layout the terminal got different text (`clear` arrived as the Cyrillic letters on the same keys). Text now goes in as a paste, line by line with Return between the lines, and the clipboard is restored after. Each line must show on the screen within 2 s, or the step fails quoting the screen's last rows instead of typing on blind; `terminalType(password, {echo: false})` types input a program does not echo. `terminalPress` with a modifier (`Control+c`) presses that key of a US keyboard whatever the layout; a single character alone is pasted, and a character with a modifier but no US key of its own (`Control++`) is refused, naming the key to press (`Control+Shift+=`).
|
|
80
|
+
- bed0e59: Fixed: `openTerminal(app, {host})` on a VM whose image does not hold your ssh key failed with ssh's bare `Permission denied`. It now says that ssh could not log in with a key, and how to put the key in the image once (`ssh-copy-id admin@<ip>` on a booted clone, then stop it) or load it into the ssh agent. The DSL reference shows that one-time step under "Virtual machines": a clean Tart image takes a password only, and the run never passes one.
|
|
81
|
+
- 78ece21: Fixed: `throw new Error('x')` in a scenario is refused with the throw the language has — `throw 'x'` or `throw {message: 'x'}` — instead of the general `new X(…)` advice about object literals and regex literals, in `lint` and in the run alike.
|
|
82
|
+
- 5cfd9b1: Fixed: `lint:typed-step-available` reads page code written as a string too. `evaluate("getComputedStyle(document.body).color")` now gets the hint for `computedStyle(locator, property)` in the same pass as the `validator:page-code-string` info, instead of only after the string was rewritten as a function. Text that does not parse, or that is built at run time, is not read.
|
|
83
|
+
- b613552: New: `e2e` and `lint` in a project without `unotest/jsconfig.json` say once, in one line, to run `npx @unotest/web types`, which writes it so the editor completes the scenario functions. replaces: finding the `types` command on your own. A run still writes no jsconfig itself; the hint is not shown under CI or on a box (`UNOTEST_EDITOR_TYPES=0`), and the project's `.unotest/` remembers it was shown.
|
|
84
|
+
- 54fc118: Changed: the `waitUntil` reference and the Playwright migration guide say where state between tries lives. replaces: a counter declared at the top of the file, which never runs. A counter or the last value seen is a `let` inside the `test_` function or the step, and the body writes it; a top-level `let` is refused by the validator (`validator:unsupported-statement`) and the body then finds no such variable.
|
|
85
|
+
- Updated dependencies [6ea4085]
|
|
86
|
+
- Updated dependencies [ac8f70a]
|
|
87
|
+
- Updated dependencies [1c16eba]
|
|
88
|
+
- Updated dependencies [85c9f78]
|
|
89
|
+
- Updated dependencies [f136ad0]
|
|
90
|
+
- Updated dependencies [355f512]
|
|
91
|
+
- Updated dependencies [c63e688]
|
|
92
|
+
- Updated dependencies [8d7770d]
|
|
93
|
+
- Updated dependencies [78ece21]
|
|
94
|
+
- Updated dependencies [5cfd9b1]
|
|
95
|
+
- Updated dependencies [52cf309]
|
|
96
|
+
- @unotest/dsl@0.51.0
|
|
97
|
+
- @unotest/protocol@0.51.0
|
|
98
|
+
- @unotest/viewer@0.51.0
|
|
99
|
+
- @unotest/core@0.51.0
|
|
100
|
+
- @unotest/grounder-client@0.51.0
|
|
101
|
+
|
|
102
|
+
## [0.50.0] - 2026-10-14
|
|
103
|
+
|
|
104
|
+
### Minor Changes
|
|
105
|
+
|
|
106
|
+
- Breaking, added after the release: `apiCall` takes at most five arguments: method, path, body, headers and options. 0.49.2 dropped a sixth one without a word, so a call such as `apiCall('GET', '/status', null, {}, {base: 'API_BASE'}, {timeout: 120000})` ran as if the sixth were not there. 0.50.0 refuses it: `apiCall() takes at most 5 arguments, got 6 — remove the extra argument`, and the test ends errored.
|
|
107
|
+
|
|
108
|
+
Migration: remove the sixth argument. The call never read it, so it behaves as it did in 0.49.2. A per-call timeout for `apiCall` is a separate feature of a later release.
|
|
109
|
+
|
|
110
|
+
- Breaking, added after the release: a backslash escape in a backtick template now means what it means in JavaScript. Before 0.50.0 it was kept as written. The change is silent for page code: `` evaluateOnLocator(loc, `(el) => /\s+/.test(el.textContent)`) `` reaches the page as `/s+/`, the regex looks for the letter `s`, and the check gives a wrong answer with no error. The lint warning `template-escape-changed` marks every such template.
|
|
111
|
+
|
|
112
|
+
Migration: in a template, write a backslash meant for the page as `\\` (`/\\s+/`), or wrap the template in `String.raw` to keep the text as written. Better, pass the page code as a function, `evaluateOnLocator(loc, (el) => /\s+/.test(el.textContent))`: the validator reads it with the file and no escape is involved.
|
|
113
|
+
|
|
114
|
+
- e176cb4: Scenarios are read by the new JavaScript parser and run by the new interpreter: `run`, `e2e`, `lint`, `explore_run_flow`, the viewer's editor and the bundle checks all go through it.
|
|
115
|
+
|
|
116
|
+
`evaluate` and `evaluateOnLocator` take a function as the page code: `evaluate((n) => document.querySelectorAll('li').length > n, 3)`, `evaluateOnLocator(loc, (el) => el.dataset.state)`. The page gets the function as it is written, like Playwright's `fn.toString()`, so it sees none of the scenario's variables: values go in as the arguments after it. The string form works as before, and the advice of 0.49.2 to pass the function as a quoted string no longer applies. A function anywhere else in a host call is still refused.
|
|
117
|
+
|
|
118
|
+
`apiCall(…, {base: "API_BASE_X"})` reads `API_BASE_X` from the project's environment only (`unotest/.env`, `.secrets` and the active overlay). A scenario variable of that name is no longer read as the base. When the environment has no such variable, the call is refused and says where to put it.
|
|
119
|
+
|
|
120
|
+
`run_test` checks a scenario with the same diagnostics as `lint` before the browser starts, the vocabulary checks (`validator:*`) included, and answers any error with `lint_failed` before anything runs. Info-only diagnostics never hold a run back. What `e2e` stops on is told in its own entry.
|
|
121
|
+
|
|
122
|
+
Migration:
|
|
123
|
+
|
|
124
|
+
- A scenario that assigned the base URL itself (`API_BASE_X = "https://…"`) and passed `{base: "API_BASE_X"}`: put `API_BASE_X=https://…` in `unotest/.env`, or in the overlay of the environment that needs it.
|
|
125
|
+
- Code that imports the engine from `@unotest/web` directly: `lintAst` takes an ESTree node (`parsed.program`); `AstExecutor` runs a parsed scenario, `run(parsed, helpers, testName, runtime, options)`; the `node` of an `ExecutionEvent` is an ESTree node; `TestRuntimeManager.register` takes `scope`, the executor's `inspectScope`. Parse with `AcornScenarioParser` from `@unotest/dsl`.
|
|
126
|
+
- `@unotest/web/dsl`: `createWebDslLanguageService()` also has `validateParsed(parsed, context)`, the same diagnostics for a file already parsed.
|
|
127
|
+
- `lint:filter-unknown-option` and `lint:role-unknown-option` are deprecated and report nothing: `validator:options` reports a key that `filter`, `locator`, `getByRole` or any other call does not read, with the sentence the run refuses it with. `lint:regex-invalid` is deprecated too: a regex that does not compile is a syntax error of the file. The three ids still load from `linter.rules`; drop them from your config, they go away in the next major.
|
|
128
|
+
|
|
129
|
+
`@unotest/dsl` gains `walk` and `childNodes`, a walk over a scenario's ESTree in source order, `scenarioFromProgram(program, source, comments, file)`, a parsed scenario from a tree another parser built (an ESLint rule's `Program`), and the host hook `pageCodeArg(name)` that names the argument a function may be handed to as page code. `@unotest/core` reads a run's last event by its shape, so it takes the events of either executor.
|
|
130
|
+
|
|
131
|
+
- f83b1c5: The step budget now fits scenarios that work with large arrays, and still stops an endless loop quickly.
|
|
132
|
+
|
|
133
|
+
- A run allows 100,000 steps by default, up from 10,000. A step is a statement or a loop pass. An endless `while` or `for` stops with `maxSteps budget (100000) exhausted` within about 20 seconds.
|
|
134
|
+
- A call of an arrow function with an expression body spends no step. `items.map((x) => x.id)` or `rows.filter((r) => r.ok)` over an array of up to 1,000,000 elements runs to the end. Each call still checks the test's time (`setTestTimeout`, `testTimeoutMs`, `UNOTEST_MAX_DURATION_MS`), so a long run of callbacks is cut by it.
|
|
135
|
+
- An arrow function with a block body spends a step per call, as any statement does.
|
|
136
|
+
|
|
137
|
+
- 7f6d3d3: Breakpoints set in the viewer no longer dirty the work tree. The store moves from `unotest/.debugger.json` to `.unotest/debugger.json` (`.unotest/debugger-mobile.json` for mobile). `init` already lists `.unotest/` in `.gitignore`. The viewer, the CLI (`e2e --debug`) and the MCP `run_test` read and write the new file.
|
|
138
|
+
|
|
139
|
+
Migration: nothing to do by hand. The first viewer start or debug run moves an existing `unotest/.debugger.json` to the new place, keeping its breakpoints. If both files exist, the new one is used and the old one is left alone. Git then shows `unotest/.debugger.json` as deleted: commit the deletion.
|
|
140
|
+
|
|
141
|
+
`@unotest/protocol`: `debuggerFileFor(suffix)` returns the new path; `legacyDebuggerFileFor(suffix)` names the old one and `LOCAL_STATE_DIR` is `.unotest`. `@unotest/core`: `debuggerFile(projectRoot, suffix)` returns the store's absolute path and performs the move.
|
|
142
|
+
|
|
143
|
+
- 5f1e0a9: A test that spends its step or memory budget now ends as `errored ‼`, not `failed ✗`. A wrong value in an options slot now stops the run before the browser starts.
|
|
144
|
+
|
|
145
|
+
- `maxSteps budget (100000) exhausted` and `the run holds … MB more than at its start` count what the scenario itself did: its statements, the values it keeps. No slow application spends them, so the test is broken, not the application. They now count as errored in the `e2e` and `collection` summary. A spent time budget (`testTimeoutMs`, `setTestTimeout`, `UNOTEST_MAX_DURATION_MS`) is still `failed ✗`: a slow application spends it too. The exit code is 1 either way.
|
|
146
|
+
- A call that gives a non-object where options go, such as `assertUrl('/', 'oops')`, is now reported as `[validator:options]` instead of `[validator:arg-kind]`, and the run stops before it starts with `run stopped`, as it does for an unknown option key. Before, the run started and the test ended as errored on that line, after the steps before it had run. Other `arg-kind` findings still do not stop the run.
|
|
147
|
+
|
|
148
|
+
Migration: a CI step that counted a spent step budget as a failure now sees it as an error. A lint config that set the level of `validator:arg-kind` to quiet this finding should set `validator:options` instead.
|
|
149
|
+
|
|
150
|
+
`@unotest/dsl/executor`: `BudgetExhaustedError` is now an abstract base, and `instanceof` it still finds every spent budget. A spent step budget throws `StepBudgetExhaustedError`, a spent time budget throws `DurationBudgetExhaustedError`, which is the only one marked as a failed check (`isCheckFailure`). `MemoryBudgetExhaustedError` is no longer a failed check either.
|
|
151
|
+
|
|
152
|
+
- 9413745: `e2e` stops before the browser on the scenario errors the run would refuse anyway. It still prints every diagnostic of the pre-run lint, as `lint` does, and now refuses to start on a `validator:*` error the run cannot get past — an unknown function, JavaScript outside the scenario language, an option the call does not read (`click(loc, {forse: true})`), a `const` assigned again, a member a value does not have, a scenario variable read inside the function handed to `evaluate` (the page has no such variable) — on page code for `evaluate` built from scenario values (a `${…}` in it, or a string put together at run time), and on a rule the project raised to `error` in `linter.rules`. The two page-code checks — values spliced into page code, scenario variables read inside the function handed to the page — cover the helpers of `_helpers/` the run loads as well, and the line printed names the helper file; any other finding in a helper is left to `lint`. The refusal exits 1 after the line `run stopped: N error(s)`; no browser starts and nothing is written under `unotest/.runs/`. Errors of shape — `validator:arity`, `validator:step-shape`, a call outside `step(...)` — and `lint:*` errors at their default severity are printed and the run goes on, as before.
|
|
153
|
+
|
|
154
|
+
Migration: a suite with one of those errors used to start, run the steps before it and fail there; its CI now goes red before the run, without those side effects. Run `npx @unotest/web lint` to see the same list and fix the call. Setting the rule to `warn` in `linter.rules` lets the run start again, and it stops with an error where it did before.
|
|
155
|
+
|
|
156
|
+
`@unotest/dsl`: a `ScenarioDiagnostic` the run would refuse as well carries `failsRun: true`.
|
|
157
|
+
|
|
158
|
+
- eaa17ad: Four messages a new user meets on a first run now say what to do.
|
|
159
|
+
|
|
160
|
+
- A test's result line in the `e2e` and `collection` output starts with the run's own word: `failed ✗ test: …` for a failed check, `errored ‼ test: …` for a script that could not do what it was asked. Before, both started with `error`, and only the sign told them apart. The line still goes to stderr. A CI step that searched the output for `error ✗` or `error ‼` should search for `failed ✗` / `errored ‼` instead.
|
|
161
|
+
- `{timeout}` and `{timeoutMs}` are one option: `lint` now refuses a call that gives both, with the sentence the run already gave (`assertUrl: {timeout} and {timeoutMs} are the same option — give one of them.`), and `e2e` stops on it before the browser starts. A list of the keys a function takes names one key per option: `Usage: {timeoutMs?}` for `assertUrl('/', 'oops')`, where it used to suggest both keys with made-up values, a line that was then refused when copied.
|
|
162
|
+
- A run that spends its step budget says where and why: `maxSteps budget (100000) exhausted at unotest/e2e/first/endless.js:5 — the test ran 100000 statements and loop passes: a loop or a callback that never ends? The limit is fixed — make the loop end, or do less in one test (filter earlier, split the test).` A spent time budget names the setting that raises it: `testTimeoutMs` in `unotest.config`, `UNOTEST_MAX_DURATION_MS`, or `setTestTimeout(ms)` in the test.
|
|
163
|
+
- An unknown function that is a typo of one the scenario language has is named: `Unknown function: clik — did you mean click?`, in `lint` and in a run alike. A name more than two edits from any function gets no guess.
|
|
164
|
+
|
|
165
|
+
`@unotest/dsl`: an options argument kind may carry `same` (an older key to the name it stands for); `validator:options` refuses a call that gives both, and `optionKeysLabel`, `sameOptionPair` and `sameOptionMessage` are exported for a vocab's own guards. `BudgetExhaustedError` carries `at` (file and line) for a spent step budget, and its message says what to do.
|
|
166
|
+
|
|
167
|
+
- c5442cf: `collection`, `box runs` and `box run` now use the same signs and words as `e2e` and the viewer: `✗ failed` for a check that did not hold, `‼ errored` for a script that could not do what it was asked, and `■ aborted` for a run that was stopped.
|
|
168
|
+
|
|
169
|
+
What changes in the output. Update a CI step that searches the log for any of these:
|
|
170
|
+
|
|
171
|
+
- An errored scenario or test in a collection prints `‼ scenario: … — errored` and is labelled `errored`. Before, it printed `✗ … — failed`.
|
|
172
|
+
- A stopped or interrupted scenario prints `■ … — aborted` / `■ … — interrupted`. Before, it was marked `‼`.
|
|
173
|
+
- The collection summary names the errored part of the failures: `pass=1, fail=3 (2 errored)`. `fail=` itself has not changed: it still counts every scenario that did not hold, errored ones included, so a check for `fail=0` reads the run as before. A collection with errored scenarios still fails and exits 1.
|
|
174
|
+
- In a file of several tests, the file's line counts each kind, for example `✗ scenario: shop (900ms) — 1 of 3 failed, 1 errored`. If none of its tests failed, the line starts with `‼` and reads `1 of 3 errored`.
|
|
175
|
+
- `box runs` and `box runs --latest` show `‼ errored`, `■ aborted` and `✓ failed on purpose` (a test marked `@expect-fail`) in their status column. Before, all three were shown as `✗` with the stored status. `box run` names the same word in brackets, for example `‼ checkout (errored)`.
|
|
176
|
+
|
|
177
|
+
`box run --follow` still prints an errored scenario as `✗ … — failed` until the box itself reports errored runs.
|
|
178
|
+
|
|
179
|
+
- 5c9d2d5: `validator:if-shape` checks the condition of `while`, `do...while`, `for` and the `?:` operator as it checks `if`: a condition known to be a number, a string or an array (`while ("x")`, `for (;5;)`) is a lint error. The message names the statement: `while() condition must be a boolean expression`. `run_test` does not start a scenario with a lint error, so such a scenario no longer runs there. What to do: write the comparison you mean, `while (items.length > 0)`.
|
|
180
|
+
- 7d6d1aa: Editor typings now match the scenario language exactly. The `unotest/jsconfig.json` that `init` writes sets `noLib: true` and adds a new declaration file, `types/unotest-lib.d.ts`: the scenario library (`Math`, `JSON`, `Object`, `Map`, `Set`, string, number and array methods) cut from TypeScript's own declarations. The editor completes what a scenario has and no longer offers `Date`, `setTimeout`, `document` or `s.big()`, which lint refuses. What to do: an existing project runs `npx @unotest/web types` once. A jsconfig written by an earlier `init` and left untouched is brought up to date; `lint` and runs print a one-line reminder until then. A jsconfig you edited by hand is never rewritten: the reminder says to set `"noLib": true` and add `./node_modules/@unotest/web/types/unotest-lib.d.ts` to `include`.
|
|
181
|
+
- 70ef8a0: A DSL function no longer drops an extra argument (#428). Before, the run ignored it: `assertEqual(1 + 1, 2, 'math works')` was flagged by `lint` (`validator:arity`), yet `e2e` ran the test and passed it; a call whose arguments come from a spread, such as `note('n', ...values)`, was not flagged at all. Either call now fails its step before the function runs: `assertEqual() takes at most 2 arguments, got 3 — remove the extra argument`, and the test ends errored. Functions that take any number of arguments (`log`, `evaluate`, `shell`, `dbQuery` and the like) are unchanged.
|
|
182
|
+
|
|
183
|
+
Migration: a suite whose CI runs `e2e` without `lint`, and that has a call with an extra argument, passed before and now goes red on that test. Run `npx @unotest/web lint` — every such call written out is listed under `validator:arity` — and remove the extra argument, or pass the values as one array.
|
|
184
|
+
|
|
185
|
+
`goBack`, `goForward`, `selectOption` and `dragAndDrop` take their options in lint too. The calls always read `{timeoutMs}` and the browser's own keys, as the DSL reference says, but lint called `goBack({timeoutMs: 5000})` an extra argument. Lint now accepts these options and names a misspelled key, as it does for `click`.
|
|
186
|
+
|
|
187
|
+
A DSL function called with a huge spread now fails with a message that names it. `log(...rows)` with some 200,000 elements used to end the test with `Maximum call stack size exceeded` and no function named. One call of a DSL function now takes at most 10,000 arguments: `log() was given 200000 arguments; a DSL function takes at most 10000 — pass an array`. What to do: pass the array itself, `log(rows)`.
|
|
188
|
+
|
|
189
|
+
- d3c62fa: A scenario can no longer reach the library's internals through `Math`, `JSON`, `Object` or `Array`. `Object.keys(Math)`, `Object.entries(Math)`, `Object.assign(Math, …)`, `Object.hasOwn(JSON, …)`, `Array.from(Math)` and `for (k in Math)` are refused with "got a namespace such as Math". A DSL function refuses one among its arguments (`note('m', Math)`). `JSON.stringify(Math)` writes `{}`, as JavaScript does. Before, a write through `Object.entries(Math)` broke `Math` for every later test of the same process. `typeof Math` is still `"object"`, and every member works as before.
|
|
190
|
+
- 1c17d91: A scenario can no longer take the runner down by building a huge string or array. `'x'.repeat(1e9)`, `padStart(1e9)` or `Array.from({ length: 1e9 })` used to exhaust the runner's memory and end the run with no reason given; a string doubled in a loop (`s = s + s`) did the same in about thirty passes. Strings are now bounded at 10,000,000 characters and arrays at 1,000,000 elements: `repeat`, `padStart` / `padEnd`, `replace` / `replaceAll`, `join`, `String(array)`, `JSON.stringify`, `String.raw`, `Array.from`, `concat`, `flat`, `flatMap`, `+`, `+=` and template literals fail with a `RangeError` that names the call, the size it asked for and the bound, before the value is made. For a larger payload, use a file fixture.
|
|
191
|
+
|
|
192
|
+
This is a behaviour change: a scenario that built a string of more than 10,000,000 characters, which used to pass while it fit in memory, now fails with that `RangeError`.
|
|
193
|
+
|
|
194
|
+
A spread now reaches the array bound: `[...items]`, `push(...items)`, `Math.max(...items)` or a scenario function called with `...items` used to fail at about 120,000 elements with `Maximum call stack size exceeded`; a spread of up to 1,000,000 elements now works.
|
|
195
|
+
|
|
196
|
+
- 99678b8: Every DSL call that takes an options object checks its keys. A key the call does not read is refused, by `lint` before the run and by the call itself during it, with the same sentence: `click: unknown option "forse" — supported: {timeout?, force?, …}.` The value of a known key is checked too: `{timeout: "soon"}` is a lint error.
|
|
197
|
+
|
|
198
|
+
Migration: a few keys used to be accepted and silently dropped, and are now refused.
|
|
199
|
+
|
|
200
|
+
- `doubleClick` no longer takes `button` or `clickCount`: they never reached the browser.
|
|
201
|
+
- `waitForText` no longer takes `first`: the wait always looks at the first visible match.
|
|
202
|
+
- `waitForNavigation` no longer takes `waitUntil`: it waits for the navigation the page starts.
|
|
203
|
+
- `scrollIntoView` takes no options object: it never read one.
|
|
204
|
+
|
|
205
|
+
Remove the key; the call behaves as it did. The other calls refuse only keys they never read: `getByText`, `getByLabel`, `getByPlaceholder`, `getByAltText`, `getByTitle` (they read `exact`), `screenshot` (`fullPage`), `setCookie` (`domain`, `path`, `expires`, `httpOnly`, `secure`, `sameSite`) and `apiCall` (`base`).
|
|
206
|
+
|
|
207
|
+
In the scenario type declarations an options parameter is `Record<string, unknown>` instead of `any`.
|
|
208
|
+
|
|
209
|
+
`note(label)` without a value is an arity error in `lint`.
|
|
210
|
+
|
|
211
|
+
`@unotest/dsl` gains `validateScenario`, the validator over the new scenario parser. It reports the old rules with their ids and texts, and adds `out-of-language` (JavaScript the scenario language leaves out, with what to write instead), `implicit-declaration` (an info: a variable assigned without `let` / `const`), `evaluate-interpolation` (`${…}` in code handed to the page) and `template-escape-changed` (a backslash escape in a backtick template now reads as in JavaScript). An options slot in a function contract is the new argument kind `{options: {key: kind}}`.
|
|
212
|
+
|
|
213
|
+
- 1e15351: Page code built from scenario values is refused wherever the run would load it, not only in the test's own file. `e2e`, `run_test` and `explore_run_flow` now check the helpers of `_helpers/` for it before anything runs: `evaluate('1 + ' + t)` or `evaluate(() => document.title + t)` inside a helper stops the run, and the diagnostic carries the helper's `file` (the CLI prints `unotest/e2e/_helpers/h.js:2:10`). `explore_run_flow` runs the same pre-run lint as `run_test` before it replays a flow, and answers with the list of errors instead of replaying. Only the page-code rules are checked in helpers: a helper's other findings stay with `lint`, so a run that passes today does not stop on them.
|
|
214
|
+
|
|
215
|
+
`evaluateInServiceWorker` takes a function as well as a string, as `evaluate` does — `evaluateInServiceWorker((t) => chrome.storage.local.set({t}), 'dark')` — under the same page-code rules.
|
|
216
|
+
|
|
217
|
+
What to do if a run now stops on a helper: pass the value to the page as an argument, `evaluate((v) => 1 + v, t)`, and keep the code itself fixed text or a function that reads only its own parameters. `npx @unotest/web lint` shows the same lines.
|
|
218
|
+
|
|
219
|
+
`@unotest/dsl`: a `ScenarioDiagnostic` whose finding the run refuses in any file it loads, helpers included, carries `harmsRun: true`.
|
|
220
|
+
|
|
221
|
+
- 7eed455: `validator:evaluate-interpolation` now judges the code handed to `evaluate` / `evaluateOnLocator` / `evaluateInServiceWorker` by where it comes from, not only by a `${...}` written in the call. A string built at run time (`evaluate('1 + ' + x)`, a variable that is ever given text read off the page, an external variable) is refused by `lint` and before the run starts, because a value in it would become code of the page. Text the source spells out passes: a string literal, a template without `${...}`, `+` of those, or a variable every assignment of which is one — declared with `let` or `const`, or assigned without a declaration (`` js = `...`; evaluate(js) ``), or the variable of a `for…of` over an array literal of such texts (`for (const js of ['document.title', 'document.URL']) evaluate(js)`). What to do with a refused call: write the page code as a function and pass values as arguments, `evaluate((n) => n + 1, x)`.
|
|
222
|
+
- 91ede7d: `Math.random()` is part of the scenario language: each call draws a new number in [0, 1), as in JavaScript. A run that uses it is no longer the same run twice; for fresh test data `randomWord(n)` and `randomEmail()` still read better.
|
|
223
|
+
|
|
224
|
+
`new Map(entries?)` and `new Set(items?)` are part of the scenario language, with their members as in JavaScript: `get`, `set`, `add`, `has`, `delete`, `clear`, `size` and `forEach`. `keys()`, `values()` and `entries()` return arrays, so `m.keys().map(...)` works directly; `for...of`, a spread and `Array.from` iterate a Map or a Set as in JavaScript. In `note`, `log` and the viewer's Vars a Map reads as `Map(1) {"a" => 1}` instead of `{}`. The validator names a member a Map or a Set does not have (`m.length` is `m.size`), and the editor typings declare the array results. `new` stays out of the language for anything else, including a `Map` the scenario declares itself; `WeakMap`, `WeakSet` and `WeakRef` remain refused.
|
|
225
|
+
|
|
226
|
+
- 303b935: A test that keeps too much in memory now ends as errored with the reason, instead of taking the runner down.
|
|
227
|
+
|
|
228
|
+
- A run may grow the heap by at most 512 MB over the heap at its start, and never by more than half the heap's limit. Past it the test ends as `errored ‼` with `the run holds 530 MB more than at its start; the limit is 512 MB`, followed by what to do: keep fewer large values alive at once, or use a file fixture or read the data in parts. This holds for `e2e`, `run_test` and `explore_run_flow`. Before, a statement such as `Array.from({length: 1000000}).map(() => 'y'.repeat(10000))` filled the runner's memory until the process was killed, with no word about why. On a box, the run's container was killed.
|
|
229
|
+
- The size is what the run holds, not what it has dropped: past the limit, the runner collects garbage and reads the heap again, and the test ends only if it still holds more. A run that makes a gigabyte of strings and keeps only their lengths passes. The start of each run is measured after a collection as well.
|
|
230
|
+
- The memory is checked together with the test's time: on every statement, loop pass and callback. Like the other budgets, it cannot be caught with `try`/`catch`. Each run is measured from its own start, so an explore session does not carry memory over from one flow to the next.
|
|
231
|
+
- `split`, `match` with a global pattern, `matchAll`, `Array.from`, `Object.keys`, `Object.values` and `Object.entries` of a string, and the arrays `JSON.parse` makes now respect the 1,000,000-element array bound. Past it they fail with a `RangeError` such as `.split() would make an array of more than 1000000 elements; the limit is 1000000`. Before, `'ab'.repeat(5000000).split('')` made an array of 10,000,000 elements, `Object.entries` of a 10,000,000-character string took 1.5 GB in one call, `Array.from` of one made an array of 10,000,000, and `JSON.parse` of a text within the string bound made an array of 5,000,000. `Array.from` makes one element per character of a string, an emoji included. `JSON.parse` checks its arrays after parsing, so it still takes text nested as deeply as before.
|
|
232
|
+
|
|
233
|
+
Migration: a scenario that split or matched a text into more than 1,000,000 parts, or parsed JSON with an array of more than 1,000,000 elements, now fails. Pass `split` a limit, or read the text or the data in parts.
|
|
234
|
+
|
|
235
|
+
`@unotest/dsl/executor`: `RunOptions` gains an optional `memory`, a `MemoryProbe` (`heapUsedBytes()`, `heapLimitBytes()`, and an optional `collectGarbage()`; without it the size is read as it stands and the message says it may count garbage). Without it, a run's memory is not read. The package also exports `MemoryBudgetExhaustedError` and `MAX_RUN_HEAP_GROWTH_BYTES`.
|
|
236
|
+
|
|
237
|
+
- ca28445: A scenario no longer reads the runner's own credentials, and a `shell()` step's process no longer inherits them. A bare identifier still resolves against the whole environment, so `BASE_URL` or a token a CI job exports reads as before. The names kept to the runner: `UNOTEST_JUDGE_TOKEN`, `UNOTEST_JUDGE_ACCESS_TOKEN`, `UNOTEST_CLOUD_TOKEN`, `UNOTEST_BOX_TOKEN`, `UNOTEST_BOX_READ_TOKEN`, the grounder's `UNOTEST_GROUNDER_REMOTE_TOKEN`, `_PROVIDER_KEY`, `_PICKER_KEY`, `_EMBED_KEY`, `_SHARED_TOKEN`, `_METRICS_TOKEN` and `_REVOCATIONS_TOKEN`, and the judge provider's API key (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or `GEMINI_API_KEY`), the last only while `UNOTEST_JUDGE_MODE=local` and only for the active provider.
|
|
238
|
+
|
|
239
|
+
Reading one is refused with whose it is, for example `ANTHROPIC_API_KEY is the judge's credential (UNOTEST_JUDGE_MODE=local) on this runner, not a scenario variable`, rather than "not found". The check a run makes before the browser starts, `{{NAME}}` in `explore_step` and `sandbox.exportSecrets` give the same sentence.
|
|
240
|
+
|
|
241
|
+
`@unotest/protocol` exports `JUDGE_API_KEY_ENV` and `judgeSecretEnvNames(env)`. `@unotest/grounder-client` exports `GROUNDER_SECRET_ENV` and `GROUNDER_SECRET_ENV_NAMES`.
|
|
242
|
+
|
|
243
|
+
Migration:
|
|
244
|
+
|
|
245
|
+
- A scenario or a `shell()` command that read one of these names on purpose: give the value its own name in `unotest/.secrets` (`APP_ANTHROPIC_API_KEY=…`) and read that. With a remote judge, or a judge on another provider, a vendor API key is the application's and reads as before.
|
|
246
|
+
|
|
247
|
+
- 2d1a70b: A run is now counted `failed` or `errored` by the class of its error, not by the words in its message. A failed check is `failed`; a script that could not do what it was asked is `errored`. What changes in the count:
|
|
248
|
+
|
|
249
|
+
- An action on a locator that matches several elements is `failed`, and the message names the locator as the scenario wrote it: `click: getByRole("button", {name: "Edit"}) matches 30 elements, and an action needs exactly one. Narrow it to the one you mean: a name, a parent locator, or .first() / .nth(i).` It used to be `errored`, with the browser library's "strict mode violation" text.
|
|
250
|
+
- A test that runs out of its budget (`setTestTimeout`, `testTimeoutMs`, `UNOTEST_MAX_DURATION_MS`) is `failed`. It used to be `errored`.
|
|
251
|
+
- A stale or unresolvable element reference is `failed`. It used to be `errored`.
|
|
252
|
+
- A shell command that runs out of time is `errored`, like any other shell command that does not finish. It used to be `failed`.
|
|
253
|
+
- A wrong call of the script (a missing file, a path outside the project, two names of one option) stays `errored`, and `// @expect-fail` does not excuse it: the marker expects a failed check.
|
|
254
|
+
|
|
255
|
+
`@unotest/dsl`: `ExecutionError.checkFailure` carries the error's kind across the executor, with the `CheckFailure` interface and the `isCheckFailure` guard for error classes of a host vocabulary.
|
|
256
|
+
|
|
257
|
+
- accf0d6: The viewer now shows an errored run as errored, the way the CLI counts it, instead of as failed. A failed check is `failed`; a script that could not do what it was asked — a wrong call, a browser that went away, a command that did not finish — is `errored`.
|
|
258
|
+
|
|
259
|
+
- Home has an `errored` card and legend entry. An errored tile carries the `‼` sign as well as its own colour. The headline uses the CLI's words: `1 failed · 1 errored.`
|
|
260
|
+
- Failing now, the run history, the run's tab and the Runs badge draw an errored test with `‼`. It still counts as broken now.
|
|
261
|
+
- On an errored run's tab, the step it broke on, its block, the progress bar and the error card take the errored sign and colour.
|
|
262
|
+
- A run that failed on purpose is purple in the run history too, as it is on Home: one run, one colour everywhere.
|
|
263
|
+
- The red of a failed check is darker in light theme and lighter in dark theme, so its text badge meets WCAG AA contrast.
|
|
264
|
+
- A file of several tests reads as errored only when none of its tests failed a check.
|
|
265
|
+
|
|
266
|
+
`@unotest/protocol`: `run:finished`, `file-run:test-finished` and `collection-run:scenario-finished` carry `errored: true`, and `RunMeta` carries `errored`. The outcome stays `failed`, so a reader that predates the field still sees a failed run. The run index schema is now version 5 (`lastErrored`, `recentErrored`). An older index is rebuilt on first read.
|
|
267
|
+
|
|
268
|
+
- decec09: The viewer reads a scenario the way the engine runs it. Its step tree shows `try` / `catch` / `finally` and `switch` as control rows: the header row carries its own status, and `catch (e)`, `finally` and each `case …:` open a branch beneath it, as `else` does for `if`. A bare `{ … }` block, an empty statement and a nested function are no rows of their own; their statements are. A body written without braces (`if (i > 7) break;`) belongs to its header's row, as the run reports it, and a `do … while` row shows its condition. A finished step whose `else`, `catch` or other `case` never ran reads passed, not running. `await step(…)` in an `async` test is a step block like any other. A literal step tag (`{tag: 'q1'}`) shows as its text before the run; an expression tag shows as written. Scenario discovery and helper completion in the viewer read the full language: a test file with top-level `const`, `async` tests, `try` or `switch` lists its tests, and a helper with a default, rest or destructured parameter offers one placeholder per parameter.
|
|
269
|
+
|
|
270
|
+
The editor typings declare `teardown(label, body)`, `waitUntil(condition, options?)`, `Array.prototype.sortBy` and the array methods the scenario language has beyond ES2022 (`findLast`, `findLastIndex`, `toReversed`, `toSorted`, `toSpliced`, `with`), so the editor no longer marks them unknown.
|
|
271
|
+
|
|
272
|
+
The ESLint rule `@unotest/dsl` checks the tree ESLint already parsed instead of parsing the file a second time, with the same diagnostics as `unotest-web lint`. A file that defines one function twice gets the parse diagnostic `lint` prints rather than an exception out of ESLint, and the rule runs under ESLint's `RuleTester`. `@unotest/web/dsl` exports what such a frontend needs: `scenarioFromProgram`, `ProgramComment`, `ScenarioSyntaxError` and `parseDiagnostic(error)`, the diagnostic `lint` reports for a file that does not parse.
|
|
273
|
+
|
|
274
|
+
The function handed to `evaluate` / `evaluateOnLocator` is code of the page, and `lint` no longer checks it as the scenario: `document`, `getComputedStyle(el)`, `new RegExp(re)` or an upper-case page global in it are not refused. What `lint` does check there is new, `validator:page-code-closure` (error): a variable of the scenario read inside that function, which the page does not see — pass it as an argument, `evaluate((n) => …, n)`.
|
|
275
|
+
|
|
276
|
+
### Patch Changes
|
|
277
|
+
|
|
278
|
+
- d858002: A failed `assertText`, `assertTexts`, `assertAttribute` or `assertValue` now writes the characters a reader cannot see as escapes in its message. A page that joins an amount with a non-breaking space used to fail with `expected equal "S/ 500", got "S/ 500"` — two lines that look the same. The message now reads `got "S/\u00A0500"`. The same goes for other unusual spaces and for zero-width and format characters (`\u200B`, `\uFEFF`, a soft hyphen). The comparison itself is unchanged.
|
|
279
|
+
- bbbc482: A debug run that paused on a failed check and was continued now ends as `1 failed`, as the check did. It used to end as `1 errored`, the count reserved for a run that broke rather than a check that did not hold.
|
|
280
|
+
- 7cf7554: The type declarations of `@unotest/web/config` are the same in every build. Union members such as the retry reasons (`"transient" | "network" | "crash"`) are printed in the order the schema declares them; before, a rebuild of the same version could print them in another order. The types themselves do not change.
|
|
281
|
+
- e1a0db1: A DSL warning is now an ESLint warning, not an error. `@unotest/dsl` reports the engine's errors, and the new rule `@unotest/dsl-warning` reports its warnings. `recommended()` sets them to `error` and `warn`. A suite with only warnings (`lint:pause-explicit`, say) no longer fails `npx eslint`. The file is still validated once.
|
|
282
|
+
|
|
283
|
+
Migration: with `recommended()` there is nothing to do. A config that names `@unotest/dsl` by hand reports errors only until it adds `"@unotest/dsl-warning": "warn"`. To keep warnings failing the build, set `"@unotest/dsl-warning": "error"`.
|
|
284
|
+
|
|
285
|
+
- ab05878: A run that refuses a `function*` declared inside a `step(...)` names that step in its failure line (`in step "…"`), as it does for any other failed statement. The refusal is now a failed statement of its own, at the declaration: the viewer lists it under the step, and a debug run pauses on it. It still comes before anything else in the block runs.
|
|
286
|
+
- c35ccb6: `lint` reports a function that a scenario and a helper in `_helpers/` both define, with the same words the run refuses it in: `✗ error [load] duplicate function "name" — first defined at …, also at …`. Before, `lint` passed such a scenario and only the run stopped on it. A clash between two helpers is reported at each of the two helper files.
|
|
287
|
+
- ba95590: Large variables no longer slow a run down. The live view of a run (the viewer's Vars, `inspect_runtime`) shows the first 4 KB of each variable and is refreshed every 50 ms. It used to read each value whole and then cut it, so a loop that kept adding to an array paid for everything the array held, again and again. A scenario that kept 200 strings of 1 MB took more than a minute instead of under a second, and one that kept 1 GB ran out of time instead of stopping at the memory limit. Each refresh now reads only what it shows, so a value of any size costs the same.
|
|
288
|
+
|
|
289
|
+
A run paused by the debugger with a variable that is `undefined` sent its pause without any variables. It now sends the others and leaves that one out, as the live view does.
|
|
290
|
+
|
|
291
|
+
`@unotest/core` exports `cappedJson(value, minBytes, replacer?)`: the text of `JSON.stringify`, or a prefix of it longer than `minBytes` bytes, read only that far. It also exports `serializeVars`. The `stringifyVar` hook of `buildRuntimeInspection` gets the byte count as its second argument, and may return `undefined` for a variable with no JSON. `snapshotOf` in `@unotest/dsl/value` takes an optional `maxNodes`, the most values it reads. It is unlimited by default.
|
|
292
|
+
|
|
293
|
+
- 385cbe0: After a failed run, the viewer's Vars tab shows the variables in scope where the run failed, including the `let` and `const` declared inside the failing `step(...)`. Before, it showed the scope after the step's block had closed: an empty tab when the run ended there, the scope the run went on to after Continue from a failure pause, or a teardown's own scope once the rollback blocks had run.
|
|
294
|
+
|
|
295
|
+
`@unotest/dsl`: `ScenarioInterpreter.inspectScope()` answers for a finished failed run with the scope taken at its failure, and for the entry's run again once `runTeardowns` is over.
|
|
296
|
+
|
|
297
|
+
- ff7bdae: Viewer fixes:
|
|
298
|
+
|
|
299
|
+
- **Run again tab.** After Run again on an errored or `// @expect-fail` test, the new run's tab now shows the same mark as its history row (`‼` for errored, the expected colour for an expected failure). Before, it showed a plain red dot until the page was reloaded.
|
|
300
|
+
- **History after overlapping loads.** The run history no longer goes back to an older list when an earlier refresh answers after a later one.
|
|
301
|
+
- **One-line callbacks.** In the Steps and Trace tabs, a callback written on one line, such as `items.forEach((k) => { seen.add(k); });`, now opens into rows that show its own statement (`seen.add(k);`). Before, each row repeated the whole line. Runs recorded by earlier versions still show the whole line in the Trace tab.
|
|
302
|
+
- **Error card badge.** The badge on a failed step now says what kind of failure it is, in the words the CLI uses: `failed check` when a check did not hold, `script error` when the script could not do what it was asked. The error's class name, such as `NullMemberError`, now appears on hover. Before, the badge showed only the class name.
|
|
303
|
+
|
|
304
|
+
`@unotest/protocol`: `step:started` gains optional `endLine` and `endCol`, the end of the statement. `endCol` is the 1-based column just past its last character.
|
|
305
|
+
|
|
306
|
+
- fe8540b: Viewer: a statement that hands a function to a call, such as `xs.forEach((x) => { ... })`, now opens into the statements of that function, as an `if` does. Each of them shows its status and notes and takes a breakpoint. Page code passed to `evaluate` / `evaluateOnLocator` stays closed: the page runs it, not the scenario. The DSL vocabulary entries carry `pageCodeArg` for that, and `@unotest/dsl` exports `calleeName`.
|
|
307
|
+
- 9b834c7: The viewer's history counts a collection the way the CLI does. Errored tests are part of failed and marked apart, tests that failed on purpose are not failed at all: a run the CLI reports as `pass=1, fail=2 (1 errored), expected=1` reads `1 ✓ 2 ✗ (1 ‼)` in the row with the failed-on-purpose count beside its purple dot, and `1 passed, 2 failed (1 errored), 1 failed on purpose` to a screen reader. An `@expect-fail` test that passed counts as failed, as everywhere else.
|
|
308
|
+
|
|
309
|
+
The viewer's Vars tab shows a `Map` and a `Set` as what they are: the type with its size, and a Map's entries as key → value or a Set's values, one per row. They used to arrive as a quoted string of type `string`. A Map or a Set inside an object, an array or another Map is drawn the same way, at any depth. What an agent reads through the tools is unchanged: `inspect_runtime`, `step` and `run_test` print each variable byte for byte as before. The run's `runtime.json` and the `paused` events of its journal carry a Map or a Set in the tagged form below. Two values read differently there than before: a locator inside a Map or a Set prints as its description (`<Locator …>`), and a value cut at the 4 KB cap is cut in its tagged form.
|
|
310
|
+
|
|
311
|
+
`@unotest/dsl` gains the entry `@unotest/dsl/value`: a scenario value in the form a run snapshot carries it (`snapshotOf`; a Map or a Set as `{"$type": "Map", "entries": […]}` / `{"$type": "Set", "values": […]}`, a scenario object with its own `$type` key wrapped as `{"$type": "Object", "value": {…}}`), as one line of text (`snapshotText`), and in the form written before the tags (`untagged`). The entry carries no parser.
|
|
312
|
+
|
|
313
|
+
- 0ceae40: Viewer: a run tab opened as the run starts (Run, Run again, R in the tree) now shows how it ended without a reload. The failed step opens with its error card, and Vars shows the final values instead of "no vars in scope yet". A step you open or close by hand keeps your choice.
|
|
314
|
+
- Updated dependencies [e176cb4]
|
|
315
|
+
- Updated dependencies [f83b1c5]
|
|
316
|
+
- Updated dependencies [7f6d3d3]
|
|
317
|
+
- Updated dependencies [5f1e0a9]
|
|
318
|
+
- Updated dependencies [9413745]
|
|
319
|
+
- Updated dependencies [eaa17ad]
|
|
320
|
+
- Updated dependencies [5c9d2d5]
|
|
321
|
+
- Updated dependencies [c95868e]
|
|
322
|
+
- Updated dependencies [24c7e15]
|
|
323
|
+
- Updated dependencies [ab05878]
|
|
324
|
+
- Updated dependencies [70ef8a0]
|
|
325
|
+
- Updated dependencies [b9907eb]
|
|
326
|
+
- Updated dependencies [d3c62fa]
|
|
327
|
+
- Updated dependencies [1c17d91]
|
|
328
|
+
- Updated dependencies [ba95590]
|
|
329
|
+
- Updated dependencies [99678b8]
|
|
330
|
+
- Updated dependencies [1e15351]
|
|
331
|
+
- Updated dependencies [7eed455]
|
|
332
|
+
- Updated dependencies [91ede7d]
|
|
333
|
+
- Updated dependencies [303b935]
|
|
334
|
+
- Updated dependencies [ca28445]
|
|
335
|
+
- Updated dependencies [2d1a70b]
|
|
336
|
+
- Updated dependencies [385cbe0]
|
|
337
|
+
- Updated dependencies [ff7bdae]
|
|
338
|
+
- Updated dependencies [fe8540b]
|
|
339
|
+
- Updated dependencies [9b834c7]
|
|
340
|
+
- Updated dependencies [accf0d6]
|
|
341
|
+
- Updated dependencies [decec09]
|
|
342
|
+
- Updated dependencies [0ceae40]
|
|
343
|
+
- @unotest/dsl@0.50.0
|
|
344
|
+
- @unotest/core@0.50.0
|
|
345
|
+
- @unotest/viewer@0.50.0
|
|
346
|
+
- @unotest/protocol@0.50.0
|
|
347
|
+
- @unotest/grounder-client@0.50.0
|
|
348
|
+
|
|
3
349
|
## [0.49.2] - 2026-10-12
|
|
4
350
|
|
|
5
351
|
### Patch Changes
|
|
@@ -1865,7 +2211,7 @@ picker on` fetches this project's own access and writes the three grounder
|
|
|
1865
2211
|
|
|
1866
2212
|
That screen named one command:
|
|
1867
2213
|
|
|
1868
|
-
|
|
2214
|
+
npx @unotest/web bundle push --run --env ENVIRONMENT
|
|
1869
2215
|
|
|
1870
2216
|
In a project that has just been created, the command refuses with `no box
|
|
1871
2217
|
address` before it does anything: the project holds neither the box's address
|
|
@@ -1874,8 +2220,8 @@ address` before it does anything: the project holds neither the box's address
|
|
|
1874
2220
|
|
|
1875
2221
|
The screen now names both steps, in the order they have to happen:
|
|
1876
2222
|
|
|
1877
|
-
|
|
1878
|
-
|
|
2223
|
+
npx @unotest/web box access larch
|
|
2224
|
+
npx @unotest/web bundle push --run --env ENVIRONMENT
|
|
1879
2225
|
|
|
1880
2226
|
The box's own name is filled in when its licence carries one. `box access`
|
|
1881
2227
|
with no name refuses, and its refusal offers to create a box — to somebody who
|
package/README.md
CHANGED
|
@@ -12,6 +12,31 @@ Full documentation — manuals, the box, CI, the judge — lives at
|
|
|
12
12
|
tour; the package ships only `guides/dsl-reference.md` and
|
|
13
13
|
`guides/agent-integration.md` alongside it.
|
|
14
14
|
|
|
15
|
+
<!-- generated:api-index — generated from the DSL vocabulary (pnpm build:api-index), do not edit -->
|
|
16
|
+
## What unotest can do
|
|
17
|
+
|
|
18
|
+
Scenarios are JavaScript calling these functions. `npx @unotest/web api <word>`
|
|
19
|
+
prints one line per function — signature, options, the release that added it,
|
|
20
|
+
when you need it — and finds it by the habit you know: `api sleep`,
|
|
21
|
+
`api clipboard`, `api not appear`. The same index ships as `llms.txt` in the
|
|
22
|
+
package; the full reference is at https://docs.unotest.com/reference/dsl/.
|
|
23
|
+
|
|
24
|
+
- **Navigation** — `goto`, `reload`, `goBack`, `goForward`, `waitForUrl`, `waitForNavigation`
|
|
25
|
+
- **Locators** — `locator`, `getByRole`, `getByText`, `getByLabel`, `getByPlaceholder`, `getByAltText`, `getByTitle`, `getByTestId`, `contentFrame`
|
|
26
|
+
- **Refining a locator** — `filter`, `first`, `last`, `nth`, `randomNth`
|
|
27
|
+
- **Actions** — `click`, `doubleClick`, `check`, `uncheck`, `hover`, `scrollIntoView`, `fill`, `press`, `selectOption`, `dragAndDrop`, `uploadFile`, `clipboardPaste`
|
|
28
|
+
- **Waits and the page clock** — `waitFor`, `waitForText`, `waitForCount`, `waitForAnimations`, `pause`, `waitForDownload`, `clockFreeze`, `clockTick`, `clockRun`
|
|
29
|
+
- **Assertions** — `assertText`, `assertTexts`, `assertAttribute`, `assertVisible`, `assertHidden`, `assertNeverAppears`, `assertValue`, `assertCount`, `assertUrl`, `assertJudge`, `assertScreenshot`, `assertEqual`, `assertTrue`, `assertSchema`, `assertFileHas`, `assertFileLacks`, `skip`, `setTestTimeout`
|
|
30
|
+
- **Reading the page and values** — `clipboardRead`, `assertClipboard`, `count`, `textContent`, `texts`, `inputValue`, `isVisible`, `isChecked`, `isDisabled`, `isEnabled`, `hasAttribute`, `computedStyle`, `getImageSize`, `hasAnimation`, `animations`, `randomFirstName`, `randomLastName`, `randomEmail`, `randomText`, `randomWord`, `json`, `textContains`, `textJoin`, `nowMs`, `today`, `daysFromNow`, `textMatches`, `parseJson`, `urlParam`, `toNumber`, `round`, `formatNumber`, `env`
|
|
31
|
+
- **Page state** — `getAttribute`, `getInnerText`, `getInputValue`, `boundingBox`, `getTitle`, `getUrl`, `log`
|
|
32
|
+
- **Storage and cookies** — `setLocalStorage`, `getLocalStorage`, `setCookie`, `getCookie`
|
|
33
|
+
- **Tabs, frames, contexts, extensions** — `setPage`, `waitForPage`, `bringToFront`, `setPageHidden`, `newPage`, `closePage`, `setViewport`, `emulateMedia`, `newContext`, `setContext`, `enterFrame`, `exitFrame`, `addVirtualAuthenticator`, `virtualCredentials`, `removeVirtualAuthenticator`, `grantPermissions`, `setOffline`, `waitForServiceWorker`, `extensionId`, `evaluateInServiceWorker`
|
|
34
|
+
- **Data, files, network, processes** — `shell`, `waitForFile`, `assertNoFile`, `waitForJsonLine`, `assertNoJsonLine`, `readJsonLine`, `readJson`, `readFile`, `readFileInfo`, `waitForFileCount`, `assertFileCount`, `dbQuery`, `dbExec`, `apiCall`, `upload`, `mockRoute`, `unmockRoute`, `waitForRequest`, `waitForWebSocket`, `assertNoRequest`, `openTerminal`, `setTerminal`, `closeTerminal`, `terminalType`, `terminalPress`, `terminalWaitForText`, `terminalAssertText`, `terminalResize`, `terminalScreenshot`, `mcpStart`, `mcpCall`, `mcpWaitNotification`, `mcpStop`, `vmAvailable`, `vmClone`, `vmRun`, `vmIp`, `vmStop`, `vmDelete`
|
|
35
|
+
- **Diagnostics** — `screenshot`, `note`, `consoleEntries`, `pageErrors`, `assertNoConsoleErrors`
|
|
36
|
+
- **Structure** — `step`, `teardown`, `waitUntil`, `assertNever`
|
|
37
|
+
- **Page code (last resort)** — `evaluate`, `evaluateOnLocator`
|
|
38
|
+
<!-- /generated:api-index -->
|
|
39
|
+
|
|
15
40
|
---
|
|
16
41
|
|
|
17
42
|
## 1. Setup
|