@unotest/web 0.55.0 → 0.57.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 +44 -7
- package/.claude/skills/write-e2e-test-ground/SKILL.md +20 -5
- package/CHANGELOG.md +250 -3
- package/README.md +7 -6
- package/bin/unotest-web.js +13 -0
- package/dist/config/schema.d.ts +29 -23
- package/dist/config/schema.js +1 -1
- package/dist/driver/index.d.ts +16 -2
- package/dist/driver/index.js +1 -1
- package/dist/dsl/index.d.ts +74 -94
- package/dist/dsl/index.js +1 -1
- package/dist/dsl/v8/scenario-worker.js +1 -1
- package/dist/dsl/web-dsl-language-service.d.ts +30 -3
- package/dist/dsl/web-dsl-language-service.js +1 -1
- package/dist/inspection/page-inject.d.ts +63 -7
- package/dist/inspection/page-inject.js +199 -19
- package/dist/{interfaces-CNvyInrY.d.ts → interfaces-DDp6Chwx.d.ts} +167 -10
- package/dist/{linter-BpaIstU3.d.ts → linter-q4UNIeGI.d.ts} +20 -0
- 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/dist/scenario-variables-CGexnWK4.d.ts +106 -0
- package/examples/idioms/README.md +16 -0
- package/examples/idioms/animations-list.js +24 -0
- package/examples/idioms/api-call-timeout.js +14 -0
- package/examples/idioms/background-tab.js +24 -0
- package/examples/idioms/clipboard-paste.js +25 -0
- package/examples/idioms/computed-style.js +21 -0
- package/examples/idioms/image-size.js +20 -0
- package/examples/idioms/never-appears.js +20 -0
- package/examples/idioms/never-condition.js +24 -0
- package/examples/idioms/page-code-function.js +18 -0
- package/examples/idioms/select-by-label.js +22 -0
- package/examples/idioms/wait-enabled.js +24 -0
- package/examples/idioms/wait-for-animations.js +16 -0
- package/examples/idioms/wait-until-value.js +32 -0
- package/guides/agent-integration.md +28 -4
- package/guides/dsl-reference.md +896 -45
- package/llms.txt +38 -9
- package/package.json +9 -8
- package/types/unotest-dsl.d.ts +107 -30
- package/types/unotest-lib.d.ts +5 -3
package/llms.txt
CHANGED
|
@@ -47,7 +47,11 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
47
47
|
- `fill(locator, value, { force?, timeoutMs? })` · options `{force?, timeoutMs?}` (alias: timeout → timeoutMs) — Clear and type a value into an input.
|
|
48
48
|
- `press(locator, key, { delay?, timeoutMs? })` · options `{delay?, timeoutMs?}` (alias: timeout → timeoutMs) — Press a key (e.g. 'Enter', 'Control+A').
|
|
49
49
|
- `selectOption(locator, value, { force?, timeoutMs? })` · options `{force?, timeoutMs?}` (alias: timeout → timeoutMs) — Select option(s) in a `<select>`.
|
|
50
|
-
- `dragAndDrop(from, to, { force?, timeoutMs? })` · options `{force?, timeoutMs?}` (alias: timeout → timeoutMs) — Drag one element onto another.
|
|
50
|
+
- `dragAndDrop(from, to, { force?, sourcePosition?, targetPosition?, timeoutMs? })` · options `{force?, sourcePosition?, targetPosition?, timeoutMs?}` (alias: timeout → timeoutMs) — Drag one element onto another.
|
|
51
|
+
- `dragBy(locator, dx, dy, { force?, sourcePosition?, timeoutMs? })` · options `{force?, sourcePosition?, timeoutMs?}` (alias: timeout → timeoutMs) · since 0.57.0 — Take hold of an element (its centre, or the {x, y} point `sourcePosition` inside it) and move the pointer dx, dy CSS pixels before letting go — a resize handle, a slider, a selection box on a canvas.
|
|
52
|
+
- `tap(locator, { position?, timeoutMs? })` · options `{position?, timeoutMs?}` (alias: timeout → timeoutMs) · since 0.57.0 — Touch the element with one finger, down and up, after the same wait for the element as any action.
|
|
53
|
+
- `longPress(locator, { durationMs?, position?, timeoutMs? })` · options `{position?, durationMs?, timeoutMs?}` (alias: timeout → timeoutMs) · since 0.57.0 — Hold one finger on the element for `durationMs` (default 800) before it lifts — a row's context menu on a phone.
|
|
54
|
+
- `swipe(locator, dx, dy, { durationMs?, sourcePosition?, timeoutMs? })` · options `{sourcePosition?, durationMs?, timeoutMs?}` (alias: timeout → timeoutMs) · since 0.57.0 — Put one finger on the element (its centre, or the {x, y} point `sourcePosition` inside it), move it dx, dy CSS pixels over `durationMs` (default 300) and lift it — a row swiped aside, a carousel.
|
|
51
55
|
- `uploadFile(locator, files)` — Set files on a file input.
|
|
52
56
|
- `clipboardPaste(locator, text)` — Paste text.
|
|
53
57
|
|
|
@@ -57,7 +61,7 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
57
61
|
- `waitForText(text, { exact?, state?, timeoutMs? })` · options `{state?, exact?, timeoutMs?}` (alias: timeout → timeoutMs) — Wait until `text` appears anywhere on the page.
|
|
58
62
|
- `waitForCount(locator, count, { exact?, timeoutMs? })` · options `{exact?, timeoutMs?}` (alias: timeout → timeoutMs) — Poll until the locator matches AT LEAST `count` elements (`{exact: true}` for exactly).
|
|
59
63
|
- `waitForAnimations(locator, { timeoutMs? })` · options `{timeoutMs?}` (alias: timeout → timeoutMs) · since 0.47.0 — Wait until the element and its descendants have no animation still running — a dialog done fading in, a card done sliding.
|
|
60
|
-
- `pause(ms)` —
|
|
64
|
+
- `pause(ms, reason?)` — Fixed delay.
|
|
61
65
|
- `waitForDownload(options?) → { path, name }` · options `{timeoutMs?, name?}` · since 0.45.0 — The first file the page downloaded that the scenario has not taken yet, saved with the run: `path` is absolute (read it with waitForFile), `name` is the name the site suggested.
|
|
62
66
|
- `clockFreeze(iso)` · since 0.44.0 — Stop time on the page at an ISO instant: `Date` reads it and no timer fires until clockTick / clockRun.
|
|
63
67
|
- `clockTick(ms)` · since 0.44.0 — Move frozen time forward by ms, firing every timer due in it.
|
|
@@ -70,6 +74,8 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
70
74
|
- `assertAttribute(locator, name, expected, { exact?, not?, timeoutMs? })` · options `{exact?, not?, timeoutMs?}` (alias: timeout → timeoutMs) · since 0.46.0 — Polls the attribute `name` until it equals `expected` (exact: false — contains) or matches a /regex/.
|
|
71
75
|
- `assertVisible(locator, { timeoutMs? })` · options `{timeoutMs?}` (alias: timeout → timeoutMs) — Element is visible.
|
|
72
76
|
- `assertHidden(locator, { timeoutMs? })` · options `{timeoutMs?}` (alias: timeout → timeoutMs) — Element is hidden or detached.
|
|
77
|
+
- `assertInViewport(locator, { ratio?, timeoutMs? })` · options `{ratio?, timeoutMs?}` (alias: timeout → timeoutMs) · since 0.57.0 — Element intersects the viewport — the visible area of the page, with scroll containers that clip it.
|
|
78
|
+
- `assertNoFocusZoom(scope?, { minFontPx?, timeoutMs? })` · options `{minFontPx?, timeoutMs?}` (alias: timeout → timeoutMs) · since 0.57.0 — No text field zooms the page on focus on iOS: Safari zooms into a field whose text is under 16px and stays zoomed.
|
|
73
79
|
- `assertNeverAppears(locator, { withinMs })` · options `{withinMs?}` — Negative window assert: FAIL the moment the locator becomes visible; pass when the whole window elapsed clean.
|
|
74
80
|
- `assertValue(locator, expected, { timeoutMs? })` · options `{timeoutMs?}` (alias: timeout → timeoutMs) — Input's value equals `expected`.
|
|
75
81
|
- `assertCount(locator, expected, { timeoutMs? })` · options `{timeoutMs?}` (alias: timeout → timeoutMs) — Number of matches equals `expected`.
|
|
@@ -122,7 +128,7 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
122
128
|
|
|
123
129
|
## Page state
|
|
124
130
|
|
|
125
|
-
- `getAttribute(locator, name) → string` — Attribute value ("" if missing).
|
|
131
|
+
- `getAttribute(locator, name) → string` — Attribute value ("" if missing, never null — so `== null` is never true; check presence with hasAttribute).
|
|
126
132
|
- `getInnerText(locator) → string` — Rendered inner text.
|
|
127
133
|
- `getInputValue(locator) → string` — Input value (alias of inputValue).
|
|
128
134
|
- `boundingBox(locator) → {x, y, width, height} | null` · since 0.45.0 — Where the element lies in the viewport, CSS pixels; null when it is not rendered (display:none, detached).
|
|
@@ -135,7 +141,8 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
135
141
|
- `setLocalStorage(key, value)` — Set a localStorage item.
|
|
136
142
|
- `getLocalStorage(key) → string` — Read a localStorage item ("" if missing).
|
|
137
143
|
- `setCookie(name, value, options?)` · options `{domain?, path?, expires?, httpOnly?, secure?, sameSite?}` — Set a cookie (options: path, domain, expires, httpOnly, secure, sameSite).
|
|
138
|
-
- `getCookie(name) → string` — Read a cookie value ("" if missing).
|
|
144
|
+
- `getCookie(name, options?) → string` · options `{page?}` — Read a cookie value ("" if missing — hasCookie tells it from an empty one).
|
|
145
|
+
- `hasCookie(name, options?) → boolean` · options `{page?}` · since 0.56.0 — Whether the cookie is there at all — the probe that tells a missing cookie from an empty value.
|
|
139
146
|
|
|
140
147
|
## Tabs, frames, contexts, extensions
|
|
141
148
|
|
|
@@ -144,10 +151,10 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
144
151
|
- `bringToFront(index?)` · since 0.45.0 — Bring a tab to front — the visible one — without changing the tab the steps act on.
|
|
145
152
|
- `setPageHidden(hidden, index?)` · since 0.51.0 — Emulates the tab's visibility for its scripts: true sends it to the background (document.hidden, visibilityState 'hidden', blur + visibilitychange), false brings it back.
|
|
146
153
|
- `newPage(url?) → number` · since 0.45.0 — Open a new tab in the active browser context, make it active and return its index.
|
|
147
|
-
- `closePage(index?)` · since 0.45.0 — Close a tab; no index: the active one.
|
|
154
|
+
- `closePage(index?, {beforeUnload?}?)` · options `{beforeUnload?}` · since 0.45.0 — Close a tab; no index: the active one.
|
|
148
155
|
- `setViewport({width, height})` · since 0.44.0 — Resize every tab of the browser, and the ones it opens later, without reloading.
|
|
149
156
|
- `emulateMedia({ reducedMotion?, colorScheme? })` · options `{reducedMotion?, colorScheme?}` · since 0.47.0 — Change the media features the current tab reports from now on — what matchMedia and CSS @media see: reducedMotion 'reduce' | 'no-preference', colorScheme 'light' | 'dark' | 'no-preference'.
|
|
150
|
-
- `newContext({ profile?, cdpEndpoint? }) → number` · options `{profile?, cdpEndpoint?}` · since 0.44.0 — Open another browser context — a separate client with its own cookies, storage and tabs — and make it active.
|
|
157
|
+
- `newContext({ profile?, cdpEndpoint?, headers?, viewport? }) → number` · options `{profile?, cdpEndpoint?, headers?, viewport?}` · since 0.44.0 — Open another browser context — a separate client with its own cookies, storage and tabs — and make it active.
|
|
151
158
|
- `setContext(index)` · since 0.44.0 — Make browser context `index` active.
|
|
152
159
|
- `enterFrame(locator)` — Scope subsequent calls to an iframe (persists until exitFrame).
|
|
153
160
|
- `exitFrame()` — Exit the innermost iframe scope.
|
|
@@ -179,11 +186,13 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
179
186
|
- `upload(path, options?) → UploadRef` · options `{field?, fields?}` — Multipart marker for apiCall's body (options: field, fields).
|
|
180
187
|
- `mockRoute(glob, response)` · since 0.45.0 — From now on, requests matching `glob` (a Playwright URL glob: `**/api/items*`) get a fixed answer: `{status?, body?, headers?, contentType?}` (an object body goes as JSON), `{abort: true, record?}` or `{continue: true}` (to the network).
|
|
181
188
|
- `unmockRoute(glob?)` · since 0.45.0 — Take off the mock at `glob`, or every mock when called without one.
|
|
182
|
-
- `waitForRequest(glob, { timeoutMs? }) → { url, method, headers, postData, postDataJson }` · options `{timeoutMs?}` · since 0.45.0 — Wait for a request matching `glob` and return it; `postDataJson` is the body read as JSON (null when it is not).
|
|
189
|
+
- `waitForRequest(glob, { timeoutMs?, method? }) → { url, method, headers, postData, postDataJson }` · options `{timeoutMs?, method?}` · since 0.45.0 — Wait for a request matching `glob` and return it; `postDataJson` is the body read as JSON (null when it is not).
|
|
183
190
|
- `waitForResponse(glob, { status?, method?, since?, timeoutMs? }) → { url, method, status, ok, headers, json, text, truncated?, mocked? }` · options `{status?, method?, since?, timeoutMs?}` · since 0.55.0 — Wait for the answer to a request matching `glob` and return it: `headers` of the response (names in lower case), `json` (null when the body is not JSON, was not read or was cut), `text` (text or JSON bodies of `fetch` / `xhr`, at most 64 KB, then `truncated`).
|
|
184
191
|
- `waitForWebSocket(glob, { timeoutMs? }) → { url }` · options `{timeoutMs?}` · since 0.51.0 — Wait until the active page has opened a WebSocket whose URL matches `glob` (a Playwright URL glob: `**/ws`, `ws://localhost:*/live`) and return its URL.
|
|
192
|
+
- `waitForWebSocketFrame(glob, { direction?, match?, timeoutMs? }) → { url, direction, text, json, at }` · options `{direction?, match?, timeoutMs?}` · since 0.57.0 — Wait for a frame of a WebSocket of the active page whose URL matches `glob`, and take it: the next call gives the next frame.
|
|
193
|
+
- `webSocketFrames(glob, { direction? }) → [{ url, direction, text, json, at }]` · options `{direction?}` · since 0.57.0 — Every frame kept of the active page's WebSockets whose URL matches `glob`, oldest first, from the page's last load on; takes none, so waitForWebSocketFrame still gives them.
|
|
185
194
|
- `networkEntries({ since?, glob? }) → [{ url, method, status, ok, headers, failureText?, mocked?, requestJson, responseJson, responseText, truncated?, at }]` · options `{since?, glob?}` · since 0.53.0 — What the active page requested and was answered, oldest first: the status and, for `fetch` / `xhr` with a text or JSON content type, the bodies (`requestJson` as `postDataJson` of `waitForRequest`; `responseJson` is null when the body is not JSON; at most 64 KB each, then `truncated`).
|
|
186
|
-
- `assertNoRequest(glob, { since? })` · options `{since?}` · since 0.45.0 — FAIL if the recording abort at `glob` — mockRoute(glob, {abort: true, record: true}) — stopped any request; with `since` (epoch ms, from nowMs()) only from then on.
|
|
195
|
+
- `assertNoRequest(glob, { since?, method? })` · options `{since?, method?}` · since 0.45.0 — FAIL if the recording abort at `glob` — mockRoute(glob, {abort: true, record: true}) — stopped any request; with `since` (epoch ms, from nowMs()) only from then on, with `method` (`'POST'`, any case) only requests of that method.
|
|
187
196
|
- `openTerminal(app?, { host?, leaveOpen?, env?, cwd?, shell?, cols?, rows?, term?, locale?, cleanProfile? }) → number` · options `{host?, leaveOpen?, env?, cwd?, shell?, cols?, rows?, term?, locale?, cleanProfile?}` · since 0.51.0 — Open a terminal and make it the one the terminal steps act on; returns its index for setTerminal.
|
|
188
197
|
- `setTerminal(index)` · since 0.51.0 — Make the terminal `index` (from openTerminal) the one the terminal steps act on.
|
|
189
198
|
- `closeTerminal()` · since 0.51.0 — Close the active terminal and stop what runs in it: HUP to the processes on its tty and their children, KILL for those that ignore it; a note lists them.
|
|
@@ -199,6 +208,8 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
199
208
|
- `terminalScreenshot(name?) → string` · since 0.51.0 — A PNG of the active terminal, saved with the run — a window's own picture, or the 'shell' terminal's screen drawn by the headless browser; returns its project-relative path.
|
|
200
209
|
- `mcpStart(command, args?, { env?, cwd?, timeoutMs? }) → server` · options `{env?, cwd?, timeoutMs?}` · since 0.51.0 — Start a stdio MCP server and finish its handshake; returns the handle the other mcp* functions take.
|
|
201
210
|
- `mcpCall(server, tool, args?, { timeoutMs?, allowError? }) → { content, structuredContent?, isError? }` · options `{timeoutMs?, allowError?}` · since 0.51.0 — Call a tool and return its result.
|
|
211
|
+
- `mcpCallStart(server, tool, args?) → call` · since 0.57.0 — Send a tool call and go on without waiting for its answer — for a tool that waits on something the test does next, like a person's answer on a card.
|
|
212
|
+
- `mcpCallResult(call, { timeoutMs?, allowError? }) → { content, structuredContent?, isError? }` · options `{timeoutMs?, allowError?}` · since 0.57.0 — Wait for the answer of a call mcpCallStart sent and return it, as mcpCall would.
|
|
202
213
|
- `mcpWaitNotification(server, method, { match?, timeoutMs? }) → params` · options `{timeoutMs?, match?}` · since 0.51.0 — Wait for a notification of `method` and return its params.
|
|
203
214
|
- `mcpStop(server)` · since 0.51.0 — Stop the server.
|
|
204
215
|
- `vmAvailable() → bool` · since 0.51.0 — Whether VMs can run here: Tart is installed and answers.
|
|
@@ -210,7 +221,7 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
210
221
|
|
|
211
222
|
## Diagnostics
|
|
212
223
|
|
|
213
|
-
- `screenshot(name?, { fullPage? }) → string` · options `{fullPage?}` — Capture the active page into the run's artifact dir; returns the project-relative path.
|
|
224
|
+
- `screenshot(name?, { fullPage?, timeoutMs? }) → string` · options `{fullPage?, timeoutMs?}` — Capture the active page into the run's artifact dir; returns the project-relative path.
|
|
214
225
|
- `note(label, value)` · since 0.31.0 — Attach a labelled value to the current step: shown in the viewer under the step (also after the run) and kept in the run journal.
|
|
215
226
|
- `consoleEntries({ level?, since? }) → [{ level, text, url }]` · options `{level?, since?}` · since 0.46.0 — What the active page wrote to its console, oldest first: `level` is log, info, warn, error or debug.
|
|
216
227
|
- `pageErrors({ since? }) → [{ message, stack }]` · options `{since?}` · since 0.46.0 — Errors the active page threw and nothing caught (an uncaught exception, a rejected promise), oldest first; `stack` is empty when the browser gave none.
|
|
@@ -227,3 +238,21 @@ Full reference: https://docs.unotest.com/reference/dsl/
|
|
|
227
238
|
|
|
228
239
|
- `evaluate(js, arg?) → any` — Run raw JS in the page context.
|
|
229
240
|
- `evaluateOnLocator(locator, js, ...args) → any` · since 0.45.0 — Like evaluate, on the matched element: the body is called with the element, then the extra arguments by the same rule (`(el, x) => …`, two or more → `(el, [a, b]) => …`).
|
|
241
|
+
|
|
242
|
+
## Idioms
|
|
243
|
+
|
|
244
|
+
One scenario per habit and the typed step that replaces it; `npx @unotest/web init` writes them to `unotest/e2e/examples/idioms/`.
|
|
245
|
+
|
|
246
|
+
- animations-list — what is moving on this element? → `unotest/e2e/examples/idioms/animations-list.js`
|
|
247
|
+
- api-call-timeout — give one HTTP call a time limit. → `unotest/e2e/examples/idioms/api-call-timeout.js`
|
|
248
|
+
- background-tab — work in one tab while another is in front. → `unotest/e2e/examples/idioms/background-tab.js`
|
|
249
|
+
- clipboard-paste — paste into a field. → `unotest/e2e/examples/idioms/clipboard-paste.js`
|
|
250
|
+
- computed-style — read a CSS value. → `unotest/e2e/examples/idioms/computed-style.js`
|
|
251
|
+
- image-size — is the image loaded, and how big is it? → `unotest/e2e/examples/idioms/image-size.js`
|
|
252
|
+
- never-appears — something must NOT appear. → `unotest/e2e/examples/idioms/never-appears.js`
|
|
253
|
+
- never-condition — a condition must never hold. → `unotest/e2e/examples/idioms/never-condition.js`
|
|
254
|
+
- page-code-function — run code in the page with a value from the test. → `unotest/e2e/examples/idioms/page-code-function.js`
|
|
255
|
+
- select-by-label — pick an option by the text the user sees. → `unotest/e2e/examples/idioms/select-by-label.js`
|
|
256
|
+
- wait-enabled — wait until a button can be pressed. → `unotest/e2e/examples/idioms/wait-enabled.js`
|
|
257
|
+
- wait-for-animations — wait for an animation to end. → `unotest/e2e/examples/idioms/wait-for-animations.js`
|
|
258
|
+
- wait-until-value — poll until a value is good enough, and keep it. → `unotest/e2e/examples/idioms/wait-until-value.js`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unotest/web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "AI-native E2E testing for web applications. MCP server (run_test / step / resume / inspect_runtime / agent_fix) + CLI runner + JavaScript DSL scenarios on a sandboxed AST engine + semantic DOM snapshots.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"examples/fixtures/break-fix-app/index.html",
|
|
67
67
|
"examples/fixtures/break-fix-app/README.md",
|
|
68
68
|
"examples/fixtures/break-fix-app/serve.mjs",
|
|
69
|
+
"examples/idioms",
|
|
69
70
|
"src/mcp/prompts",
|
|
70
71
|
"types",
|
|
71
72
|
".claude/skills",
|
|
@@ -88,11 +89,11 @@
|
|
|
88
89
|
"tsx": "^4.19.2",
|
|
89
90
|
"yaml": "^2.6.0",
|
|
90
91
|
"zod": "^3.23.8",
|
|
91
|
-
"@unotest/
|
|
92
|
-
"@unotest/
|
|
93
|
-
"@unotest/protocol": "^0.
|
|
94
|
-
"@unotest/
|
|
95
|
-
"@unotest/
|
|
92
|
+
"@unotest/core": "^0.57.0",
|
|
93
|
+
"@unotest/dsl": "^0.57.0",
|
|
94
|
+
"@unotest/protocol": "^0.57.0",
|
|
95
|
+
"@unotest/grounder-client": "^0.57.0",
|
|
96
|
+
"@unotest/viewer": "^0.57.0"
|
|
96
97
|
},
|
|
97
98
|
"optionalDependencies": {
|
|
98
99
|
"node-pty": "1.2.0-beta.15"
|
|
@@ -102,8 +103,8 @@
|
|
|
102
103
|
"javascript-obfuscator": "^4.1.1",
|
|
103
104
|
"tsup": "^8.5.1",
|
|
104
105
|
"typescript": "^5.7.2",
|
|
105
|
-
"@unotest/grounder": "^0.
|
|
106
|
-
"@unotest/judge": "^0.
|
|
106
|
+
"@unotest/grounder": "^0.57.0",
|
|
107
|
+
"@unotest/judge": "^0.57.0"
|
|
107
108
|
},
|
|
108
109
|
"peerDependencies": {
|
|
109
110
|
"typescript": ">=5.0.0 <7"
|
package/types/unotest-dsl.d.ts
CHANGED
|
@@ -155,11 +155,39 @@ declare function press(locator: Locator, key: string, options?: { timeout?: numb
|
|
|
155
155
|
declare function selectOption(locator: Locator, value: string | string[] | { value?: string; label?: string; index?: number }, options?: { timeout?: number; force?: boolean; timeoutMs?: number }): void;
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* dragAndDrop(from, to, { force?, timeoutMs? })
|
|
158
|
+
* dragAndDrop(from, to, { force?, sourcePosition?, targetPosition?, timeoutMs? })
|
|
159
159
|
*
|
|
160
|
-
* Drag one element onto another. Uses synthetic mouse events (not native HTML5 DragEvent).
|
|
160
|
+
* Drag one element onto another. Uses synthetic mouse events (not native HTML5 DragEvent). `sourcePosition` / `targetPosition` are {x, y} points inside each element (CSS pixels from its top-left corner; default its centre) — from and to may be the same element, to sweep a selection inside one frame.
|
|
161
161
|
*/
|
|
162
|
-
declare function dragAndDrop(source: Locator, target: Locator, options?: { timeout?: number; force?: boolean; timeoutMs?: number }): void;
|
|
162
|
+
declare function dragAndDrop(source: Locator, target: Locator, options?: { timeout?: number; force?: boolean; sourcePosition?: { x?: number; y?: number }; targetPosition?: { x?: number; y?: number }; timeoutMs?: number }): void;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* dragBy(locator, dx, dy, { force?, sourcePosition?, timeoutMs? })
|
|
166
|
+
*
|
|
167
|
+
* Take hold of an element (its centre, or the {x, y} point `sourcePosition` inside it) and move the pointer dx, dy CSS pixels before letting go — a resize handle, a slider, a selection box on a canvas. Synthetic mouse events in several steps.
|
|
168
|
+
*/
|
|
169
|
+
declare function dragBy(source: Locator, dx: number, dy: number, options?: { timeout?: number; force?: boolean; sourcePosition?: { x?: number; y?: number }; timeoutMs?: number }): void;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* tap(locator, { position?, timeoutMs? })
|
|
173
|
+
*
|
|
174
|
+
* Touch the element with one finger, down and up, after the same wait for the element as any action. `position` is the {x, y} point inside it (default its centre). Needs a context with a touch screen (`profile: 'ios'` or a touch `device`); without one the step fails before touching anything.
|
|
175
|
+
*/
|
|
176
|
+
declare function tap(locator: Locator, options?: { timeout?: number; position?: any; timeoutMs?: number }): void;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* longPress(locator, { durationMs?, position?, timeoutMs? })
|
|
180
|
+
*
|
|
181
|
+
* Hold one finger on the element for `durationMs` (default 800) before it lifts — a row's context menu on a phone. Needs a touch screen, like tap. Chromium drives its own touch input; WebKit and Firefox get touch events dispatched from the page, with `pointerType: 'touch'` pointer events — in WebKit those touch events are not `instanceof TouchEvent`.
|
|
182
|
+
*/
|
|
183
|
+
declare function longPress(locator: Locator, options?: { timeout?: number; position?: any; durationMs?: number; timeoutMs?: number }): void;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* swipe(locator, dx, dy, { durationMs?, sourcePosition?, timeoutMs? })
|
|
187
|
+
*
|
|
188
|
+
* Put one finger on the element (its centre, or the {x, y} point `sourcePosition` inside it), move it dx, dy CSS pixels over `durationMs` (default 300) and lift it — a row swiped aside, a carousel. The offset reads as in dragBy. Needs a touch screen, like tap; the engines differ as in longPress.
|
|
189
|
+
*/
|
|
190
|
+
declare function swipe(locator: Locator, dx: number, dy: number, options?: { timeout?: number; sourcePosition?: { x?: number; y?: number }; durationMs?: number; timeoutMs?: number }): void;
|
|
163
191
|
|
|
164
192
|
/**
|
|
165
193
|
* uploadFile(locator, files)
|
|
@@ -210,6 +238,20 @@ declare function assertVisible(locator: Locator, options?: { timeout?: number; t
|
|
|
210
238
|
*/
|
|
211
239
|
declare function assertHidden(locator: Locator, options?: { timeout?: number; timeoutMs?: number }): void;
|
|
212
240
|
|
|
241
|
+
/**
|
|
242
|
+
* assertInViewport(locator, { ratio?, timeoutMs? })
|
|
243
|
+
*
|
|
244
|
+
* Element intersects the viewport — the visible area of the page, with scroll containers that clip it. `ratio` (0..1): at least that share of the element is in view; absent — any part. Waits like the other asserts; scrolls nothing. Visible but scrolled away fails here, while assertVisible passes.
|
|
245
|
+
*/
|
|
246
|
+
declare function assertInViewport(locator: Locator, options?: { timeout?: number; ratio?: number; timeoutMs?: number }): void;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* assertNoFocusZoom(scope?, { minFontPx?, timeoutMs? })
|
|
250
|
+
*
|
|
251
|
+
* No text field zooms the page on focus on iOS: Safari zooms into a field whose text is under 16px and stays zoomed. Reads every visible, enabled, writable input, textarea, select and contenteditable in `scope` (the page when absent; the options may take its place): computed font size times the page scale, against `minFontPx` (default 16). A viewport meta with maximum-scale at 1 or below forbids the zoom, and the check passes. Waits like the other asserts. No browser engine does the zoom itself, so this reads its cause; run it on an iPhone device preset. The on-screen keyboard is not emulated: a composer hidden under it is not caught.
|
|
252
|
+
*/
|
|
253
|
+
declare function assertNoFocusZoom(scopeOrOptions?: Locator | { timeout?: number; minFontPx?: number; timeoutMs?: number }, options?: { timeout?: number; minFontPx?: number; timeoutMs?: number }): void;
|
|
254
|
+
|
|
213
255
|
/**
|
|
214
256
|
* assertNeverAppears(locator, { withinMs })
|
|
215
257
|
*
|
|
@@ -250,7 +292,7 @@ declare function assertJudge(locator: Locator, rubric: string): void;
|
|
|
250
292
|
*
|
|
251
293
|
* The page (or an element) against the PNG baseline unotest/e2e/<scenario>.screenshots/<name>.png. A pixel differs when any channel differs by more than threshold (default 32); fails when the share of differing pixels is MORE than maxDiffRatio (default 0). mask: locators, ignore: rectangles in baseline pixels — both left out of the comparison. No baseline: fails and saves the snapshot as a candidate; accept with e2e --update-screenshots. On failure the run keeps expected / actual / diff.
|
|
252
294
|
*/
|
|
253
|
-
declare function assertScreenshot(nameOrLocator: any, nameOrOptions?:
|
|
295
|
+
declare function assertScreenshot(nameOrLocator: any, nameOrOptions?: string | { maxDiffRatio?: number; threshold?: number; mask?: unknown[]; ignore?: unknown[]; fullPage?: boolean }, options?: { maxDiffRatio?: number; threshold?: number; mask?: unknown[]; ignore?: unknown[]; fullPage?: boolean }): void;
|
|
254
296
|
|
|
255
297
|
/**
|
|
256
298
|
* assertEqual(actual, expected)
|
|
@@ -337,11 +379,11 @@ declare function nth(receiver: Locator, index: number): Locator;
|
|
|
337
379
|
declare function randomNth(receiver: Locator): Locator;
|
|
338
380
|
|
|
339
381
|
/**
|
|
340
|
-
* screenshot(name?, { fullPage? }) → string
|
|
382
|
+
* screenshot(name?, { fullPage?, timeoutMs? }) → string
|
|
341
383
|
*
|
|
342
|
-
* Capture the active page into the run's artifact dir; returns the project-relative path. For a PNG after EVERY step without calling it, set UNOTEST_STEP_SCREENSHOTS=1 in the run's environment.
|
|
384
|
+
* Capture the active page into the run's artifact dir; returns the project-relative path. Evidence, not a check: a capture that runs out of time (`timeoutMs`, default the context's `defaultTimeoutMs`) returns null, warns on the step and files the reason as `<NNN>-<name>-screenshot-error.txt`; the test goes on. For a PNG after EVERY step without calling it, set UNOTEST_STEP_SCREENSHOTS=1 in the run's environment.
|
|
343
385
|
*/
|
|
344
|
-
declare function screenshot(name?: string, options?: { fullPage?: boolean }): string;
|
|
386
|
+
declare function screenshot(name?: string, options?: { fullPage?: boolean; timeoutMs?: number }): string;
|
|
345
387
|
|
|
346
388
|
/**
|
|
347
389
|
* note(label, value)
|
|
@@ -421,11 +463,11 @@ declare function setPageHidden(hidden: boolean, index?: number): void;
|
|
|
421
463
|
declare function newPage(url?: string): number;
|
|
422
464
|
|
|
423
465
|
/**
|
|
424
|
-
* closePage(index?)
|
|
466
|
+
* closePage(index?, {beforeUnload?}?)
|
|
425
467
|
*
|
|
426
|
-
* Close a tab; no index: the active one. Closing the active tab makes the tab that was active before it active again.
|
|
468
|
+
* Close a tab; no index: the active one. Closing the active tab makes the tab that was active before it active again. Without options the only open tab cannot be closed. {beforeUnload: 'leave' | 'stay'} closes as a person does: the page's beforeunload runs and its "Leave site?" gets that answer, whatever the dialog policy; 'stay' keeps the tab and the active page. With it the only open tab closes too: a blank tab is left at index 0 and the scenario goes on there. A browser asks only after real user input on the page: a click (a fill alone does not count in Firefox). Returns {asked, closed}; without the option the tab closes with no prompt: {asked: false, closed: true}.
|
|
427
469
|
*/
|
|
428
|
-
declare function closePage(
|
|
470
|
+
declare function closePage(indexOrOptions?: number | { beforeUnload?: "leave" | "stay" }, options?: { beforeUnload?: "leave" | "stay" }): any;
|
|
429
471
|
|
|
430
472
|
/**
|
|
431
473
|
* setViewport({width, height})
|
|
@@ -442,11 +484,11 @@ declare function setViewport(size: { width?: number; height?: number } | null):
|
|
|
442
484
|
declare function emulateMedia(media: { reducedMotion?: "reduce" | "no-preference"; colorScheme?: "light" | "dark" | "no-preference" }): void;
|
|
443
485
|
|
|
444
486
|
/**
|
|
445
|
-
* newContext({ profile?, cdpEndpoint? }) → number
|
|
487
|
+
* newContext({ profile?, cdpEndpoint?, headers?, viewport? }) → number
|
|
446
488
|
*
|
|
447
|
-
* Open another browser context — a separate client with its own cookies, storage and tabs — and make it active. Returns its number (the run's own is 0). With `profile: '<dir>'` the context runs on a browser profile of its own in that directory (a relative one starts at the project root; made if missing, kept after the run): two devices side by side, each keeping what it stored. The same directory twice in a run is refused. With `cdpEndpoint: 'http://<ip>:9222'` the context opens in a Chrome somebody else started with remote debugging (a VM's browser: `vmRun` gives the address) and the test only disconnects at the end; it cannot be combined with `profile`.
|
|
489
|
+
* Open another browser context — a separate client with its own cookies, storage and tabs — and make it active. Returns its number (the run's own is 0). With `profile: '<dir>'` the context runs on a browser profile of its own in that directory (a relative one starts at the project root; made if missing, kept after the run): two devices side by side, each keeping what it stored. The same directory twice in a run is refused. With `cdpEndpoint: 'http://<ip>:9222'` the context opens in a Chrome somebody else started with remote debugging (a VM's browser: `vmRun` gives the address) and the test only disconnects at the end; it cannot be combined with `profile`. With `headers: { Authorization: API_TOKEN }` every page of the new context sends those request headers with every request — a host that lets the app in by a token; the run's own context does not. With `viewport: { width, height, deviceScaleFactor }` (all optional, the config's fields) the new context opens on that window instead of the config's — the whole of it: a scale not given is 1, and the config's `device` is not applied under it; the scale is fixed when a context opens, so this is the way to a second one in a scenario. A stray field or a value that is not a positive number is refused, naming the fields.
|
|
448
490
|
*/
|
|
449
|
-
declare function newContext(options?: { profile?: string; cdpEndpoint?: string }): number;
|
|
491
|
+
declare function newContext(options?: { profile?: string; cdpEndpoint?: string; headers?: any; viewport?: { width?: number; height?: number; deviceScaleFactor?: number } }): number;
|
|
450
492
|
|
|
451
493
|
/**
|
|
452
494
|
* setContext(index)
|
|
@@ -780,7 +822,7 @@ declare function env(name: string, fallback?: any): any;
|
|
|
780
822
|
/**
|
|
781
823
|
* shell(cmd, ...args, options?) → { stdout, stderr, code }
|
|
782
824
|
*
|
|
783
|
-
* Run a binary (execFile, no shell interpretation). cwd from config `shellCwd`. Non-zero exit FAILS the step unless {allowNonZero: true}; wall-clock budget {timeoutMs} (default 120s).
|
|
825
|
+
* Run a binary (execFile, no shell interpretation). cwd from config `shellCwd`. Non-zero exit FAILS the step unless {allowNonZero: true}; wall-clock budget {timeoutMs} (default 120s); one longer than what is left of the test's budget warns before the command starts, with the setTestTimeout() that fits.
|
|
784
826
|
*/
|
|
785
827
|
declare function shell(cmd: string, ...args: unknown[]): any;
|
|
786
828
|
|
|
@@ -789,14 +831,14 @@ declare function shell(cmd: string, ...args: unknown[]): any;
|
|
|
789
831
|
*
|
|
790
832
|
* Poll a file (relative to config `shellCwd`) until it exists / contains a substring or regex, then return its content. options: {timeoutMs} (default 20s). The waitForText of background processes.
|
|
791
833
|
*/
|
|
792
|
-
declare function waitForFile(path: string, pattern?:
|
|
834
|
+
declare function waitForFile(path: string, pattern?: string | RegExp | { timeoutMs?: number }, options?: { timeoutMs?: number }): string;
|
|
793
835
|
|
|
794
836
|
/**
|
|
795
837
|
* assertNoFile(path, pattern?, { withinMs })
|
|
796
838
|
*
|
|
797
839
|
* Mirror of waitForFile with inverted polarity: FAIL the moment the file exists (and matches pattern); pass when the window elapsed clean. withinMs required.
|
|
798
840
|
*/
|
|
799
|
-
declare function assertNoFile(path: string, pattern?:
|
|
841
|
+
declare function assertNoFile(path: string, pattern?: string | RegExp | { withinMs?: number }, options?: { withinMs?: number }): void;
|
|
800
842
|
|
|
801
843
|
/**
|
|
802
844
|
* waitForJsonLine(path, filter, options?) → object
|
|
@@ -948,7 +990,7 @@ declare function contentFrame(frame?: Locator): Locator;
|
|
|
948
990
|
/**
|
|
949
991
|
* getAttribute(locator, name) → string
|
|
950
992
|
*
|
|
951
|
-
* Attribute value ("" if missing). Boolean attributes (disabled, readonly) read "" whether present or absent — use isDisabled / hasAttribute for those.
|
|
993
|
+
* Attribute value ("" if missing, never null — so `== null` is never true; check presence with hasAttribute). Boolean attributes (disabled, readonly) read "" whether present or absent — use isDisabled / hasAttribute for those.
|
|
952
994
|
*/
|
|
953
995
|
declare function getAttribute(locator: Locator, attribute: string): string;
|
|
954
996
|
|
|
@@ -1011,16 +1053,23 @@ declare function getLocalStorage(key: string): string;
|
|
|
1011
1053
|
/**
|
|
1012
1054
|
* setCookie(name, value, options?)
|
|
1013
1055
|
*
|
|
1014
|
-
* Set a cookie (options: path, domain, expires, httpOnly, secure, sameSite).
|
|
1056
|
+
* Set a cookie (options: path, domain, expires, httpOnly, secure, sameSite). A cookie the browser does not keep fails the step — sameSite: 'None' needs secure: true; one set with expires in the past is a deletion and passes.
|
|
1015
1057
|
*/
|
|
1016
1058
|
declare function setCookie(name: string, value: string, options?: { domain?: string; path?: string; expires?: number; httpOnly?: boolean; secure?: boolean; sameSite?: string }): void;
|
|
1017
1059
|
|
|
1018
1060
|
/**
|
|
1019
|
-
* getCookie(name) → string
|
|
1061
|
+
* getCookie(name, options?) → string
|
|
1062
|
+
*
|
|
1063
|
+
* Read a cookie value ("" if missing — hasCookie tells it from an empty one). Default: the browser context's jar, every domain and path, httpOnly too. {page: true}: what the page's script is given (document.cookie of the page or the entered frame) — no httpOnly cookies, none for another path or domain.
|
|
1064
|
+
*/
|
|
1065
|
+
declare function getCookie(name: string, options?: { page?: any }): string;
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* hasCookie(name, options?) → boolean
|
|
1020
1069
|
*
|
|
1021
|
-
*
|
|
1070
|
+
* Whether the cookie is there at all — the probe that tells a missing cookie from an empty value. Same {page: true} as getCookie.
|
|
1022
1071
|
*/
|
|
1023
|
-
declare function
|
|
1072
|
+
declare function hasCookie(name: string, options?: { page?: any }): boolean;
|
|
1024
1073
|
|
|
1025
1074
|
/**
|
|
1026
1075
|
* waitFor(locator, { state?, timeoutMs? })
|
|
@@ -1051,11 +1100,11 @@ declare function waitForCount(locator: Locator, count: number, options?: { timeo
|
|
|
1051
1100
|
declare function waitForAnimations(locator: Locator, options?: { timeout?: number; timeoutMs?: number }): void;
|
|
1052
1101
|
|
|
1053
1102
|
/**
|
|
1054
|
-
* pause(ms)
|
|
1103
|
+
* pause(ms, reason?)
|
|
1055
1104
|
*
|
|
1056
|
-
*
|
|
1105
|
+
* Fixed delay. `pause(ms, 'reason')` is a wait the test means (a task that waits 20 minutes by its rules): the reason is printed on the step and the linter leaves it be. A bare `pause(ms)` is reported by lint:pause-explicit — prefer a `waitFor*`. Raise the test's budget with setTestTimeout() for a long one.
|
|
1057
1106
|
*/
|
|
1058
|
-
declare function pause(ms: number): void;
|
|
1107
|
+
declare function pause(ms: number, reason?: string): void;
|
|
1059
1108
|
|
|
1060
1109
|
/**
|
|
1061
1110
|
* waitForDownload(options?) → { path, name }
|
|
@@ -1100,11 +1149,11 @@ declare function mockRoute(glob: string, response: any): void;
|
|
|
1100
1149
|
declare function unmockRoute(glob?: string): void;
|
|
1101
1150
|
|
|
1102
1151
|
/**
|
|
1103
|
-
* waitForRequest(glob, { timeoutMs? }) → { url, method, headers, postData, postDataJson }
|
|
1152
|
+
* waitForRequest(glob, { timeoutMs?, method? }) → { url, method, headers, postData, postDataJson }
|
|
1104
1153
|
*
|
|
1105
|
-
* Wait for a request matching `glob` and return it; `postDataJson` is the body read as JSON (null when it is not). On a mocked mask it also finds a request sent before the call, each one returned once; on any other mask only requests from the call on. Default timeout 20 s.
|
|
1154
|
+
* Wait for a request matching `glob` and return it; `postDataJson` is the body read as JSON (null when it is not). On a mocked mask it also finds a request sent before the call, each one returned once; on any other mask only requests from the call on. `{method}` (`'POST'`, any case) takes only a request of that method; one of another method stays for the next wait. Default timeout 20 s.
|
|
1106
1155
|
*/
|
|
1107
|
-
declare function waitForRequest(glob: string, options?: { timeoutMs?: number }): any;
|
|
1156
|
+
declare function waitForRequest(glob: string, options?: { timeoutMs?: number; method?: string }): any;
|
|
1108
1157
|
|
|
1109
1158
|
/**
|
|
1110
1159
|
* waitForResponse(glob, { status?, method?, since?, timeoutMs? }) → { url, method, status, ok, headers, json, text, truncated?, mocked? }
|
|
@@ -1120,6 +1169,20 @@ declare function waitForResponse(glob: string, options?: { status?: number; meth
|
|
|
1120
1169
|
*/
|
|
1121
1170
|
declare function waitForWebSocket(glob: string, options?: { timeoutMs?: number }): any;
|
|
1122
1171
|
|
|
1172
|
+
/**
|
|
1173
|
+
* waitForWebSocketFrame(glob, { direction?, match?, timeoutMs? }) → { url, direction, text, json, at }
|
|
1174
|
+
*
|
|
1175
|
+
* Wait for a frame of a WebSocket of the active page whose URL matches `glob`, and take it: the next call gives the next frame. Frames are kept from the socket's first one, so a frame the page sent on open, before the call, counts; a new document starts the list again. `direction` is 'sent' (by the page) or 'received'; `match` is a JSON key filter on the frame's `json` (scalar values, dot paths: `{type: 'hello'}`, `{'user.id': 2}`). `json` is the text parsed, null when it is not JSON; a binary frame has `size` (bytes) instead of `text`; `at` is epoch ms. A timeout names the sockets and the last frames. Default timeout 20 s.
|
|
1176
|
+
*/
|
|
1177
|
+
declare function waitForWebSocketFrame(glob: string, options?: { direction?: any; match?: any; timeoutMs?: number }): any;
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* webSocketFrames(glob, { direction? }) → [{ url, direction, text, json, at }]
|
|
1181
|
+
*
|
|
1182
|
+
* Every frame kept of the active page's WebSockets whose URL matches `glob`, oldest first, from the page's last load on; takes none, so waitForWebSocketFrame still gives them. The oldest go first past 1000 frames a tab.
|
|
1183
|
+
*/
|
|
1184
|
+
declare function webSocketFrames(glob: string, options?: { direction?: any }): any;
|
|
1185
|
+
|
|
1123
1186
|
/**
|
|
1124
1187
|
* networkEntries({ since?, glob? }) → [{ url, method, status, ok, headers, failureText?, mocked?, requestJson, responseJson, responseText, truncated?, at }]
|
|
1125
1188
|
*
|
|
@@ -1128,11 +1191,11 @@ declare function waitForWebSocket(glob: string, options?: { timeoutMs?: number }
|
|
|
1128
1191
|
declare function networkEntries(options?: { since?: number; glob?: any }): any;
|
|
1129
1192
|
|
|
1130
1193
|
/**
|
|
1131
|
-
* assertNoRequest(glob, { since? })
|
|
1194
|
+
* assertNoRequest(glob, { since?, method? })
|
|
1132
1195
|
*
|
|
1133
|
-
* FAIL if the recording abort at `glob` — mockRoute(glob, {abort: true, record: true}) — stopped any request; with `since` (epoch ms, from nowMs()) only from then on. A mask without a recording abort is an error, not a pass.
|
|
1196
|
+
* FAIL if the recording abort at `glob` — mockRoute(glob, {abort: true, record: true}) — stopped any request; with `since` (epoch ms, from nowMs()) only from then on, with `method` (`'POST'`, any case) only requests of that method. A mask without a recording abort is an error, not a pass.
|
|
1134
1197
|
*/
|
|
1135
|
-
declare function assertNoRequest(glob: string, options?: { since?: number }): void;
|
|
1198
|
+
declare function assertNoRequest(glob: string, options?: { since?: number; method?: string }): void;
|
|
1136
1199
|
|
|
1137
1200
|
/**
|
|
1138
1201
|
* openTerminal(app?, { host?, leaveOpen?, env?, cwd?, shell?, cols?, rows?, term?, locale?, cleanProfile? }) → number
|
|
@@ -1239,6 +1302,20 @@ declare function mcpStart(command: string, args?: string[], options?: { env?: an
|
|
|
1239
1302
|
*/
|
|
1240
1303
|
declare function mcpCall(server: any, tool: string, args?: any, options?: { timeoutMs?: number; allowError?: any }): any;
|
|
1241
1304
|
|
|
1305
|
+
/**
|
|
1306
|
+
* mcpCallStart(server, tool, args?) → call
|
|
1307
|
+
*
|
|
1308
|
+
* Send a tool call and go on without waiting for its answer — for a tool that waits on something the test does next, like a person's answer on a card. Take the answer with mcpCallResult. A call never taken is a warning in the run when the server stops, not a failure.
|
|
1309
|
+
*/
|
|
1310
|
+
declare function mcpCallStart(server: any, tool: string, args?: any): any;
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* mcpCallResult(call, { timeoutMs?, allowError? }) → { content, structuredContent?, isError? }
|
|
1314
|
+
*
|
|
1315
|
+
* Wait for the answer of a call mcpCallStart sent and return it, as mcpCall would. `timeoutMs` (default 30 s) counts from this step; running out cancels the call — there is no polling with short waits. Each call's result is taken once.
|
|
1316
|
+
*/
|
|
1317
|
+
declare function mcpCallResult(call: any, options?: { timeoutMs?: number; allowError?: any }): any;
|
|
1318
|
+
|
|
1242
1319
|
/**
|
|
1243
1320
|
* mcpWaitNotification(server, method, { match?, timeoutMs? }) → params
|
|
1244
1321
|
*
|
package/types/unotest-lib.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// DEPRECATED — run `npx @unotest/web types`.
|
|
2
|
+
// The editor typings now use JavaScript's own library: a scenario runs as
|
|
3
|
+
// plain JavaScript. This file is no longer generated or updated; it stays
|
|
4
|
+
// for one release so a jsconfig that still names it keeps its globals
|
|
5
|
+
// until `types` rewrites it.
|
|
4
6
|
|
|
5
7
|
interface Boolean {}
|
|
6
8
|
interface Function {}
|