49 Commits
Author SHA1 Message Date
Krzysztof Mochandftaakash c8df611512 feat(expect): add toBeEmpty locator matcher (ENG-1229) (#2219)
* feat(expect): add expect(locator).toBeEmpty()

Imported from #1869 (head f65722e13), squashed onto main. The run_code
grammar entry is dropped: #1998 deleted code-surface.ts, and run_code now
calls the real expect.

* fix(expect): read toBeEmpty's emptiness from the engine

toBeEmpty decided value vs text by role in core, since a semantic node
has no tag, so an ARIA combobox or listbox, a non-editable ARIA textbox,
a native select, a submit input, and a checkbox all read as empty where
Playwright finds them not empty.

Engines now report an empty node state on located nodes, never in an
observation and never on a secure field. The web engine reads it in the
page as Playwright does: an input or textarea by its raw value, any other
element by its trimmed text content. The mobile engine reads a text field
by its value and any other node by the text and values in its subtree.
toBeEmpty reads only that state, like toBeEditable reads readonly, and
fails either way where an engine reports none (desktop, older engines).

The empty state stays out of state-matcher failure messages and MCP
locate output.

* docs(expect): leave the secure-field rule to its table in toBeEmpty

* fix(web,mobile): close toBeEmpty's cross-frame and child-field gaps

- Web: read an input or textarea by tag name, as Playwright does. A
  filled input adopted from another frame failed instanceof, fell
  through to its empty text content, and passed toBeEmpty.
- Mobile: a field below a container counts by its value alone and a
  secure one not at all, so a container holding only an empty field with
  a label or hint is empty, and a filled password field is not told.
- Document that iOS reports a field Flutter or Compose Multiplatform
  draws as a plain view, so its placeholder counts.

---------

Co-authored-by: ftaakash <gsaakash@outlook.com>
2026-11-24 19:13:24 +01:00
TrzasQandKrzysztof Moch 012dd22ae9 feat(locator): tap a node count times with tap({ count }) (#1979)
* feat(locator): tap a node count times with tap({ count })

Part of #1855 (`locator.tap({ count: 3 })`). count 2 dispatches doubleTap;
3 or more go through a new multiTap action kind that web and mobile declare.

* fix(locator): cap tap count at 10 and cover multiTap across the protocol

- tap/click count accepts integers 1 through 10 (agent-device takes up to
  200; no real multi-tap needs more); TapOptions, screen reference, and the
  skill say so.
- Mobile reference lists multiTap under perform, with doubleTap's cadence
  caveat and the modifiers refusal (en, ja, zh).
- Engine protocol test: multiTap is advertised and its count and modifiers
  reach the served engine unchanged.
- requireTapCount moves above requireModifiers' doc comment.
- web() declares multiTap in surface-of; the no-multiTap refusal asserts
  locate is never called instead of timing it.

* docs(locator): document tap count limits in the skill and translations

Add the count bullet and its throws rows to the ja/zh tap reference,
list multiTap under tapModifiers in ja/zh engine.mdx, and add blur to the
zh mobile perform row. The skill note now says count 2 is doubleTap, 3+
needs multiTap, and a count above 1 does not combine with position.
Reword the TapOptions.count contract the same way: count 1 beside
position stays accepted, since it is the default plain tap.

* fix(locator): drop the tap count cap, label double taps with their count, and fill the contract fixtures

Core accepts any positive safe integer as a tap count again, as #1855
planned; each engine keeps its own limit. The mobile engine refuses a
multiTap above agent-device's 200 presses with UNSUPPORTED_CAPABILITY
before it presses anything.

tap({ count: 2 }) still sends doubleTap but records "<label> 2 times",
like 3 or more. dispatchTap now builds every tap-family step label and
runs the action, so the multiTap branch is one call.

The valid engine manifest fixture lists multiTap. The Playwright guide
maps click({ clickCount }) to tap({ count }), and the changeset and
screen reference say how a browser and a device each receive the taps.
A unit test pins tap({ count: 1, position }) as a pointer tap.

* docs(locator): qualify multi-click on devices and tighten tap count tests

The multiTap contract and docs said the platform reads the taps as one
multi-click. That holds in a browser; a device presses them at its own
cadence, which a gesture detector may not read as one. Say so in the
contract, the engine reference, and the skill, and note on the mobile page
that a large count needs a longer timeout (about 285 ms a press on iOS).

Tests: send Number.MAX_SAFE_INTEGER through the fake engine to pin that
core has no cap, check count 1 keeps the bare step label, and run the
mobile count-201 refusal as a test step, asserting no device call at all,
so a guard moved after the settle and steady waits fails.

* test(mobile-benchmark): land tap({ count: 3 }) as three presses on a device

Runs in the mobile workflow's iOS simulator and Android emulator jobs with
the real agent-device, next to the double-tap case.

* docs(locator): say tap count is a positive safe integer and note the mobile limit

core accepts a count that is a positive safe integer, and the mobile engine
refuses a multi-tap above 200 with UNSUPPORTED_CAPABILITY. Say both in the
TapOptions JSDoc and its reference blocks, the tap() option and throws
table, and the e2e skill, and list the multi-tap among the cancellable
device inputs in the mobile reference. Comment and docs only.

* docs(skill): rewrap the tap count sentence

---------

Co-authored-by: Krzysztof Moch <krzysmoch.programs@gmail.com>
2026-11-24 18:07:13 +00:00
Krzysztof MochandAsheesh Kumar e36bdd28a3 feat(web)!: read Playwright URL globs in waitForURL, route, and waitForResponse (ENG-1215, ENG-1287) (#2217)
* feat(web): read Playwright URL globs in waitForURL, route, and waitForResponse

Squashed from #1895 (feat/wait-for-url-glob at 3c3a1d5af) onto main.

* fix(web): keep a URL glob's fragment and brace errors through resolution

A glob's '#' was hidden in a placeholder, so '/account#tab*/../orders'
resolved to '/orders' and matched the wrong page. The fragment is now held
behind its '#', like the query behind its '?'.

A bad '{' was checked only after resolution, where '..' could drop the
segment holding it: route('/{bad/../orders') registered a route on
'/orders'. The glob as written is checked first, which also makes '/{bad'
INVALID_ARGUMENT rather than APP_URL_REQUIRED on a target with no app URL.

waitForURL's Throws table lists APP_URL_REQUIRED, like route's.

* chore(changeset): mark the route pattern grammar change as breaking

* test(testbed): port Playwright's URL glob cases now that globs match

wait-for-url.e2e.ts takes Playwright's '**/grid.html' globs again instead of
the exact paths it was rewritten to, and route.e2e.ts ports 'should not
support ? in glob pattern', which it skipped while '?' matched one character.

* fix(web): read a URL glob's first segment as a scheme only without ? or #

'x*?next=http://x.test/a' was swapped for a scheme placeholder, so the glob
resolved to the URL in its query and matched nothing. Resolution now uses the
test baseFor already used. The changeset also names what changes for
waitForURL: '' matches any URL, and {, }, and \ are glob syntax.

---------

Co-authored-by: Asheesh Kumar <asheeshkumarklg712@gmail.com>
2026-11-24 18:47:51 +01:00
Luke Howsam 11de64b8bf feat(config): accept an object for launch args (#1903)
* feat(config): accept an object for launch args

* fix(mobile): type the Android extras an object spells, and take one on openApp

A boolean in the object form went out as `--es`, a string extra, so
`getBooleanExtra` returned its default. Each value is now the extra of its
type: `--ez`, `--ei` (`--el` outside Java's int), `--ef`, `--es`, `--esa`.
`device.openApp` takes the same `LaunchArguments` as the target, so the
Maestro and Detox rows hold for a one-off launch too. The config check
rejects a sparse string list like it rejects a non-string item. The docs
and changeset say which form Android refuses Apple's names in, and the
benchmark check scopes its host queries to the attempt's device.

* fix(mobile): refuse what a launch command would read back changed

`am start --esa` splits on every comma and keeps the backslash before an
escaped one, and an empty value arrives as one empty item, so an object's
list on Android holds no empty, comma, or trailing-backslash item and is
never empty. iOS strings go out as plist strings, so `(draft)` reaches the
app as text and not an array. `device.openApp` now checks its
`launchArguments` like config load does, with `INVALID_ARGUMENT`, through
`checkLaunchArguments`, which `@e2e-dev/core/engine` exports; before, an
undefined value crashed in `map` and an Apple key passed through on
Android. Core also refuses a number beyond 2^53, which `--el` could not
carry, a NUL character, and a control character in a name. Docs define
the types, say `--ez`, `--ef`, and `--el`, and the Detox guide says Android
gets top-level extras, not the `launchArgs` bundle.

* chore(mobile): widen the Apple argument list and drop the hand-run launch check

The Android guard also names AppleKeyboards, AppleMeasurementUnits,
AppleMetricUnits, AppleTemperatureUnit, and AppleFirstWeekday, and its
comment says an unlisted name passes. The Detox guide says an Android app
reads instrumentation arguments under Detox, so its read changes to intent
extras either way. The mobile benchmark's launch-argument config and test
go: CI never ran them, the Android half could only see `(has extras)`, and
the unit tests pin the spelling.

* docs(ja, zh): mirror the launch-argument code blocks

The English pages gained the object form in four code blocks, two type
snippets, and a `checkLaunchArguments` section. The translations copy the
code and the heading so the outline check passes; the prose follows later.

* fix(core): let a launch-argument value be undefined, and name the bad item

The object form dropped an undefined value at runtime and the docs said so,
but the type refused `{ token: process.env.TOKEN }`, which every other
`app` field accepts. The record value is `LaunchArgumentValue | undefined`
now, and the mobile spelling skips such an entry. The message for a bad
item inside an object's list names the item like the list form does, a
hole reads "undefined" and not "a undefined", and the number bound reads
"beyond 2^53 - 1", since 2^53 itself is refused.

* docs: name the launch-argument object in the translated tables, and tighten checkLaunchArguments

The ja and zh config tables typed `launchArguments` as `string[]` under an
example of the object form. The engine reference said every `undefined`
value is left out, which holds for an object property and not a list item,
and left out that a name is non-empty.

* fix(mobile): quote iOS launch argument values that start with a dash

NSUserDefaults reads `-offset -1` as two keys, so `{ offset: -1 }` or `{ mode: '-x' }` reached the app as nil. Numbers now go through plistString too, and a value starting with `-` is quoted.

* refactor(core): resolve launch arguments without undefined values

checkLaunchArguments already drops undefined entries, so it now returns ResolvedLaunchArguments, used by EngineAppInfo, ResolvedApp and openApp. The undefined branches in the mobile spelling go away.

* refactor: narrow the scalar check and simplify the android list check

* docs(migrate): say where Detox puts launch args on Android

* chore: trim the launch-arguments changeset to what users see

* fix(mobile): raise the e2e peer floor to the first release with checkLaunchArguments

* feat(desktop): spell object launch args as user defaults

* test(desktop): cover the appPath launch with an object

Also scopes the config reference's table link to iOS and Android.

* refactor(core): share the NSUserDefaults spelling as appleUserDefaults

Mobile and desktop each carried a copy of the plist quoting rules. Both now call appleUserDefaults from @e2e-dev/core/engine, so a fix lands in one place.

* fix(core): quote // plist items and refuse a dashed launch argument name

A list item starting with // opened an old-style plist comment, so the
whole list read back as nil. A name like -AppleLocale went out as
--AppleLocale and never reached the app's locale. Adds tests for the
Android int32 bounds and empty-string quoting, and notes in the migration
docs that an app reading raw process arguments should keep the list form.

* fix(core): tell the user to remove the dash from a launch argument name

The message now says what to do and why: the engine adds the dash.

* docs: show the list form for apps that read raw process arguments

The iOS bullet in the mobile reference gets a list-form config for an app
that reads ProcessInfo.processInfo.arguments, and the Detox config passes
the same launch argument on both platforms. Every launch-argument code
block is mirrored into the translations: the Detox config and the new
block in ja and zh, appleUserDefaults in the ja and zh engine reference,
and the object form of the language example in cs, es, pt, hi, and fr.

* fix(core): keep EngineAppInfo.launchArguments a list, send objects through launchArgumentValues

An engine that spreads app.launchArguments broke when a target passed an
object, and the spread stopped compiling against the widened type.

launchArguments is a string list again. The object form goes to a new
EngineAppInfo.launchArgumentValues, only for engines that declare
launchArgumentValues: true (carried through defineEngine and the
manifest). Any other engine gets INVALID_CONFIG at config load, so
published mobile 0.12.8 on a newer core refuses the object instead of
crashing. mobile() and desktop() opt in.

* docs: scope the launch-argument example to Apple engines, and say openApp refuses a dashed name at the call
2026-11-24 07:43:51 +00:00
fd488ca022 feat(web): add browser.webmcp.tools() and browser.webmcp.callTool() (#1899)
* feat(web): add browser.webmcp.tools() and browser.webmcp.callTool()

Lists and calls the tools a page registers through WebMCP from test code.
web({ webmcp: true }) launches Chromium with WebMCP on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* feat(web): support webmcp on Firefox

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(web): address review of browser.webmcp and add the translated docs

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(web): ask the page for WebMCP and report a tool that navigates as possibly committed

browser.webmcp asked Playwright whether WebMCP was on, which only checks the
launch options of a browser Playwright started. On a browser the engine
attaches to, or a page outside a secure context, tools() resolved [] and
callTool failed with ACTION_FAILED. Both now ask the page for
document.modelContext / navigator.modelContext and fail with
UNSUPPORTED_CAPABILITY when it is absent.

A tool that navigates the page failed as ENGINE_FAILURE, and on Chromium the
pending navigation interrupted the next goto. That call, and one the deadline
cuts off, is now ACTION_MAY_HAVE_COMMITTED, thrown once the new document has
loaded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(web): report a tool call as possibly committed only once it reached the page

A deadline that ran out while browser.webmcp.callTool was still checking the
page for WebMCP was reported as ACTION_MAY_HAVE_COMMITTED, though the tool
had not been called. It is OPERATION_TIMEOUT now.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(web): do not call a WebMCP tool after its deadline has passed

browser.webmcp.callTool checks the page for WebMCP before it calls the
tool. On a busy page that check could resolve after the deadline had
already failed the call with OPERATION_TIMEOUT, and the tool was then
called anyway, with nobody waiting for it. The call now stops there.

The test read the title before the late call landed, so it passed either
way. It now waits for the page to be free first.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(web): classify a missing WebMCP tool first, keep callTool's result JSON, and close review gaps

- A missing-tool error is recognized by how Playwright's message starts,
  before the text is read for a browser diagnostic. A missing tool named
  "WebMCP is not enabled" was UNSUPPORTED_CAPABILITY, and one named
  "execution context was destroyed" was ACTION_MAY_HAVE_COMMITTED.
- callTool validates what the tool resolved with. Chromium turns a result
  into JSON itself; Firefox hands over a Date, a BigInt or NaN as it is,
  which now fails with INVALID_ARGUMENT naming the tool that ran.
- web({ webmcp: true }) on Chromium repeats the features Playwright
  enables, since Chromium keeps only the last --enable-features switch.
- The missing-tool test no longer depends on an earlier test registering
  a fifth tool.
- The type test compares exact types; `satisfies` passed for `any`.
- `webmcp` is in the setup skill's options table and the package README,
  and UNSUPPORTED_CAPABILITY in the errors reference names browser.webmcp.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(web): read WebMCP tool failures in the page, drop undefined results

- browser.webmcp moves to webmcp.ts and asks the page's modelContext from
  one in-page function instead of Playwright's page.webmcp, so a tool that
  throws is ACTION_FAILED whatever its message says
- a result property left undefined is dropped and an undefined array item
  is null, the same in Chromium and Firefox
- stricter type test from review

* fix(web): take only a JSON object as WebMCP tool input

- a number, string, or array input is INVALID_ARGUMENT before the page is
  asked; the browsers refused it without running the tool
- a tool that throws a value with no text form still reads as its failure
- a test pins the Chromium features copied from Playwright
- docs: Chromium parses a string result that holds JSON

* refactor(web): name launch preferences in the engine's own words

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
2026-11-23 16:44:53 +00:00
KilianSolutionsandClaude Fable 5.2 9d26791c3f feat(mobile): add device.shake() (#2130)
* feat(mobile): add device.shake()

device.shake() shakes an iOS simulator or an Android emulator once, as a
recorded device.shake step that counts as an action for the transition
budget, like home() and back(). A physical device is UNSUPPORTED_CAPABILITY.

agent-device gained the shake command in 0.21.42, so this bumps the pin from
0.21.41 in the mobile engine and the four packages that pin it with it.

Part of #1855.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(mobile-benchmark): say what the shake test checks

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 16:43:15 +00:00
TrzasQ b8809f9879 feat(test): triple the running test's timeout with test.slow() (#1982)
* feat(test): triple the running test's timeout with test.slow()

Part of #1855 (`test.slow()`). Builds on test.setTimeout (#1921): the
attempt's timeout hook takes an update of the timeout in force.

* fix(test): cover repeated test.slow() calls and correct the beforeAll timeout docs

Test that each call triples again; say the beforeAll row changes the hook's
own timeout; document the 2147483647 ms cap; and stop claiming a beforeAll's
worker fixtures run on the changed timeout: they are set up before its body.

* fix(test): slow an attempt once, as Playwright does, and word timeout refusals in core

test.slow() now applies once per attempt and once per beforeAll hook; a
second call does nothing. The published timeout setter returns what it did
('set' | 'ended' | 'teardown') instead of taking the API name, and core words
every refusal. The migration row says describe-level calls are refused in
any form, and the collection error points at beforeEach.

* fix(test): keep refusing test.slow() in teardown after the attempt was slowed

A second call on an already slowed attempt still goes through the setter
with an unchanged timeout, so afterEach and code left running are refused
as before. Tests cover that, a retry slowed again, and the beforeAll hook
timing out at the once-tripled timeout; the ja/zh migration guides list
test.slow() as supported.
2026-11-23 16:39:06 +00:00
3c2f92c0f7 feat(reporters): add line progress reporter (#1951)
* feat(reporters): add line progress reporter

* docs: add Japanese and Chinese line reporter references

* fix(reporters): refine line progress and failure reporting

* docs: refine line reporter documentation and comments

* docs(reporters): clarify line reporter streams and update tests

* refactor(reporters): make failure timing a progress policy

* fix(reporters): preserve terminal output and explore error reporting

* refactor(reporters): simplify line integration and explore handling

* feat(reporters): add the line reporter on the new reporter contract

`line` shows the run on one row: on a terminal the test that started or
finished last, elsewhere one row per finished test. A failure prints when
its result arrives, and the run ends with the summary `list` prints.

It is a third view of the shared `ListReporter`, like `dot`. Both now sit
behind one `TerminalProgress` interface, and the row is painted by the
view's live window, so it comes back under every log line and needs
nothing from the runner beyond the public `Reporter` hooks.

Also:
- a skipped setup test no longer counts in `collected.files`: it gets no
  result, so the `Tests` total and the row's `[n/N]` were one too high
- a view that paints on a terminal honors `NO_COLOR`

Co-authored-by: BloggerBust <10637462+BloggerBust@users.noreply.github.com>

* test(reporters): pin color support in the NO_COLOR test

picocolors decides once at import and CI=true turns colors on, so stubbing NO_COLOR afterwards left the view colored on CI. The test now sets isColorSupported to false, the case the painted view forces colors for.

---------

Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
Co-authored-by: BloggerBust <10637462+BloggerBust@users.noreply.github.com>
2026-11-23 16:25:29 +00:00
Oskar Kwaśniewski 7afe2ea34a feat(mcp): run JavaScript in run_code (#1998)
* feat(mcp): run JavaScript in run_code, in a sandbox

run_code takes the body of an async function with screen, app, expect, credentials, secrets, and console in scope. The code runs in QuickJS (the run package, in a worker) with no host access. Each call it makes on the app is spelled as one test line and parsed by the same closed grammar, then run with the same secret checks, so loops, reads, and return values work while the grammar still decides what reaches the app.

* fix(mcp): fit run_code to the moved session tools

Held tests get no engine fixture in run_code, since their attempt builds app alone. Tests from main expect the new result format.

* fix(mcp): stop unawaited run_code lines at a failure

Review fixes: lines made behind a failing one do not run and an unawaited or timer failure fails the call; listed reads are complete; messages reach the code redacted; lines share the call's deadline; expect(value) compares like the test API; isEditable alias removed; refused arguments carry INVALID_ARGUMENT; clearTimeout works.

* fix(mcp): fail run_code on a failure the code never awaited

Second review: a line the code never waited on fails the call even when it settled early; fixture lines are spelled on the host and an awaited object gets a named const line; undefined stays undefined; clearTimeout ends the host wait; number and length matchers check their types; a reserved fixture name stays out of scope; non-plain arguments and expect on a fixture object are refused; attach refuses path.

* docs(security): state what run_code's fixture calls can read

A page script run through browser or device can return a configured secret in a changed form; recorded as an accepted exception in AGENTS.md, SECURITY.md and the security docs.

* fix(mcp): refuse host files by path from run_code fixture calls

A fixture member that reaches a host file by a path the code names, or the raw driver client, is POLICY_DENIED. A fixture call that outlasts its line limit is answered at the limit. A call that passes a function is kept in test_lines. A script of only test lines is checked against the secret policy before any line runs. run_code failures count by code in session usage, and read values past what the result shows are dropped.

* docs(ja): keep main's wording next to the run_code changes

* refactor(mcp): drop the member aliases from run_code

* refactor(mcp): run run_code in Node on the real test objects

Drops the QuickJS sandbox, the guest prelude, and the closed grammar. The code runs in the server's process on the objects a test body gets, with a recorder that writes down each test line. run_code now has a test file's authority; SECURITY.md and AGENTS.md say so.

* fix(mcp): let a session's test claim a stray rejection before run_code

* feat(mcp): print a test line for a control found by its role alone

Closes #1825.

* fix(mcp): stop cancelled run_code calls and keep lists real arrays

Review findings: a call after the code's turn parks at its next await instead of throwing into a retry loop; arrays and promises are no longer proxied; an aborted call ends; stray errors go to the call that made them by async context; credentials and secrets come from core.

* fix(mcp): run handlers a run_code call left, redact spelled strings

Second review round: only code cut off by a cancel or the timeout is parked, so a handler one call left runs in the next; a string passes the ledger before it is escaped into a line; a rejection in the code's last turn fails the call; a cancel aborts the operation in flight and stops waiting for one that ignores it; names are numbered by the session; bytes, maps, and dates come back as themselves.

* fix(mcp): shorten a long value on a run_code test line

* fix(mcp): keep a run_code handler's error in its call

An error a handler left in the engine's context shut the server down; a function of the code now runs in its call's context. A stray error ends the call, a race's loser no longer fails it, a cancel ends the wait on lines the code left, and a draft asks for a fixture a line passes along.

* docs(mcp): list toBeEditable in the run_code API

* fix(mcp): address review of run_code on real objects

Soft failures stay in the call, a late throw no longer crashes a held test's worker, the unawaited note no longer hides a read, a username is drafted by name, a callback the server runs is drafted with a comment, and the timeout is described as a default. The changeset is breaking: lines need await.

* fix(mcp): draft a run_code callback's calls once

Calls a function of the code makes are not drafted again, a kept soft failure is a failed line, a fixture call is drafted whatever it returns, a class or built-in argument goes in as itself, the program limit covers lines left running, an error prints its message, and timeout sets the wait.

* fix(mcp): claim a run_code microtask error on Node 22

Node 22 reports an error thrown in a queueMicrotask callback outside the async context it was queued in, so a held test's worker took it as its own crash. The code gets a queueMicrotask that rethrows from a tick, which keeps the context.

* test(mcp): give the run_code callback test's tap a full second

With a 100 ms wait the tap inside toPass timed out on a loaded CI runner.

* docs(mcp): state that run_code is on by default
2026-11-23 15:34:24 +00:00
Oskar Kwaśniewski 02cf99bea4 feat(init): pick an example from a list with a bare --example (#2104) 2026-11-23 15:48:52 +01:00
Oskar Kwaśniewski cd811a4254 feat(reporters)!: one live hook, interactive flag, and pause events (#2046)
* feat(reporters)!: one live hook, interactive flag, and pause events

The plan event is now collected and lists every test up front. A step's
start progress names its source line. paused and resumed replace
onStepPrompt, output events replace onOutput, and interactive replaces
printsTo. During a run the runner prints on stderr only.

* refactor(reporters): host reporters in their own module, keys as data

Review round 1: the runner's fallback printing is a sink of its own, a
prompt carries its keys, onSummary gets the finished run, one interactive
reporter at most, and what a reporter prints while handed output is
redacted. Adds a stress suite of reporters of every kind.

* refactor(reporters): the host owns emit and finish, events are frozen

Review round 2: pause events live in one place and always pair, the
plain pause line has one printer, an event is frozen so no reporter can
rewrite it for the next, and --step beside json needs stderr read.

* refactor(reporters): one freeze rule, titlePath on paused

Review round 3: an event's own fields are frozen and the docs say only
that, paused names its test like collected does, the json refusal reads
one fact from the hold, and the CLI refuses --step beside --reporter json
up front again.

* fix(reporters): keep stdout for the json report, keep plan deprecated

Review findings on #2046:
- beside json, only its document reaches stdout: other reporters' stdout (interactive hooks, onSummary) prints on stderr, in embedded runs too
- onSummary output is redacted again
- json() dedupes with 'json'
- the --step viewer never opens on a stdout reserved for the report
- plan is emitted before collected, deprecated, until April 2027

* test(reporters): drop a regex CodeQL flags from the output test

* test(cli): wait for the whole pause prompt before reading it

* fix(reporters): show handed prints through the view, print json early

Second review round on #2046:
- what a reporter prints while it is handed output is an output event only whoever shows the run gets, so list shows it and it stays in order
- json prints from onRunFinished again, and from onSummary after a forced stop
- collected.at matches the report's startedAt
- a forced stop aborts a non-interactive onRunFinished at once
- --step --reporter json needs a terminal on stderr too
- docs: events after run-finished, onSummary redaction
2026-11-23 14:32:35 +00:00
1ece4df43b fix(acp): sign Codex in with an API key and redact provider keys (#2062)
* fix(acp): sign Codex in with an OpenAI API key

codex() never asked the Codex adapter to sign in, so a user with only
OPENAI_API_KEY got "the agent is not signed in" on every step. The preset
now sets DEFAULT_AUTH_REQUEST={"methodId":"api-key"} when a key is set,
passes no request while APP_SERVER_LOGS is on, turns off Codex shell
snapshots, and names a fresh sign-in when the provider refuses the
credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redact provider keys from everything a run writes

A model provider or coding agent that quotes the caller's API key back in
an error put it into the terminal, report.json, summary.md, trace pages,
and model input. The secret ledger now redacts provider keys as a class of
their own: the documented key variables, subscription login tokens, the
login codex() finds in CODEX_HOME/auth.json, and keys an executor
registers through e2e/agent. They match whole only, never turn on download
rewriting, and are never saved into a session. Text is redacted before it
is cut in the ACP reply and stderr tail, OAuth error bodies, verdict
summaries, and source code frames. e2e run, e2e mcp, and openHost warn
when NODE_DEBUG prints environments or request headers, and acp() no
longer passes NODE_DEBUG to the agents it starts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: read an empty CODEX_HOME as unset, and pin the provider key exports

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: close the provider key paths a review found

Register keys before they are used: an acp() agent's env when the executor
is built, launch({ env }) before the engine prepares, OAuth tokens when a
login is loaded and renewed, and Codex's saved login before each step and
after its turn. Redact before the cuts in the tool loop's reported turns,
and the model's own text before it is sent back as history. Keep test
titles on the config's secrets alone, so the runner and a worker that know
different keys still agree on a test id. A cut key matches from half its
length, not from a prefix every key of a provider shares. Install the
error redactor at import only where none is installed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: bound provider key length and close the second review's findings

A value longer than 8,192 characters is not registered: one long enough
made the redaction pattern fail to compile, and the engine's error quoted
the pattern, values included. A pattern that cannot be built now throws a
fixed message. The error redactor reads the environment again, so a config
that loads its own keys and then fails is covered. Codex's saved login is
found from the agent's own environment. Only the model's prose is redacted
in history; its reasoning goes back as written, since a provider signs it.
The ACP reply and stderr are redacted whole before their last line is
taken.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: close the third review's provider key findings

openHost redacts a config error for a key the config loaded itself. A
provider key is built alone before it is registered, and one no pattern can
hold is skipped, so a value of unusual characters cannot stop the run. The
NODE_DEBUG warning follows what Node prints, not the variable's current
value, and claims redaction only for output e2e writes. Codex's saved login
is read once the agent has started or failed to, through one open file.
Docs, changeset, and tests say what is covered and what is not.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(acp): move the e2e peer floor to 0.24.1

e2e 0.24.0 shipped without the provider key exports acp() now uses.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: redact a key in every config load failure, and test the NODE_DEBUG warning outside run

A config that loads a provider key (process.loadEnvFile) and then throws
with it printed the key in `e2e list`, `e2e doctor` (text and --json) and
the `e2e mcp` open_session error; only `e2e run` and openHost redacted it.
The loader now redacts the message it builds, so every command gets it.

The NODE_DEBUG warning from `e2e mcp` and `openHost` gets its own tests.
The security page no longer says the app cannot hold a provider key: one
given through inheritEnv stays in a download the app serves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redact a key a config loaded wherever a command prints its failure

A config that loads a key and then fails in a way that quotes it, with
e2e's own ConfigurationError or with a value the config check quotes
(targets: [process.env.GROQ_API_KEY]), still printed the key in e2e list,
e2e doctor (text and --json), e2e cache, and the MCP tool result: the
loader's message redaction covered a plain error only. The four places
that print such a failure now redact with redactError, which reads the
environment again first. Tests cover three failure shapes on five
commands and on open_session, and parse doctor --json as doctor-1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor: keep config failure redaction at the places that print it

The loader's own message redaction added nothing once the CLI failure line,
doctor, cache and the MCP tool result redact with redactError: drop it.
The two MCP config cases now use keys of their own, so one cannot register
the other's key and hide a missing redaction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(acp): redact the whole prompt, and know a saved Codex login before the first start

acp({ system }) went to the agent as written, and a login Codex saved
before the run was read only after the agent first started. A key in the
system text, or a saved key in the first step's text or in the stderr of
a first start that fails, could reach the agent or the error unredacted,
the stderr one cut so the rest no longer matched. The executor now reads
the saved login when it is built, and redacts the assembled prompt right
before it is sent; the transcript keeps that same text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: say the acp() prompt is redacted, and narrow the release text to what holds

The changeset now names the acp() prompt, a config that fails quoting a key
in e2e cache, and that a value no pattern can be built for is left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redact a config-loaded key in the public list() and explore() errors and in e2e init

A program that called list() or explore() from e2e/runner on a config that
loads a key and then fails got an error whose message and cause held the
key, and Node printed both when the rejection went uncaught. Both now
reject the way openHost does: classified, redacted, no raw cause. e2e init
redacts the warning it prints when an existing config does not load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redact the keys round three of review found in report, list, doctor, and model input

- e2e report redacts the config failure it prints, as cache does.
- list() registers the keys of its own env, as run does, so a failure that
  quotes one is redacted.
- doctor redacts the provider and model id it reports, and a step records
  its model's provider and id redacted: a key given as a model id no longer
  reaches doctor-1 JSON or report.json.
- The built-in agent redacts the system text a config writes.
- acp() redacts only its own system text: core already redacts the step
  with the test's ledger, which knows the saved Codex login from the moment
  the executor is built, and the process ledger would also mask values an
  earlier test learned.
- The failed-start test asserts the redacted stderr survives the cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: name the round-three redaction in the changeset and security page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redact system text and agent prompts without masking other tests' values

The built-in agent redacted its system text with the process ledger, which
also holds values earlier tests learned, so an old one-time code could mask
an order number in a later test's system. It now redacts only the config's
own system, with the step's own redactor. acp() redacts the whole prompt it
sends for provider keys only, with the new redactProviderKeys from
e2e/agent, which also covers a key the agent's start made known after core
built the step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redact a key given as a model id from the run header and the AI trace

run-started carried the model and judge labels as they were, so the list
reporter's header and every onEvent subscriber got a key a config passed as
the model id; ai-trace.json wrote model_id and provider the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: throw a hosted step's error redacted and without its raw cause

An agent step in an openHost session rethrew the provider's error as it was,
so a provider that quoted the key back put it in the external runner's
report through the message, AgentError.explanation, and the SDK cause.
Hosted sessions now throw the classified, redacted error, as a launch()
program does; the redaction covers explanation, and a thrown step error no
longer carries its raw cause, in both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: rewrite a provider key in text downloads, whole keys only

The owner's call: a config can give the app under test a key
(inheritEnv, command.env), and a download it serves is saved and can be
embedded in the HTML report. A provider key now turns on download rewriting
and is replaced there like anywhere else, whole only. The app-only view of
the ledger goes, with redactsAppSecrets and redactAppFragments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: drop only an agent error's raw cause from a thrown step error

The classified error a launch() program or an openHost session catches kept
the original error as its cause, redacted in place, which
step-verification pins and a caller reads to debug. Only an agent error's
cause, a provider SDK's error whose own fields no redaction reaches, is
dropped now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: rebuild only a failed model call at the step boundary

Round four turned on redactThrown for hosted sessions and dropped every
agent error's cause, so a test's own hook error lost its cause in launch()
and openHost, and an assertion thrown inside a hosted step came back
wrapped. Now every step recorder rebuilds a MODEL_PROVIDER_FAILED agent
error, from this copy of core or another, as a local AgentError with its
text redacted and no cause, the provider SDK's error being where a key
quoted back hides. Every other error is thrown as before, and hosted
sessions are back to throwing what the step threw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redact system text in the tool loop and an executor's prompt with the step's redactor

Round four moved system redaction into the built-in agent, so a custom
createToolLoopExecutor sent its system as written, and narrowed acp() to
provider keys, so a run secret in acp({ system }) reached the agent. The
shared tool loop now redacts system, string or function, with the step's
own redactor (provider keys when a context has none), and e2e/agent's new
redactStepText(ctx, text) does the same for an executor's own text;
acp() uses it on the prompt it sends. It replaces redactProviderKeys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redact the run header with the config's ledger, and say what downloads and model errors now do

The run header used the process ledger, so a secret of an earlier run in
the same process could mask a later run's model id; it now uses this
config's output ledger, which holds its secrets and the provider keys. The
web-platform download test no longer pins a label that depends on whether a
provider key is in the environment. The security page and the changeset
cover provider keys in downloads, the read-back timing, and a failed model
call's error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: compare download rewriting with what the environment's keys turn on

session-secrecy asserted that a session with no secret never rewrites
downloads, which fails once a provider key is exported, since a provider
key now turns rewriting on. It compares with a fresh session in the same
environment instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: preserve download handling and sanitize model failure causes

* fix: sanitize late provider errors and align the joint release

* test(core): allow the exhaustive redaction boundary check to finish

* test: make provider redaction fixtures portable

* fix: redact credentials in startup diagnostics

* fix(core): redact Claude Code OAuth credentials

* test: pass fixture credentials as data

* fix(core): refresh provider redaction before recording steps

* fix(acp): handle credentials in explicit Codex auth requests

* fix(e2e): align code frames with redacted source

* style(acp): use bracket access for ACP metadata

* fix(core): bound replay metadata in host and guest reports

* fix(acp): name the selected key when startup is refused

* fix(acp): distinguish blocked auth from refused credentials

---------

Co-authored-by: michal-e2e <357875193+michal-e2e@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:14:15 +00:00
Daniel Petro c3303731eb feat: support in-memory file uploads (#1883)
* feat: support in-memory file uploads

* fix: negotiate payload upload support with engines

* fix: address payload capability review findings

* fix: preserve compatibility with older core engines

* fix: validate upload payloads and isolate wire encoding

* fix: address upload compatibility review follow-ups

* fix: clarify upload fallback and manifest requirements

* fix(locator): declare in-memory uploads explicitly

* test(protocol): use an upload-capable manifest fixture

* docs(engine): clean up upload capability references

* fix(web): require core and e2e 0.24.1 for locator actions

* fix(locator): clear files on payload-only engines

* fix(locator): route upload clearing in the locator

* test(locator): distinguish unsupported upload clearing
2026-11-23 11:13:41 +01:00
Parbez 81cd8b70e4 fix(cli): keep the --target selection in the run header when --device is refused, and say which ids --device takes (#2087)
* fix(cli): keep the --target selection in the run header when --device is refused, and say which ids --device takes

* docs(cli): say --device applies to the one target that can take a device, and use 模拟器 for emulator in zh
2026-11-23 08:17:13 +00:00
Parbez 71a2b79534 feat(cli): run the selected mobile target on another device with e2e run --device (#2002)
* feat(cli): run the selected mobile target on another device with e2e run --device

The flag names the simulator, emulator, or phone by name or id for one run,
over the target's device option. The runner hands it to the prepare of the
one selected target whose engine declares selectsDevice, and refuses it
when no selected target or several do. The mobile engine binds that device
in prepare, and refuses it for a provider's leased devices.

* fix(cli): trim --device, refuse it before prepare for a provider's devices, and require prepare with selectsDevice

mobile() declares selectsDevice only for a local pool, so the runner
refuses --device for a device provider before any target is prepared.
A protocol manifest with selectsDevice and no lifecycle/prepare is
refused at load: the client would serve prepare for finish alone and
drop the device.

* fix(mobile): require core and e2e 0.24.1 for selectsDevice, and move the prepare/finish types out of engine/index.ts

- mobile() declares selectsDevice for local pools, which core 0.24.0 refuses
  as an unknown key, so raise both peer floors to >=0.24.1 <1 like web.
- engine/index.ts went past 1000 lines: EnginePrepareResult,
  EnginePrepareInfo and EngineFinishInfo move to engine/lifecycle.ts,
  re-exported from index.ts.
- List selectsDevice in the EngineManifest block of the protocol reference.
- Destructure device next to targets in run().

* fix(mobile): require core and e2e 0.25.0, the release that ships selectsDevice

The pending release versions core and e2e to 0.25.0, so 0.24.1 is never published.
2026-11-23 02:35:41 +00:00
bardrop 07575c996a feat(expect): add toBeEditable locator matcher (#1962)
* feat(expect): add toBeEditable locator matcher

* fix(expect): cover toBeEditable's editable option in the skill and docs

* fix(expect): read toBeEditable's read-only state from the engine

The web engine now reports a readonly node state with Playwright's
getReadonly rules (native tag by readonly, aria-readonly roles by
aria-readonly with case folding, editing hosts never), and the mobile
engine reports it on text fields where agent-device sends editable.
toBeEditable reads only states; the core role list and attribute read
are gone. Rename roles.ts isEditable to takesText.

* docs(expect): an editing host with an aria-readonly role reads that attribute

* fix(web,mobile): need core and e2e 0.24.1 for the readonly state

* fix(web,mobile): match Playwright's read-only rules on editing hosts and iOS fields

The web engine reads aria-readonly on an editing host by its ARIA role,
not the textbox it reads as, so a plain contenteditable div is editable
and a grid cell still reads the attribute. The mobile engine reports the
readonly state only on Android, where the flag comes from the platform:
agent-device fills in editable for every iOS text field. A combobox the
platform says takes text is editable. The engine reference shows the
new states union, and the changeset and expect docs say toBeEditable
needs the engine releases that ship with this change.

* test: cover readonly on native select and an Android field with no flag

- Chromium: <select readonly> is not editable, <select aria-readonly=true> is.
- Android: an EditText with no editable flag has no readonly state.
- Reference and changeset: the web engine follows Playwright's rules for
  native controls and aria-readonly, with e2e's roles and disabled state.

* chore: raise engine peer floors to 0.25.0
2026-11-23 02:13:28 +00:00
Vishwas Tiwari c30354ff84 feat(test): add test.describe.fail and the fail option on describe (#1925)
* feat(test): add test.describe.fail and the fail option on describe

A test now reads fail from its groups as well as itself. Any truthy layer marks it, the innermost reason wins, and fail: false does not unmark. Refused on, inside, or around a serial group. Part of #1855.

* test(collect): check an inner group's fail reason wins over an outer one

* fix(test): type describe without a cast and point the test.fail error at describe.fail

The collection error for test.fail(condition) outside a body now names describe.fail and the describe option, since a migrating Playwright user hits it first. The Playwright migrate row gains the conditional form, and the ja/zh rows take cubic's translations.

* fix(test): validate describe.fail options before adding the mark

describe.fail copied its options with a spread before validation, so an array or a non-enumerable bad key passed where describe() rejects it. The caller's options are now validated first, then again with fail: true for the serial rules. The fail docs now say true or any string marks, since a blank string marks too.

* docs(test): say fail is refused around a serial group too

* refactor(test): validate describe options in one pass

describe.fail no longer validates twice: the serial check takes the mark into account, and registerDescribe takes api and markFail without defaults.
2026-11-21 16:25:49 +01:00
jaidev 003c18a4ee feat(web): match route and waitForResponse by method (#1924)
`browser.route`, `browser.unroute`, and `browser.waitForResponse` accept a `{ method, url }` RouteMatcher. The method is case-insensitive, `url` keeps the string or RegExp grammar, and a route narrowed to another method steps aside for older routes and the network. `unroute` removes routes registered with the same pattern, method included.
2026-11-21 14:45:01 +00:00
Donny/강동윤andClaude Opus 5.5 a2d0363128 feat(desktop): add the @e2e-dev/desktop engine on agent-desktop (#1953)
* feat(desktop): add the @e2e-dev/desktop engine on agent-desktop

A desktop engine for native and Electron apps, built on agent-desktop
(vercel-labs, Apache-2.0), which reads and drives apps through the OS
accessibility tree. macOS is the tested platform; this is rollout phase 1
of the ENG-1352 proposal.

- The engine downloads the pinned agent-desktop 1.3.1 release in prepare
  and checks its SHA-256; the npm package is not a dependency because its
  postinstall would fail check:install-scripts.
- Fill text reaches agent-desktop on stdin, never in its arguments.
  Screenshots are cropped to the window and paint every secure field black,
  and are withheld when a secure field has no bounds or the snapshot was
  partial.
- Node ids stay stable across observations, so the agent gets diffs.
- The engine quits only the process it launched, checked by its process
  instance.
- apps/desktop-testbed holds an AppKit sign-in form with deterministic and
  agentic suites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): accept the remaining budget in the fill arguments

The timeout agent-desktop gets is what is left of the operation's
deadline, so it can be a millisecond under the full budget on a slow
runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): report field values whole and keep a typed-into field's id

locate answers single-node reads, which the contract says carry the whole
value; the harness cuts what the agent sees. An unnamed field's identity no
longer includes its value, so typing into it is a change, not a remove and
an add. An image is projected as the contract role image, which both
locator spellings resolve to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): withhold a capture with a border instead of masking it in place

A capture within four pixels of the window was taken as the window, so a
two-pixel border shifted every mask. Only a pixel of rounding is accepted
now, any other capture is cropped to its opaque box, and each mask reaches
two pixels past its field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): give a read exactly its budget

The 500 ms floor exists so a click that landed is not reported as cut off;
a read has no such reason and now stops at the operation's deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): keep agent-desktop out of the replay cache and report install failures

E2E_CACHE_DIR names the replay cache, which a project may commit, so the
binary goes to the OS cache directory only, found from the run's
environment. A network or tar failure in prepare is now
AGENT_DESKTOP_INSTALL_FAILED, as the docs say.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): offer doubleTap only with headed, and say what app.open and settle do

agent-desktop double-clicks with the real pointer only, so doubleTap is
declared with headed: true and sent with --headed. The docs said app.open()
quits the app if it runs; it quits only the copy the engine launched. settle
is a fixed wait, not a check that the UI is still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): drive only the launched process, and keep ids and the select ladder honest

- Every read and scoped command goes to a window of the process the engine
  launched; before app.open() or after the app quit, the engine reads and
  drives nothing, so a developer's own copy is never touched.
- With appPath, the launched executable must come from that bundle; another
  copy registered under the same bundle id fails the open.
- quit keeps the process as the engine's own until it is known to be gone,
  so a failed lookup is reported and dispose tries again.
- Node identities are scoped to their window and retired once gone or
  ambiguous, so neither a twin nor another window's control inherits an id.
- The select ladder passes the label after --, reports a stale ref as
  NODE_STALE, and stops once any command of a way reached the app.
- A press on a control that refuses focus is refused unless it holds focus.
- A root swipe after a restart reads the window again.
- app.open() waits at most 30 s for a readable window, reports any other
  read failure as it is, and is cancelled with its operation.
- A screenshot is withheld when the window read after the capture differs
  in its secure fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): read placeholders, mixed checkboxes, and depth-cut trees as agent-desktop reports them

- A placeholder comes from agent-desktop's own placeholder field; the hint
  is kept as an attribute of its own.
- A mixed checkbox reports no checked state, so check() and uncheck() always
  reach the control instead of returning early.
- A node that counts children it did not list (the depth limit) marks the
  tree as cut short, so a screenshot from it is withheld.
- Siblings that share a developer id (AppKit menu items) tell themselves
  apart by name and keep their ids; a status with a developer id keeps its
  id while its text changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): launch an appPath by path and keep every process a launch started

- An appPath bundle is opened by its path (open -n), and the new process
  running from it is taken as the engine's own; launching by bundle id let
  LaunchServices pick another copy with the same id.
- A launch that failed after the app started still leaves the engine owning
  the new process, so the end of the attempt quits it.
- A window is the engine's only when its process instance matches too, so a
  later process given the same pid is never read or driven.
- An app list that is incomplete keeps the process the engine's, to quit
  again in dispose.
- A point action finds the window where it is now, so it works right after
  app.open() and after the window moved.
- A type or fill after a clear that changed the field fails as
  ACTION_MAY_HAVE_COMMITTED, never as a retryable stale ref.
- A screen larger than the binding cap keeps every node it just read.
- The launch wait is 10 s, and each read in it gets what is left of it.
- A bundle id that names no app says so, instead of asking for app.open().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): refuse an archive with the wrong SHA-256 and cache nothing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(desktop): say app.open brings the app forward, and that only macOS is tested

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): never take another copy as the launched one, and aim point actions at their window

- A launch agent-desktop refused takes no process as its own, and a copy is
  attributed to a launch by id only against a whole app list from before it,
  so cleanup never kills the developer's copy.
- A launch whose outcome is unknown is kept pending and settled by the next
  quit under its own budget, so a timed-out launch still has its app quit.
- A point action goes to the window it was observed in, wherever it is now,
  refuses a point outside that window, and brings it forward before the
  physical click.
- In the select ladder, ELEMENT_NOT_FOUND from select (no such option) goes
  on to the next way; from a command on the list itself it is NODE_STALE.
- A root swipe scrolls the window as it is now.
- With both appPath and bundleId, the appPath build is launched and its
  bundle id must match.
- An open that runs out of its own budget is OPERATION_TIMEOUT; only the full
  launch wait reports an unreadable window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop-testbed): check the saved screenshot for the password field's mask

The test checked only that the file was a PNG, which an unmasked capture
also is. It now decodes the image and requires the solid black bar the
password field's mask paints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(desktop): say which app launches when appPath and bundleId are both set

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): report a read agent-desktop timed out as OPERATION_TIMEOUT

TIMEOUT was NOT_ACTIONABLE for reads as well as inputs, so a snapshot that
ran out of time skipped the launch wait's timeout handling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): tell the launched process apart by a token, and measure points in their window

- Every launch passes a one-time token in the app's environment
  (launch --env, open --env), and a process is the engine's own only when
  ps -E shows that token. Guessing from the app list before and after a
  launch could take, and kill, a copy the developer or another worker
  started at the same time.
- A launch whose outcome is unknown is settled by the next quit, which looks
  for the token for up to 3 s and reports a failure when it finds none.
- A point is measured in the window of the newest screen observe or locate
  handed out, and sent unrounded, so it never lands past the window's edge.
- check and uncheck always go to agent-desktop, which reads the live state.
- One window's node ids stay while another window is read.
- The launch wait's commands share its deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): pin option and app validation and the headed-only actions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop-testbed): measure the password mask at the capture's scale

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): keep identities from colliding, and never drop a secure node

- A node identity is a tagged tuple, so a developer id and a name can never
  spell another control's identity (`shared` + `Edit:` against `shared:Edit`),
  which let one control take another's binding.
- A secure node is never dropped as a wrapper, so its bounds are masked.
- A binding records the window its node was read in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): press keys only into a focused control, type keystrokes, and check the launched process's token

- A press on a control needs its focus to succeed and to hold, and goes into
  the control's own window; before, a refused focus sent the key to
  whatever window had focus.
- The keyboard capability is declared with headed only and types with
  --headed: without physical input agent-desktop sets the text, and the
  contract asks for keystrokes the app's handlers see.
- The process agent-desktop reports for a launch must carry the launch's
  token; a launcher that handed over to a copy already running (a Linux
  desktop file) fails the open and never drives or quits that copy.
- A select that finds no such option never falls through to set-value,
  which would type the label in as free text; a menu left open after a
  missing option is reported as a changed app.
- A read tries the launched app's windows in turn, past a panel
  accessibility cannot read.
- No app bundle is opened once the operation's budget is spent.
- doctor fails an appPath with no Contents/Info.plist.
- The unused latest-screen field is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop-testbed): require a mask the size of the password field, not one black row

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(desktop): ship a NOTICE like every other published package

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(desktop): say typing into whatever has focus needs headed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): withhold masks with no area, and give controls their title as text

- A secure field whose box has no area masks nothing, so the screenshot is
  withheld.
- A control reports its title as its text, as on a device, so
  textContent() reads a button's title; an input's name is a label, so it
  gets none.
- A binding keeps its node's box, to find a look-alike again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): find a pressed look-alike by its place, keep unresolved launches, and test on the host's ps

- A press checks focus on the control found again by role and box, since a
  look-alike has a new id in every read; the key is resolved before focus
  moves, and a node read in no window is refused.
- An environment that cannot be read (a macOS system app under SIP, a
  failed lookup) is no evidence: agent-desktop's report of the process it
  launched stands, so system apps open again and are quit at the end.
- A pending launch stays until it is claimed or a whole wait finds none.
- A window row is the engine's only with the launched process instance.
- A screenshot finds secure fields in whole reads of the window, even with
  interactive snapshots, which leave out a secure node with no action.
- A menu read in part never reports an option missing.
- The unit tests read process environments the host's way (ps -E or
  /proc), so they pass on the Linux CI runner, and remove the fake's
  scenario directories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): dispose every surface a test creates, so no state directory is left behind

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(desktop): drop Electron, so the engine targets native apps only

Electron apps are out of scope for this engine. Remove the paths that
existed only for them: the headed type fallback for a field the
accessibility API cannot set (Electron on Linux), and the expand and
menu-click steps of the select ladder (Electron on Windows and macOS).
A select now tries `select`, then sets the value of a list that takes
none (WinForms), and reports an option `select` cannot find as missing.

The Electron snapshot fixtures go too; the wrapper and shared-id tests
use the AppKit sign-in form and an inline AppKit menu. Docs, the
README, package metadata, and the skill now say native apps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(desktop): match the workspace's vitest 5.1.1

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(desktop): apply the review of #1953

macOS only. prepare and init refuse any other OS: on Windows and Linux
some actions need physical input and GTK's password field is not
reported as secure, so masking would fail open. A config with a desktop
target still loads elsewhere.

The app under test and agent-desktop get only HOME, USER, LOGNAME,
SHELL, PATH, TMPDIR, LANG, LC_*, and __CF_USER_TEXT_ENCODING of the
run's environment, so secrets, model keys, and CI tokens never reach
them. `open` and NSWorkspace both handed the caller's whole environment
to the app.

The app launches in the background (`open -g`, `launch` without
`--activate`) unless headed, so typing at the Mac no longer lands in it.
An app that shows no window after 2 s is brought forward once.
Every launch passes -ApplePersistenceIgnoreState YES.

An appPath app whose environment cannot be read (a system app, a build
signed with `restrict`) is now claimed as the single new copy that was
not running before the launch, instead of polling until the test timed
out and leaving the app running. A launch reported for a copy that ran
before it is refused. An open that finds no process fails within 10 s.

select no longer falls back to set-value, which could type a missing
option into an editable combo box. press sends a key only when the
control's window is the app's key window, and finds the control again by
its stable id. locate fails on a truncated read with no match instead of
proving absence. The reads a screenshot's mask takes hand out no ids.
The window's own Close, Minimize, Zoom, and Full Screen buttons are left
out of the tree. desktop.useWindow() picks the window screen reads.

Stale state directories of killed workers are swept at init. The cached
agent-desktop is reused only when a verified unpack stamped it and its
executable and helper are intact. doctor says the permission checks need
the first run. A pending launch whose lookup timed out stays pending.

Tests: the screenshot-moved test now uses the window the fake lists, and
a steady capture is checked to succeed. Each fix has a test that fails
without it (checked by mutation). The testbed checks the password
field's own box is black and the field beside it is not, and
test:desktop-testbed builds the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): keep launches pending after open, and fix four review gaps

A fresh-context review of f0d1bb69f found these, each now with a test:

- openBundle: a failure after `open` ran (a list-apps error, or the
  budget running out while looking) was read as "nothing was sent", so
  the copy `open` started was never quit. Any failure after `open` is
  now ACTION_MAY_HAVE_COMMITTED and leaves the launch pending.
- An app that quits right after launch now fails the open at once,
  before the engine brings its bundle forward, which would have started
  a copy the engine does not own.
- A node inside a look-alike container is no longer marked stable: its
  id is built on its parent's, which is new in every snapshot, so press
  finds it by place again.
- Only a title-bar-sized button (at most 20 points) with a window
  control's name is left out; an app's own Close button stays.
- A window chosen with desktop.useWindow() that closed is now
  INVALID_STATE, not an empty screen a negative assertion would pass on.
- The release cache is swapped by rename instead of deleted first, and
  doctor checks the stamped copy, not only that the file exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): send keys and close select menus in the background, and quit apps killed workers left

Found in live runs on an unlocked Mac:

- A key press never reached an app in the background: agent-desktop
  sends a key to a named window only while that window is active, and
  answered STALE_REF, which the harness retried until the step timed out.
  The key now goes to the process by its app name, once the engine saw
  its copy is the only one with that name; with another copy running,
  press fails at once with NOT_ACTIONABLE and says to use headed.
- selectOption of a missing option on a pop-up button opened its menu,
  waited out the whole action budget, and left the menu open. select now
  waits at most 3 s; a menu it left open is closed with Escape and the
  option reported missing (NOT_ACTIONABLE), the list unchanged.
- A worker that was killed left its app running. Each worker records
  the app it launched and its token; the next run's sweep quits that app
  while its environment still shows the token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): sweep a state directory whose launch record was cut short

A worker killed while writing app.json left half a JSON record. The sweep
parsed it inside the promise's success handler, so the SyntaxError escaped
and every later init failed on the same stale directory. A record that does
not parse now names no process and the directory still goes, and the record
is written to a side file and renamed into place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): keep the state directory when dispose could not quit the app

dispose removed the state directory even when its quit failed, and app.json
went with it, so the next run's sweep had no pid and token to quit the
leaked app by. The directory now stays while the engine still owns a process
it could not quit; the owner file names a worker that is gone by then, so the
sweep removes the directory after it quits the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): claim a copy with no readable token only from whole app lists

Two paths took a process as the launch's own on evidence an incomplete app
list cannot give, and the engine later kills what it owns:

- launch by bundle id accepted agent-desktop's reported pid when its
  environment could not be read and the list before the launch was partial,
  so a copy already running could not be ruled out;
- claim() took the single new unreadable copy from a list after the launch
  that left copies out, where a second new one could hide.

The first now refuses the launch and leaves the process alone. The second
reports that it cannot tell; quit keeps the launch pending as it does for a
lookup that ran out of time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): give a background key only what is left of its budget

sendKey built its command options once, so the key sent by the app's name,
after a refused window press and a list of the apps, still carried the budget
the operation had at its start and could run past the deadline. The options
are now built for each command from the time left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): keep a select whose menu was left open as possibly committed

After a select that may have reached the app, closing a menu the app had
open was taken as proof that the option was missing and nothing was chosen,
and reported as NOT_ACTIONABLE. An open menu shows neither: it does not say
which control opened it. The failure now stays ACTION_MAY_HAVE_COMMITTED,
naming the option the list may lack, after the menu is closed. A failure to
close the menu (Escape refused while another copy runs) no longer replaces
the select's own error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): measure a point from the window useWindow() chose

performAt measured a point from the window the last read used. After
desktop.useWindow() picked another window, the next tapAt still brought the
old window forward and clicked there. Choosing a window, or going back to the
focused one, now drops that window, so the next point action measures from
the window in use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): read no empty screen from an app that cannot be read

capture() skipped every window it could not snapshot and returned no screen,
so observe showed an empty window and locate found nothing. While the screen
is locked, or after the app crashed, not.toBeVisible() then passed. Opus
reproduced it against the testbed app on a locked Mac.

Now:
- listed windows none of which could be read are a retryable NODE_STALE,
  so a locator reads again until its deadline;
- a chosen window whose snapshot says it is gone is INVALID_STATE, like
  one missing from the list;
- an app whose process is gone is INVALID_STATE.

An app with no window at all still reads as an empty screen. The launch's
readiness wait treats the new errors as a window not readable yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): count no matches in a window read in part

locate() refused a partial read only when nothing matched, and then with a
non-retryable ENGINE_FAILURE. One visible match in a read cut short still
counted as exactly one, though a second could sit in the part left out, so
a strict action or toHaveCount(1) could pass on it. And a locator for a
control not there yet failed at once instead of polling.

A partial read is now a retryable NODE_STALE whatever it matched, so the
locator reads again until its deadline. The docs say so for a window deeper
than the 24 levels a snapshot reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(desktop): correct getByText on buttons, and macOS-only metadata

- The desktop page said getByText cannot find a button by its title. The
  projection gives a button its title as text too, so it can; getByRole is
  what limits a match to the button.
- The package keywords listed windows and linux, which the engine refuses.
- CONTRIBUTING said a contract change bumps both engines; there are three.
- @e2e-dev/desktop moves to its alphabetical place in the docs package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): cover the appPath launch and a successful install

Every surface test launched by bundle id, so a change to the open -g -n
arguments, the claim of the copy carrying the token, or its quit would not
fail a test; and the binary tests covered only failed installs.

- An appPath test puts a fake open first on PATH: it records its arguments
  and starts a process with the variable --env names, which the engine
  claims, reads, and quits.
- An install test serves an archive of its own through a digests table
  installPinned now takes (the pinned one by default), installs it twice
  at once, and checks the stamp, that nothing is left beside the entry, and
  that a third install fetches nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): find the app's running copies the way agent-desktop launches it

runningCopies() and claim() listed every app and kept the ones whose
bundle id or name equalled the target exactly. agent-desktop reports the
localized name (Calculator is 계산기 on a Korean Mac) and matches a launch
target in any case, so a copy the launch could hand over to was left out of
the list before it. A copy whose environment cannot be read was then taken
as the launch's own and killed at the end of the test; and a copy a launch
of unknown outcome started was never found, and left running.

Both now ask list-apps --app <target>, which matches the way the launch and
quit() do, and count every process it returns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): stop the fake apps before removing the list of them

afterEach ran cleanupFakes() first, which deletes the file fake.spawned()
reads, so the processes a test left running were never killed and stayed
for their 60 s timer. They are now killed first; no stand-in process is left
after the suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): report an open LaunchServices refused as starting nothing

openBundle wrapped every failure of open as ACTION_MAY_HAVE_COMMITTED, so a
bundle LaunchServices refused (a missing executable, a bad signature) left the
launch pending. The end of the attempt then looked for its process for 3 s
and failed a second time, telling the user to quit an app that never
started. The error also quoted the whole open command line.

An open that exits with an error, or cannot run, is now ENGINE_FAILURE with
open's own message, and nothing is left to look for. Only an open the budget
or a cancellation stopped stays possibly committed. The appPath tests share
a helper that puts a stand-in open on PATH.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): record the launch token before the launch, and sweep by it

app.json was written only once the launch's process id was known. A worker
killed during the launch (which can wait up to 10 s for its process), or a
launch whose process was never found, left no record, and dispose then
deleted the state directory too. The next run could not find the app.

The record now holds the launch token and is written before anything is
sent. dispose keeps it while a launch is pending, as it does for an app that
would not quit. The sweep quits every process whose environment carries the
token, found by listing the processes, so it needs no process id and
cannot reach a process that took one over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): act on no node read outside the window useWindow() chose

useWindow() changed the window every read used but kept the nodes read
before, so an action on a ref from the old window still reached its control
after a test chose another. Such a ref is now NODE_STALE, which the harness
answers by locating the node again in the window in use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): read no empty screen from an app whose process id was reused

With no window of the launched process listed, capture() checked only that
its process id was alive. Once the app quits, macOS can give that id to
another process, so the read showed an empty screen and a negative assertion
could pass. The app list must now show the same process instance; a list
that left copies out is a retryable NODE_STALE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): make doctor check an appPath bundle the way init does

doctor passed any bundle with a Contents/Info.plist, while init also needs a
CFBundleIdentifier in it, equal to app.bundleId when that is set. A bundle
doctor passed could then fail init, and a plist with no bundle id failed init
with plutil's raw error. Both now use one check, which reports a missing or
mismatched bundle id as the problem.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): never move another install's verified release out of the cache

download() checked whether the cache entry was usable and, if not, moved it
aside before renaming its own unpack in. Two installs that both found no
usable entry could interleave: the second moved aside the release the first
had just put in place, and a worker starting between its two renames found
no executable. The unpack is now renamed into place first. A rename onto an
existing entry fails, and then the entry is used if it checks out, and moved
aside only if it does not.

The race has no deterministic test; a new test covers replacing a damaged
entry, the path this reorders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(desktop): say when two desktop targets share a run, and what reads empty

- The workers line said two desktop targets can run at the same time
  while telling headed runs to set workers: 1, which is what stops them.
  It now says they do, and why headed runs set workers: 1.
- The Reading row and capture()'s comment said a window is never read as
  an empty screen, but an app with no window open still is, on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(desktop-testbed): pin ai to the version every other workspace uses

The testbed pinned ai 7.0.173 while the rest of the repo pins 7.0.177, which
put a second copy of ai and its gateway and provider packages in the
lockfile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): report an open cancelled mid-launch as CANCELLED

An abort while open ran, or while the engine looked for the process it
started, came out as ACTION_MAY_HAVE_COMMITTED, where every other path of
the engine reports CANCELLED. It is now CANCELLED; the launch stays pending
as before, so the end of the attempt still looks for the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): settle a pending launch by its last lookup and by its token

quit() dropped a pending launch, and dispose its record, once any lookup in
its wait had a whole answer. Two cases lost an app that was still starting:

- an early complete list with no match, followed by partial ones that could
  hide the app once it registered;
- a process carrying the launch's token that the app list did not show yet.

Now only the wait's last answer counts; a lookup that ran out of time is no
answer. Before giving up, quit looks for processes carrying the token and
quits them. The launch stays pending, and its record kept, unless the last
answer was whole and found nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): run launches and quits of one surface one at a time

Two overlapping app.open() calls could both quit, then both launch, writing
into the one process id and launch record the engine keeps; they even shared
the app.json.partial file. The end of the attempt then quit only one copy.
restart, closeApp, endAttempt, and dispose now wait for the launch or quit
running before them. restart's budget counts from the call, so the wait is
part of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): measure a headed click from where the window is after focus

performAt read the window's bounds, brought the window forward, and clicked
at the bounds read before. A window that moved as it came forward (onto
another space, out from under the menu bar) took the click somewhere else,
possibly another app. The window is now read again after focus-window, and
the point is checked against and measured from its bounds then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): repair a damaged cache entry under a lock

12c8f64d0 renamed a fresh unpack into place first, which keeps a run from
moving aside a release another run just installed only when there was no
entry. Two runs that both found an entry damaged could still interleave: the
second moved aside the copy the first had just put in place. Its commit
message and comment claimed more than that.

Replacing an entry now holds a lock directory that names its owner's process
id, and checks the entry again under it. A lock whose owner is gone, or that
got no owner and is 10 s old, is taken over; one held for 60 s fails the
install with AGENT_DESKTOP_INSTALL_FAILED.

Tests repair one damaged entry from three runs at once and take over a lock a
dead process left. The interleaving itself has no deterministic test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): refuse getByPlaceholder, which macOS gives nothing to match

agent-desktop's macOS adapter reports no placeholder for a field; AppKit
folds it into the accessible name of a field with no label. A placeholder
query therefore matched nothing, and not.toBeVisible() or toHaveCount(0) on
it passed with the field on screen. locate() now refuses any expression that
uses a placeholder query with UNSUPPORTED_CAPABILITY, naming getByRole as
the way to find the field, and the docs say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(desktop): let desktop({ maxDepth }) set how deep a read goes

A read cut short at the fixed 24-level depth makes every locator on that
window read again until its timeout, since a match could sit below it. An
app nested deeper could not be tested with locators at all. maxDepth, from
1 to 255 (agent-desktop's limit), defaults to 24 and raises it; the partial
read error names the option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): accept the verified cache copy a run published mid-repair, and keep a launch record when its process lookup fails

A run that finds no cache entry publishes without the lock, so it can fill the gap a locked repair makes between its two renames; the repair then failed with ENOTEMPTY although the cache held a verified release. The repair now accepts a usable copy there.

A failed process listing was read as an empty one, so the stale-worker sweep deleted the record that names the app a killed worker left running. The listing now reports failure apart from none found: the sweep keeps the owner and launch records (removing only the cached field text beside them), and an attempt's quit keeps its pending launch and retries.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(desktop): publish the agent-desktop cache without a lock, keeping a verified winner

The fast path renamed a fresh unpack into place without the lock that the
repair of a damaged entry held. A run that published while a repair had
moved the damaged entry aside made the repair's own rename fail with
ENOTEMPTY, though the cache now held a checked release (seen on the Node
22.22.3 and Node 26 CI jobs). The lock's stale-owner takeover could also
remove a lock another waiter had just taken.

Every run publishes a copy of the same checked release, so the lock is
gone: a rename that collides with an entry accepts it once it is checked,
a damaged entry is moved aside by one rename that only one run wins, and a
whole copy moved aside by a run that saw the entry damaged earlier goes
back. Two tests hold one run at each of those points while another installs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): show a whole cache entry without the right stamp is downloaded again

The stamp test's entry had no executable or macOS helper, so it was
downloaded again even with the stamp check removed. The entry now has
both, and a missing stamp and one for another release each force a
download.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): take a launched process as the engine's own only by its launch token

When no environment could be read, a launch took the one new copy of the
app as its own, and a cleanup after an uncertain launch could quit it.
Being new does not show this launch started it: a copy the developer
opened at the same moment is new too, and was killed in a scripted probe.

A copy is now claimed only when it carries the launch token. agent-desktop's
launch, which reports the process it started, still stands for an app
launched by bundleId. An appPath to a bundle whose environment macOS hides
(an Apple platform app, a build signed with the restrict flag) is refused
by init and doctor, which name the bundleId to use instead, so open never
starts a copy the engine could not find again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): keep a launch record until cleanup confirms its process is gone

A process lookup that failed read as an empty list: the sweep then
deleted a killed worker's launch record, and the next sweep left the app
running though the lookup worked again. The record held only the token,
so a process the worker had identified, whose environment cannot be read,
could not be found by a later run. A dispose whose quit failed kept the
whole state directory, with the text agent-desktop keeps of the fields.

A failed lookup is now no answer: the pending quit fails and keeps the
launch, and the sweep keeps the record. A kill waits for the process to
exit before the record goes. Once a process is shown to be the launch's,
the record also names its id and start time, so a later run quits it
without reading its environment, and never a later process given that id.
Dispose and the sweep keep only the owner file and the record, and remove
the field text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): never bring a background app forward to ask it for a window

An app launched in the background that showed no window for 2 s was
brought forward with a second open by path, bundle id, or name. That open
did not name the process the engine launched, so LaunchServices could
bring another copy forward, and it took the keyboard the guide promised
to leave alone.

The background launch now stays in the background. An app that opens no
window there fails the open with a message that it needs
desktop({ headed: true }), whose launch brings the app it starts forward.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): send a key only to the launched process's window, never by app name

agent-desktop refuses a key for a named window that is not active, which
an app in the background never is. The engine then sent the key by the
app's name once a list of the apps showed its copy alone, even a list
agent-desktop marked incomplete. The name does not pin the process, so a
copy that started between the list and the key could get it.

The fallback is gone: a refused key fails as NOT_ACTIONABLE, and nothing
is sent. Since a key then reaches an app in the background only by chance,
press joins the actions only headed offers, so a locator press without
headed fails as unsupported before it moves focus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): never retry a press whose focus already moved

A locator press focuses the control, reads its window to check the
control kept focus, then sends the key. A stale read after the focus was
retryable, so the locator ran the whole press again and focused the
control a second time, which an app's focus handler sees. A retryable
failure after the focus is now ACTION_MAY_HAVE_COMMITTED; one before it
stays retryable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): show a select that may have reached the app stays possibly committed

Removing the delivery check from the select's ELEMENT_NOT_FOUND mapping
left every select test green. A select whose failure agent-desktop marks
delivered_unverified must stay ACTION_MAY_HAVE_COMMITTED, not "no option".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 14:34:19 +00:00
5b61f221aa fix(core): stop launch() hosts from driving one mobile device (#2008)
* fix(core): give each launch() host a target name of its own

Every launch() host named its target after its platform and started as
worker slot 0, so every mobile host drove the agent-device session
e2e-ios-0: the session of another host, or of a runner worker on an
unnamed ios target. The mobile pool keeps a device its own session name
holds, so the host took that device and both tapped one screen.

A host's target is now <platform>-launch-<pid>-<n>. An agent's replay
cache keys to the platform, so recordings still replay on any host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): draw a random token per launch() host, renamed after resolution

The pid and a module counter repeated across worker threads and across
two copies of the package in one process, so two hosts could still share
a device session. A random token per host does not. The platform part is
cut to 40 characters, so a long engine name still fits in the artifact
folder name, and the target is renamed only after its config resolved,
so config errors name the target as the program wrote it. The replay
cache keys on the resolved name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): leave a long platform out of a launch() host's name, and forget finished bindings

A platform cut to 40 characters could keep part of a secret the
redactor only knows whole, so a longer platform is left out of the name.
The token is 96 random bits. The mobile engine's finish now forgets the
target's bindings, so one engine reused by host after host no longer
keeps every finished host's device and daemon address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(core): say how several launch() hosts share a machine's devices

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(core): say when appPath hosts can share a device, and test the 40-character name boundary

A host holds its device once its app opens, so two appPath-only hosts
launched back to back can bind one device. The recovery command now
takes the session name from the error, quoted, and names daemon stop.
The changeset said "the token alone" where the name is host-<token>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): name a launch() host's artifact folders after its token, not its platform

An engine's platform can be a secret's value, and the folder name
core/<target>-<attempt> put it on disk under artifactsDir, where
redaction never reaches. The folders are now core/host-<token>-<attempt>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(core): install an appPath build before opening it, and keep recovery to what the error names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): pass launch() hosts to engines as hostId, keep target name

The random token no longer renames the host's target. Core hands it to
prepare, init and finish as hostId, and the mobile pool adds it to the
session name: e2e-<target>-<token>-<slot>. Fixtures, notices, errors,
provider tags and the replay cache key see the target name the program
wrote, so the cacheTarget indirection and the 40-character rule go.

* test(mobile): check a launch() host's init resumes the session its prepare warmed

The pool test now also has the host keep a device its own session holds
and runs init with the host's id: a surface whose init named the session
without hostId passed the old test and fails this one. Also moves the
SessionNamer doc comment back above its type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): hand a launch() host's device bindings over a variable of its own

With the target keeping its name, a host opened inside an `e2e run` test
inherits the run's environment, where the run already left its bindings
for a target of the same name. A host's worker without the bindings in
memory (an engine served in another process) read the run's and drove
the device the test holds. The variable's digest now includes hostId.

Also names the host form of the session in `DeviceSession.session` and
the reference's `session` default, and mirrors the session option's
comment into the ja and zh references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): fail a launch() host's close when its session stays open

A host's session name carries a random hostId, so no later host or run
takes its device back by name. finish now reports a session that will
not close, with its name, and counts one that is already gone as closed.
A run's worker and a session option keep their names and stay quiet.

Also from review: raise the @e2e-dev/core peer floor to 0.24.1, the
first release that sends hostId; bump e2e and web in the changeset and
say what a crashed host leaves behind; use pnpm dlx for agent-device in
the docs; drop a test that passed on main.

---------

Co-authored-by: michal-e2e <357875193+michal-e2e@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
2026-11-21 13:33:12 +00:00
Kazutoyo TokaiandClaude Opus 5.5 6fbadcb7cd docs(ja): catch up with English changes (#2032)
* docs(ja): catch up with English changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDfGr6hZCd7ns31Y2WN

* docs(ja): keep the mcp limits sentence literal, fix the uninstallApp device note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDfGr6hZCd7ns31Y2WN

* docs(ja): address review on the catch-up

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDfGr6hZCd7ns31Y2WN

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:32:17 +00:00
Kazutoyo TokaiandClaude Opus 5.5 9358e32323 docs(ja): smooth the wording on the CLI, config, and runner reference (#2027)
* docs(ja): smooth the wording on the CLI, config, and runner reference

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDfGr6hZCd7ns31Y2WN

* docs(ja): address review on the ref-runner wording

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDfGr6hZCd7ns31Y2WN

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:32:07 +00:00
Kazutoyo TokaiandClaude Opus 5.5 2c335e9c98 docs(ja): smooth the wording on the test API reference (#2026)
Claude-Session: https://claude.ai/code/session_01Mn9zDfGr6hZCd7ns31Y2WN

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:32:05 +00:00
Kazutoyo TokaiandClaude Opus 5.5 c37d375d5f docs(ja): smooth the wording on the engine authoring pages (#2025)
* docs(ja): smooth the wording on the engine authoring pages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDfGr6hZCd7ns31Y2WN

* docs(ja): address review on the engines wording

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDfGr6hZCd7ns31Y2WN

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:32:03 +00:00
Łukasz LechandClaude Opus 5.5 1d28ac0fea feat(mobile): add device.isKeyboardShown() (#1893)
* feat(mobile): add device.isKeyboardShown()

Returns whether the soft keyboard is on screen from one capture: the
keyboard agent-device reports (a measured or derived frame, or a
visibility probe), else visible keyboard elements in the tree, the same
band observations hide covered nodes under. A capture that cannot answer
(no keyboard in a sparse or cut tree, or keyboard elements agent-device
rejected with no probe) fails with ENGINE_FAILURE instead of guessing.

Refs #1855

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(i18n): mirror the isKeyboardShown heading and rows in ja and zh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(mobile): note that isKeyboardShown reads the screen as it is now

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): answer isKeyboardShown only from what the capture can prove

- An unmeasurable keyboard reading answers false only for the reasons that
  say agent-device read the whole tree; a capture that could not see the
  keyboard's window fails with UNSUPPORTED_CAPABILITY.
- A rejected docked frame with no probe reads as shown: agent-device
  rejects one only for a tree that lists keyboard elements, as a keyboard
  still sliding in does on an iPhone.
- The incomplete-tree failure no longer claims a retryable flag that
  EngineError drops for ENGINE_FAILURE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): read the keyboard by one rule and answer false only on proof

Review follow-up for isKeyboardShown:

- keyboardShownIn moves to keyboard.ts and is the one rule:
  dismissKeyboard's check is keyboardShownIn === true.
- Only agent-device's `absent` (or a probe that says hidden) answers
  false. keyboard-not-observed and keyboard-visibility-probe-unsupported
  now fail with UNSUPPORTED_CAPABILITY.
- Tree answers count keyboard elements drawn on screen only, so a
  keyboard left in the tree off screen does not read as shown.
- A tree-rejected reading with no on-screen key is the keyboard moving:
  both isKeyboardShown and dismissKeyboard capture again, briefly, before
  they answer.
- The benchmark test taps the field first, since a fill on Android opens
  no input method, and polls both reads.
- The ja and zh Throws tables are translated, and the Appium guide notes
  that the call reads the screen as it is now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(mobile): say a keyboard reading can take several captures

isKeyboardShown's JSDoc and the reference said one capture, but a
keyboard still moving is captured again. keyboardShownIn's comment now
names what it decides instead of every keyboard check (observations
report measured state only), and the unsupported message says the tree
shows no keyboard drawn on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(mobile-benchmark): read the keyboard on iOS only

The Android emulator in CI draws no soft keyboard, even for a tapped
field, so isKeyboardShown polled false until it timed out. The keyboard
reads move to their own iOS-only test, and the onboarding test is back
to what main has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): start the keyboard drag above every element that says the keyboard is up

The drag's top edge came from keys alone, while isKeyboardShown also counts
the suggestion strip, so a capture that lists only the strip (a hardware
keyboard) dragged from under it. The reference example now polls the read
after dismissKeyboard, and the changeset notes the transition wait follows
the same rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(mobile): say the strip drag starts above the strip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(mobile): pin the drag above the strip when keys sit under it

The strip-only test could not tell the highest keyboard element from any
of them. It now also lists the strip above the keys, with the strip holding
only text so nothing but the keyboard's top keeps the drag off it. The
drawn-keyboard predicate is one helper that keyboardBand and
keyboardElementsTop both read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): refuse a keyboard drag when nothing bounds the keyboard

A visibility probe that says the keyboard is up, with no frame and no
keyboard element on screen, left keyboardTop at the bottom of the screen, so
the drag could start on the keyboard. dismissKeyboard now fails with
UNSUPPORTED_CAPABILITY there instead of guessing. The strip test's
assertion names the failing y.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): read the soft keyboard from keys, and keep each look in the budget

The suggestion strip alone, as XCTest lists it with a hardware keyboard, no
longer reads as the soft keyboard shown; it still bounds where the
dismissing drag may start, now also above a measured or derived frame. The
settle loop reserves the last capture's time along with its backoff, so a
slow capture after the drag no longer times the dismissal out. A capture
with no viewport and no window places no keyboard on screen, since the
tree's own extent holds the keyboard it is asked about.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(mobile): say expect.poll reads isKeyboardShown again after any error

A lasting UNSUPPORTED_CAPABILITY makes the poll wait out its timeout; the
docs implied only ENGINE_FAILURE was read again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:58:41 +01:00
Samanyu DasandClaude Opus 5.5 7a8e546e26 fix(mobile): fail toHaveScreenshot with POLICY_DENIED when a secure field can't be masked (#2014)
* test(mobile): expect a screenshot mobile withheld to be refused for masking

On mobile, a screenshot the engine cannot mask is withheld with no sign it
was ever taken, so toHaveScreenshot waits out its timeout and fails with
ASSERTION_FAILED, and the agent is told the engine captures no pixels. These
tests expect the engine to report the regions it masked (none) beside the
missing pixels, toHaveScreenshot to fail at once with POLICY_DENIED, and the
agent to read MASKING_UNPROVEN. A screenshot that was never taken, or one
withheld with every secure field masked, still keeps the matcher waiting.

Refs #1996

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): fail toHaveScreenshot with POLICY_DENIED when a secure field can't be masked

When a secure node on the mobile screen has no bounds, the engine cannot
mask it, so it drops the screenshot and reports nothing else. The session
could not tell that from a screenshot that failed, and the matcher checked
for missing pixels before it checked masking, so it polled until its timeout
and failed with ASSERTION_FAILED and "the engine returned no screenshot". On
the web the same case fails at once with POLICY_DENIED, which is what the
docs and AGENTS.md promise. The agent had the same gap: it was told the
engine captures no pixels (UNSUPPORTED_CAPABILITY) instead of
MASKING_UNPROVEN.

The engine contract now lets an engine withhold a screenshot it could not
mask by reporting maskedRegionCount without pixels. The mobile engine does
so for a secure node without bounds. An image it cannot read or decode is
still no screenshot, so the matcher takes another. When the count falls
short of the secure nodes, the session marks the observation
pixelsWithheld: 'MASKING_UNPROVEN', the token the agent already uses for
unproven pixels. toHaveScreenshot fails with POLICY_DENIED on it, and the
agent passes it on. A screenshot that was never taken (the web engine
mid-navigation, a failed device capture) reports no count, so the matcher
keeps waiting for it as before.

app.screenshot() on the same screen failed with ENGINE_FAILURE (exit 3)
for the same cause. It now fails with POLICY_DENIED too, as AGENTS.md
asks for withheld pixels. An image that cannot be decoded keeps
ENGINE_FAILURE, since there is no screenshot to withhold. Failure evidence
and agent evidence screenshots catch every error, so neither changes.

Fixes #1996

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(core): decide withheld pixels once, in the session

The session now keeps pixels on an observation only when the masked regions
cover every secure node, and marks any screenshot the engine took without
that proof, sent or withheld, as `pixelsWithheld: 'MASKING_UNPROVEN'`.
`toHaveScreenshot` and the agent's `clearPixels` read that one field and no
longer check the masking themselves.

The mobile engine reports a secure node without bounds as unbounded before
it reads the image, since no image makes that screen maskable, and drops
`decodesAsPng`. `redactSecure` returns a tagged result, and the
`ENGINE_FAILURE` message for an image it cannot read says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): keep fallback pixels only when their masking is proven

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(core): isolate the unproven fallback pixels case

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): withhold pixels on an unbounded screen without a screenshot

A secure field without bounds makes the screen unmaskable from the tree
alone, so the mobile engine now checks the bounds before it takes a
device screenshot. `observe` reports no regions masked and
`app.screenshot()` fails with `POLICY_DENIED`, even when the device
screenshot would have failed, and neither pays a device round trip.

Lists `POLICY_DENIED` under `app.screenshot()` in the app reference, and
says `maskedRegionCount` is reported when the harness asks for pixels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(core): name pixelFallback as a pixels request in the count contract

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): mark pixels withheld only for a pixels request

The session now marks an observation `MASKING_UNPROVEN` only when the
caller asked for pixels, so the engine contract needs no rule about when
an engine reports `maskedRegionCount`. The masking check on fallback
pixels runs after the bare-root check, so a malformed unavailable tree
keeps `INVALID_STATE`. Tests pin the masked count the agent passes on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(core): name pixels: true in the withheld count contract

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(mobile): pin the error category of a withheld app.screenshot()

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): leave fallback pixels to the engine's own masking proof

An unavailable tree is a bare root, so the session has no secure node to
count, and checking the masked-region count against zero proves nothing.
The engine that sends fallback pixels proves their masking itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:53:30 +01:00
Daniel PetroandOskar Kwaśniewski e88153b2f3 feat(locator): add blur for web elements (#1919)
* feat(locator): add blur for web elements

* fix(locator): declare blur against the required core version

* fix(locator): cover MathML blur and engine capabilities

* docs(locator): list blur in action references

* fix(web): require core and e2e 0.24.1 for locator actions

---------

Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
2026-11-20 15:58:39 +00:00
Samanyu DasandClaude Opus 5.5 198d25f038 feat(test): add test.fixme (#1887)
* feat(test): add test.fixme

test.fixme takes the four call shapes test.skip takes. test.fixme(title, fn)
registers a skipped test whose body never runs. test.fixme(), test.fixme(reason),
and test.fixme(condition, reason) skip the running test from a body or hook.
Both report the test skipped with cause explicit and the reason "fixme", or
"fixme: <reason>" when a reason that is not blank is given.

The runtime form shares skipRunningTest with test.skip, which now takes the
API name so every error names test.fixme(). The registration form rejects a
serial group with an API-named message, as test.skipIf and test.runIf do.

Refs #1855

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(test): say test.fixme's reason and setup error need a non-blank reason and a true condition

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(test): route test.skip(title, fn) through registrar and mirror test.fixme docs in zh

test.skip(title, fn) in a serial group now names test.skip(), as test.fixme,
test.skipIf, and test.runIf do. docs/zh, which landed on main after this
branch was cut, gets the test.fixme section, the serial-group rows, the Types
block, and the Playwright guide rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(changeset): keep the test.fixme changeset to one sentence

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(report): report test.fixme with its own skip cause, fixme

A test.fixme test, registered or skipped from its body, now reports
skip.cause fixme in report-v1, beside explicit. The reason text is
unchanged. Every consumer that counted an explicit skip as one the test
gave itself counts fixme too: serial member accounting, Skipped After
Failure, the GitHub merge summary, and NO_TESTS, which says marked fixme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(test): document the fixme skip cause, and pin the GitHub merge count

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(report): keep fixme out of --last-failed, and cover the fixme cause's other paths

A SelfSkipCause type names the causes a test gives itself, and
RUNTIME_SKIP_APIS carries each runtime skip API's cause, so a new one
cannot report half-wired. Tests now pin --last-failed leaving fixme out,
the fixme cause beside a failure that outranks it, and the explicit
fallback for a RuntimeSkip from an older copy. The docs align the
test.skip setup row and say the Playwright guide's { skip: 'fixme' }
workaround reports cause explicit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(changeset): tell users to update @e2e-dev/github with e2e for the fixme cause

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(types): give test.fixme(title, fn) worker fixtures, and name it in the executed docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: rerun checks after a flaky app-command-exit test on Node 24.8.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(migrate): name the serial-group exception for skip and fixme registrations

Playwright accepts test.fixme(title, fn) and test.skip(title, fn) inside a
serial describe, and e2e rejects them, so the "the same" cell names it.
Type a caught runtime skip's cause as unknown, so every reader goes through
runtimeSkipCause, and keep RuntimeSkip module-private. State the github
changeset as the symptom, and name test.fixme in the skip JSDoc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: shorten the migrate cell, and name test.fixme in failureBeforeSkip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: list test.fixme(title, details, body) as missing, and fix the github changeset

The PR comment never shows the executed count, so the changeset names the
merged report instead. The Playwright guide lists the details form under
the APIs e2e does not have yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(migrate): list Playwright's skip and fixme callback forms as missing

Playwright's test.skip(callback, description) and
test.fixme(callback, description) fail collection in e2e with
COLLECTION_ERROR. The guide now lists them, with the conditional form
inside the body or platforms on the test as the workaround, in en, ja,
and zh. The ja test reference says 直列実行 for serial groups, like the
rest of that page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(schema): put the fixme skip cause in both report-1 fixtures

The valid fixture's runtime skip, on the result and its attempt, now has
cause fixme. The invalid fixture's skip that names a filter now has cause
fixme, and a test checks that the schema rejects exactly that pair: the
rule that only a filtered skip names a filter fails at that cause, and
deleting the filter clears it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(test): skip as fixme after a timeout test.setTimeout raised

A test that raises its timeout from 300 ms to 10 s, waits 900 ms, and then
calls test.fixme() is reported skipped with cause fixme, on the result and
its attempt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:30:09 +00:00
b25bb45a7d docs(ja): fix mistranslations (#1991)
* docs(ja): fix mistranslations

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): address review on mistranslations

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): keep "starts at" for headers, name the runner for onRunFinished

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Kacper Kapuściak <kapusciak.k@gmail.com>
2026-11-20 12:15:55 +00:00
Kazutoyo TokaiandClaude Opus 5.5 9e4e6d3df7 docs(ja): unify terminology (#1992)
* docs(ja): unify terminology

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): address review on terminology

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): keep 独自の for custom used in a sentence

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): use 独自の for custom in running text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): translate location as ロケーション

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): title the tools card プロジェクトツール

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): translate redact as 秘匿 and mask as マスキング

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): translate secret redaction as 秘匿 in the Appium guide

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): call screenshot redaction マスキング

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 11:35:40 +00:00
Kazutoyo TokaiandClaude Opus 5.5 4d30f71647 docs(ja): catch up with English changes (#1987)
* docs(ja): catch up with English changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): address review on the catch-up

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

* docs(ja): note the plugin MCP server is Codex and Cursor only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mn9zDiruYSYKYCyiEcZJPE

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 11:26:10 +00:00
VarshithandOskar Kwaśniewski a06b931b8d fix(web): launch Chromium with its sandbox on where it can start (#1621)
* fix(web): launch Chromium with its sandbox on by default

The web engine launched Chromium without chromiumSandbox, so Playwright added --no-sandbox to every browser process. The agent can follow the app to another origin, so a renderer exploit on a page it reaches ran unsandboxed as the user running e2e run, with the checkout, .env, and model keys in reach.

Chromium now launches with chromiumSandbox: true unless the config opts out with web({ chromiumSandbox: false }) or the run environment sets E2E_CHROMIUM_SANDBOX=0, for hosts where the sandbox cannot start (root, containers, Ubuntu 23.10+ with the AppArmor user-namespace restriction). Firefox and WebKit never receive the option. The flag resolves from the option, then the run's environment, then on; the process environment never decides a launch, per the EngineInitInfo.env contract. CI opts out explicitly because the ubuntu-2404 runners restrict unprivileged user namespaces.

Docs updated next to the no-origin-allowlist note (docs/reference/web.mdx, docs/security.mdx, SECURITY.md, skills/e2e/references/setup.md) with a .changeset entry. The smol VM's --no-sandbox is unchanged: the VM is the boundary there.

Verified: pnpm check green; web unit 354/354; web integration 379 passed with 3 known load flakes that pass in isolation; testbed CLI 6/6 fail with "Chromium sandboxing failed!" by default and 6/6 pass with the opt-out on this host.

Fixes #1613

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* docs(web): qualify chromiumSandbox coverage as local-launch-only

Cubic review on the sandbox-default PR found three doc overstatements: SECURITY.md presented the sandbox as universal while connect() and browser providers bypass launch, the skill reference omitted that E2E_CHROMIUM_SANDBOX=0 only applies when the option is omitted, and the reference page implied any container cannot run the sandbox. All three are corrected in the SECURITY note, the reference page, the option JSDoc, and both skill copies.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* fix(web): friendly Chromium sandbox failure and unified sandbox resolution

A sandboxed launch on a host whose sandbox cannot start failed with Playwright's raw error and its full call log, which only hints at the option. acquireBrowser now catches that one failure on a local launch and throws an ENGINE_FAILURE naming both opt-outs, E2E_CHROMIUM_SANDBOX=0 and web({ chromiumSandbox: false }), with no call log and no cause chain to leak it back.

The sandbox flag resolves in one place now: resolveChromiumSandbox(configured, env) in browser-connection.ts replaces the split readChromiumSandboxFlag plus surface resolver, and the surface keeps a single field that init resolves. BrowserConnection.acquire takes an options object, so a relaunch retries with the same options. The option JSDoc shrinks to two lines pointing at the security docs.

Tests follow the restructure: the cdp-attach edits are gone (the flag never applied to attach), screenshot-caret and stalled-frame run sandboxed by default, resolved from the ambient environment so the CI opt-out still reaches a direct launch, and the workflow comments shrink to one line. New tests pin the trim and lowercase handling, the opt-out surviving a failed relaunch, and the friendly error text.

Verified: web unit 358/358 with the opt-out; a real launch on this host fails with the friendly error by default and passes with E2E_CHROMIUM_SANDBOX=0.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* docs(web): minor bump for the sandbox default, CI opt-out, one home for the why

The sandbox default breaks Docker and Linux CI hosts, and the changeset said nothing about it: it is now a minor bump, opened as a maintainer-called release, telling users to set E2E_CHROMIUM_SANDBOX=0.

The CI docs name the opt-out where CI users find it: the GitHub Actions web workflow and the visual-testing screenshots workflow both set E2E_CHROMIUM_SANDBOX=0 on ubuntu-latest, matching this repo's own CI, with a note pointing at the security docs. The other CI pages run mobile targets only, so there is nothing to add there.

The why now lives in docs/security.mdx alone: the reference page, SECURITY.md, the option JSDoc, and the skill reference link to it instead of repeating it.

Verified: changeset-bumps, the docs check chain (anchors, MDX, examples, package managers, logos), and the skill tests all pass.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* docs(web): qualify the Chromium sandbox opt-out as ubuntu-latest only

The visual-testing guide said Linux runners generally block the user
namespaces Chromium needs. The limitation is specific to the
ubuntu-latest runners used here, so name them and tell readers to leave
the sandbox on where it starts.

* fix(web): address review follow-ups on the Chromium sandbox default

Move the sandbox launch error out of the surface and into
BrowserConnection.launchLocal, where the browser name and the resolved
sandbox flag are already known, and drop the untested verb guard. The
error now names the environment opt-out only when the option did not set
the value, since an explicit option wins over the variable. The surface
keeps the option as a readonly field and resolves it into a private
field defaulting to true, the same pattern as headed, so startAttempt
without init no longer needs the fallback. The skill GitHub Actions
recipe runs ubuntu-latest with E2E_CHROMIUM_SANDBOX 0, the web reference
points at the new ENGINE_FAILURE instead of Playwright error text, and
the resolve helper loses its dead branches.

Web unit suite: 362/363 pass; the one failure is artifact-path, which
fails identically on the base head because a real Chromium cannot start
sandboxed in this container.

* fix(web): address re-review follow-ups on the Chromium sandbox default

Resolve the sandbox into one { enabled, fromOption } object and pass it through acquire into launchLocal, which now takes the options object instead of five positional args, so the launch and its error cannot disagree about which opt-out set the value. Add the waiter-joins-a-pending-relaunch case, where the re-acquire runs once and a flip cannot cancel out, and assert retryable is false on the friendly error. Document E2E_CHROMIUM_SANDBOX in the environment reference, point the dead [Security](/security) links at https://e2e.com/docs/security, and fix the changeset wording, since the error no longer always names both opt-outs. The acquire JSDoc now states the actual guarantee: a launch takes the value its own call passes.

Web unit suite: 364/364 pass with E2E_CHROMIUM_SANDBOX=0 (artifact-path fails without it, identically on the base head, because a real Chromium cannot start sandboxed in this container). Web typecheck clean, oxlint clean. The new waiter test fails against a flip mutant injected on the re-acquire and passes without it.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* docs(web): mark E2E_CHROMIUM_SANDBOX as a value in the env reference

The entry was marked flag, but on this page 0 and false mean unset for flags, while 0 opts out of sandboxing here. Mark it value so readers do not apply the wrong flag semantics.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* docs(ci): restore the timings-history section lost in the rebase

The rebase conflict resolution in docs/ci/github-actions.mdx kept only the tail of the new Cache the timings history section, dropping its heading, intro, and example, which broke the docs anchor check (docs/ci.mdx links to #cache-the-timings-history). Restored in full; the sandbox opt-out paragraph follows it unchanged.

Verified: the docs check chain passes locally (anchors, examples, package managers, logos, MDX).

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* docs(security): soften sandbox containment wording

The security page stated a renderer exploit stays contained by the
sandbox, which reads as a guarantee. Say the sandbox helps contain it
and note it does not prevent sandbox escapes or Chromium
vulnerabilities, matching the review feedback on the Chromium sandbox
default.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* docs(security): wrap the sandbox containment sentence at 80 columns

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* fix(web): import EngineError from @e2e-dev/core/engine

browser-connection imported EngineError from e2e/engine, so loading the
web engine without the e2e package failed with ERR_MODULE_NOT_FOUND.
That broke the core-only install smoke check, which loads each engine
main entry without e2e installed. Import from @e2e-dev/core/engine
instead, like every other file in the web engine.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* docs(security): re-wrap sandbox paragraph and soften changeset wording

Re-wrap the sandbox containment paragraph in docs/security.mdx at 80
columns so vulnerabilities; no longer sits on a line of its own, and
soften the changeset to match: the sandbox helps contain a renderer
exploit but does not prevent sandbox escapes. The changeset keeps only
the user-facing part: what changed and the two opt-outs.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

* fix(web): default the Chromium sandbox by platform, drop the env opt-out

On for macOS and Windows, opt-in on Linux where root, most containers
and Ubuntu 23.10+ cannot start it. The option alone decides, so CI,
the test env forwarding and the docs recipes need no opt-out.

* test(web): drop the relaunch cases the waiter test already covers

---------

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
2026-11-20 11:25:39 +00:00
Karol Kulesza b180433047 feat(mobile): device.uninstallApp(id) and device.isAppInstalled(id) (#1906) 2026-11-20 13:03:34 +02:00
Parbez a5d178897a feat(test): change the running test's timeout with test.setTimeout (#1921) 2026-11-20 06:03:25 +00:00
Oskar Kwaśniewski 8eb3cc27ea fix(web,mobile): name engine handle types for inferred configs (#1976) 2026-11-19 18:09:30 +02:00
Oskar Kwaśniewski 1676981ab7 chore(mobile): bump agent-device to 0.21.40 (#1975) 2026-11-19 16:06:49 +00:00
Krzysztof Moch eddf577526 feat(reporters): build the built-in reporters on the public Reporter API (#1936)
* feat(reporters): build the built-in reporters on the public Reporter API

The built-in list, dot, json, junit, and markdown reporters now use only
the public Reporter contract: factories on e2e/reporters, printsTo for the
terminal stream a reporter prints to (one reporter per stream), live
onOutput, onStepPrompt, and onSummary hooks for any number of reporters,
and reportFiles for files the runner writes atomically. The list and dot
ids beside json print to stderr, so list,json now works as dot,json does.
@e2e-dev/html-reporter writes through reportFiles.

* docs(reporters): bring the Japanese and Chinese reporter pages up to date

Translates the reporter reference, the config reporters table, the
--reporter row, and the debugging output paragraph. In English, the name
section now says a reporter may share a built-in's name, and two lines
read less ambiguously.
2026-11-19 15:58:33 +00:00
Oskar Kwaśniewski 0e9d58ec98 feat(mcp)!: remove the run_tests tool (#1967) 2026-11-19 13:31:59 +02:00
Satyajit Sahoo 34322c5416 feat(cli): pause at screen.pause() under --watch (#1905)
Under `e2e run --watch`, a test is now paused at each `screen.pause()` on
every run, as in `e2e run`.

While a pause is shown, the keys are read by the pause prompt and not by
watch mode:

- Press Enter to resume the test.
- Press `q` to cancel that run and stay in watch mode.

`e2e run --step next` and `stop` can be used from another shell, as for a
run without `--watch`.
2026-11-19 11:15:49 +00:00
Satyajit Sahoo 4893d1dd75 feat: add screen.pause() (#1904)
With `await screen.pause()`, a test is paused at that line, with the app
open, until someone resumes it.

- In a terminal, press Enter to resume the test.
- From another shell in the same directory, run `e2e run --step next`.
  A run without a terminal is resumed this way.
- Paused time doesn't count toward the test's timeout.
- With `CI` set, the test fails with `PAUSE_IN_CI`.
- Under `--step`, a test is still paused after `n` or `a`.
- A test isn't paused in an MCP `open_session {test}` session, under
  `openHost` or `run()`, or in a core program.
- A test isn't paused under `e2e run --watch` yet.
2026-11-19 11:00:39 +00:00
Milosz JankiewiczandOskar Kwaśniewski 5e9b82e6ae feat(oauth): name the SuperGrok provider spacexsi, with spacexai and grok as aliases (#1943)
Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
2026-11-19 12:07:52 +02:00
bardropandOskar Kwaśniewski a213247170 feat(test): add test.each and test.for (#1882)
* feat(test): add test.each and test.for

* fix(test): read %i and %f titles like parseInt/parseFloat, as Vitest does

* fix(test): keep each titles on one line and spread only all-array tables

* fix(test): type unknown each rows loosely and keep only real cycles as [Circular]

An unknown row may be spread or passed whole at run time, so EachArgs
now types only the fixtures, last. %j only reads Node's circular-structure
TypeError as a cycle; a toJSON that throws names the row. Docs say %d
keeps BigInt's n suffix and shows Symbol as NaN, and that a string title
value keeps its line breaks.

* docs(test): note that %i keeps the BigInt n suffix

* fix(test): print undefined for %j of a function or Symbol, read Unicode $keys

- %j prints undefined for what JSON leaves out, as Vitest does, so a
  function's source never lands in a title
- $name and its path read Unicode identifier characters
- inline the test mode back into registrar
- docs: note that a Vitest test.each body gets no fixtures

* fix(test): read test.each fixtures from the parameter after the row

Fixtures are now set up on demand from what the body destructures (#1891).
A test.each row runs a wrapper, (fixtures) => body(...row, fixtures), so
registration read the wrapper's own parameter and refused every row with
"must destructure its first parameter". registerTest now takes the body
and the position of its fixtures parameter (the row's length when it is
spread, else 1), and fixtureNames reads that parameter.

* fix(test): keep Error rows on one line and locate rows through a helper

- An Error in a title shows as its name and message, not its stack, and
  whatever inspect still breaks is joined, so a title is always one line
- The source location reads the whole stack: the default 10 frames cut the
  test file off a row declared through a helper and a describe
- A tagged template table is a COLLECTION_ERROR instead of one test per
  template chunk
- A bound row body is told how to wrap itself with the row first
- tests: a run sets up only the fixtures a row body names; fixtureNames at
  a position
- docs, skill, changeset: a row body names its fixtures after the row

* fix(test): restore the stack limit on a throw, read only an own raw

- stackLocations puts Error.stackTraceLimit back in a finally
- Only an own raw property marks a template table
- The wrap hint for a bound row body names one argument per row item
- skill: rows are spread only when every row is an array

---------

Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
2026-11-19 08:56:16 +00:00
Asheesh Kumar 243eaa40ec fix(html-reporter): keep the previous page when a run stops before its tests (#1915)
* fix(html-reporter): keep the previous page when a run stops before its tests

writeReport never checked run.reportPath, so a run that stopped before
its tests (NO_TESTS, a config error, an app that never started) replaced
report.html with an empty page beside the previous run's report.json and
printed an HTML report row under "Report (not written)". It now returns
early with no row, as the built-in junit and markdown reporters do, and
the FinishedRun.reportPath docs say it is also absent when the run stops
before its tests.

Fixes #1897.

* docs(runner): say run()'s reportPath is also undefined when a run stops before its tests

The same field FinishedRun.reportPath documents, in reference/runner.mdx
and the ja and zh pages. The changeset is one line.
2026-11-19 02:36:26 +00:00
Oskar Kwaśniewski 9d240ac954 feat(core): report launch() sessions in the test that opens them (#1935)
A session a test opens with launch() from @e2e-dev/core was invisible to
the test's report, and a secret passed only to launch() could reach it.

- secrets: every owner of values (config, open host, open session) shares
  them through one refcounted map on globalThis; ledgers redact what is
  shared beside them without storing it
- report: a launch session's steps are mirrored into the test's recorder
  under an actor name (launch-1), with model usage and video
- lifecycle: the attempt owns hosts and sessions the test opened, cuts
  their steps when the body ends, and closes them at its end
- reporters: list, trace page, markdown, junit and html name the session
- errors a session throws no longer carry a secret in details
2026-11-18 16:37:55 +00:00
Krzysztof MochandOskar Kwaśniewski 847a09e6db feat(test)!: set fixtures up on demand, once per worker, and in beforeAll (#1891)
* feat(test): set fixtures up once per worker and pass them to beforeAll

test.extend() takes [fn, { scope: 'worker' }]: one instance per worker and
target, torn down when the worker ends. Suite hooks receive worker fixtures.
Engines can declare isolation: 'worker'; @e2e-dev/mobile does, so its device,
app, and screen reach beforeAll, afterAll, and worker fixtures.

Refs ENG-1297

* feat(e2e)!: set up fixtures on demand

A test now sets up only the test.extend() fixtures its body and its
beforeEach and afterEach hooks name in their first parameter, the fixtures
those name, and the auto ones. A suite hook sets up the worker fixtures it
names and the auto worker fixtures. Names are read from the function's
source, as Playwright and Vitest read them.

- [fn, { auto: true }] and [fn, { scope: 'worker', auto: true }] run a
  fixture nothing names.
- A fixture can name the fixtures declared beside it in the same extend()
  call. Fixtures run in declaration order, each after the ones it names.
- The attempt is resolved as one unit before the session launches: a
  fixture only an afterEach names is set up before the first beforeEach.
  An afterEach that names a fixture whose setup failed is skipped.
- Fixture rules fail as COLLECTION_ERROR with the file and line of the
  code: a parameter that is not destructured or takes a rest property, and
  a cycle, when the file is collected; a name the target lacks, a test
  fixture named by a suite hook or a worker fixture, and a fixture named
  like an engine's, at selection, for the pairs that run on that target.
- On an engine with isolation: 'worker', a suite hook or a worker fixture
  teardown that names no engine-backed fixture opens no engine attempt.

BREAKING CHANGE: a fixture nothing names no longer runs unless it is
declared with auto: true, and a test body, hook, or fixture function that
takes the whole fixture object (async (fixtures) => {}) no longer loads.

Refs ENG-1297

* refactor(core): declare core fixtures in one table

The five core fixtures (agent, app, screen, platform, session) are one
table in @e2e-dev/core: name, scope, and factory. createFixtures builds
the built-ins object through one loop over that table and the engine's
factories, every fixture a lazy accessor behind the same gate as before.

The runner's fixture pool, test.extend() validation, and launch read the
names and scopes from the table, so the name lists and the per-name scope
checks are gone. A launch session exposes the core fixtures that do not
belong to a test: app, screen, platform.

No behaviour change. app and screen were built with the attempt and are
now built on first read, like agent and the engine's fixtures.

Refs ENG-1297

* feat(e2e): extend a built-in fixture through test.extend

A test.extend() fixture named like one the test already has extends it,
by Playwright's rule: inside its function its own name is the fixture it
extends (the built-in, or an earlier fixture of that name), and tests,
hooks, and other fixtures that name it receive what it hands to use().

  base.extend({ device: async ({ device }, use) => {
    await device.setPermission('camera', 'deny');
    await use(device);
  } })

- A plain function takes the scope the extended fixture has on the
  target: device is a worker fixture on mobile, so its override runs once
  per worker and reaches beforeAll; app is a test fixture on web and a
  worker fixture on mobile. A declared scope that differs is a
  COLLECTION_ERROR naming both.
- A worker-scoped override receives what a worker fixture receives for
  that built-in, the forwarder to the attempt that is running.
- On a target without the built-in nothing fails until code that runs
  there names it; then the target has no such fixture.
- Only user code sees the override: the attempt's own built-ins, which the
  runner and the worker fixtures' forwarders read, are untouched.
- Types: the override keeps the extended fixture's type and scope, through
  an extend() overload that takes overrides without type arguments.

A fixture named like a core fixture, an engine's, or an earlier one of the
chain was refused before.

Refs ENG-1297

* docs(fixtures): name built-in fixtures and give their scope per engine

The docs now use one term, built-in fixtures, for agent, app, screen,
platform, session, and the ones an engine contributes (browser, device),
where pages said core fixtures, contributed fixtures, or engine fixtures.

The test reference gets one table with each built-in fixture's scope on
web and on mobile, and says what the scope decides: a test fixture reaches
test bodies, beforeEach, and afterEach; a worker fixture also reaches
beforeAll, afterAll, and worker fixtures. The hooks, worker fixtures, and
override sections link to it, as do the fixtures guide and the engine
pages. The Japanese and Chinese pages carry the table and the same terms.

Refs ENG-1297

* docs(ja): translate the fixture scope and on-demand changes

* docs(zh): translate the fixture scope and on-demand changes

* fix(e2e): let a worker fixture name an extended app or screen

A fixture that extends `app` or `screen` was taken for a test fixture when
its test.extend() call was checked, before any target is known. A worker
fixture declared after it that names `app` then failed at import on every
target, though the same fixture is accepted without the override and the
plan resolves both to worker scope on an engine whose state outlives a
test.

The scope of a plain function is now unresolved until a target is known,
whatever it extends, as it already was for an engine's own fixtures.

Refs ENG-1297

* fix(e2e): fail a suite hook that left an engine step running

On an engine whose state outlives a test, a beforeAll or afterAll hook, or
a worker fixture's teardown, can start a device step and not await it. The
hook's attempt then closed under the step, and its failure arrived later
as a stray rejection charged to whichever test ran then.

The suite attempt now does what a test attempt does once its body settled:
the step is failed at its call and cancelled, its outcome is awaited within
the cleanup budget, and the hook fails with STEP_NOT_AWAITED (HOOK_FAILED
for a suite hook).

The suite attempt keeps no step records, and StepRecorder dropped the
record of the step it had just opened before marking it running, so there
was nothing to abandon: a step now counts as running before the retained
window is trimmed.

Refs ENG-1297

* refactor(e2e): keep the fixtures a function names beside it

Registration parsed each test body, hook, and fixture function for the
fixtures it names, dropped the result, and left it in a WeakMap that the
planner and the pool read back with placeholder subjects. A cache miss
there would have named the wrong code and no line.

The parse result is now data: `names` on the registered test, the hook,
and the fixture definition. The planner and the pool read it, the WeakMap
and the per-function wrappers are gone, and one describeUser() gives an
error its subject. The explore test, registered by hand, parses its body
where it builds the record.

Unit tests state the names instead of generating source text for them.

Refs ENG-1297

* refactor(core): resolve built-in fixtures in one place

The core table declared the core fixtures, but what a target's built-in
fixtures are was still assembled around it: core names plus engine names in
three files, the 'engine' scope resolved in e2e through a cast into the
table, `platform` hard-coded as the one fixture that needs no attempt, and
two structural copies of the target.

core now exports builtInFixtures(target): names, scope(name),
needsAttempt(name), attemptless(name), and the unknown-fixture message,
over one BuiltInTarget. `platform` declares in the table that the target
alone decides it. launch, the planner, and the pool read from it.

DECLARED_BUILT_INS is the same view before a target is known: a scope the
engine decides is 'unresolved'. The planner takes either one, so its
no-target mode and the `target === undefined` branches through scopeOf and
read are gone. The scope of a fixture that extends `app` before a target
is known is 'unresolved' by construction.

Refs ENG-1297

* refactor(e2e): hand each function the fixtures it names

Every test body, hook, and fixture function must destructure its first
parameter, so what it reads is known before it runs. bindFixtures still
built a Proxy-gated bag for arbitrary property reads: one value in three
stores, the gate run twice (once over a faked plan), a third derivation of
scope, and an own-name shadow that re-derived what the planner had resolved.
No test code could reach the gate's throwing branches; only unit tests did,
by reading the bag directly.

The plan now records, per function, what each name it reads resolved to: a
chain fixture or a built-in. The pool hands each function a plain object
with exactly those names, the value a chain fixture handed over, or a
built-in read off the attempt when the function destructures it, so
built-ins stay lazy. An override that names itself receives the fixture it
extends because that is what its own name resolved to.

- bound.call(user) replaces user.fn(bound.fixtures); ready(user) asks
  whether every chain fixture it names was provided.
- attemptlessBuiltIns is a function from a name to a value that throws the
  reason for a built-in that needs an attempt.
- The planner runs once: it records what each fixture names, and the order
  is one declaration-order walk over that record. A second validating pass
  only reordered.

Behaviour: a bound or native function, whose parameters cannot be read, is
a COLLECTION_ERROR; it used to parse as naming nothing and still got lazy
built-ins. The docs no longer promise hooks and the body one shared object.

Refs ENG-1297

* refactor(e2e): move the suite attempt out of TargetExecutor

dispose, openSuiteHooks, and openSuiteAttempt were 177 lines of a second
attempt lifecycle inside TargetExecutor, written as closures in one method.

run/suite-attempt.ts now owns it: a SuiteAttempt class with open, acquire,
within, and close, over a SuiteAttemptHost interface the executor satisfies
(the way serial.ts borrows it through SerialHost), plus the worker
fixtures' teardown pass. It is the realm's SuiteHookSession itself, so the
executor keeps a context object and two call sites.

The three branches that built an attemptless reader with a "not available
to the <label>" error are one NoAttempt value ('isolated', 'unnamed',
'interrupted', or the launch failure) and one mapper to the message.

execute.ts: 1244 lines to 1052.

Refs ENG-1297

* refactor(e2e): share the attempt's fixture sequence

A run's attempt and an `e2e mcp` session's test each planned the test's
fixtures, bound them, entered the worker pool, set them up, ran the
beforeEach hooks and the body, filtered the afterEach hooks that can still
run, and labelled the teardowns. This PR widened that copy, and
standalone-test.ts asked the realm for the same hooks four times.

planAttemptFixtures(target, test, hooks) plans before any session exists
and returns open(), which binds the plan to the attempt: enter(), run()
for setup, hooks, and body, and cleanup() for the labelled afterEach hooks
and teardowns. Both call sites keep their own phases, budgets, and error
handling around it.

execute.ts: 1052 lines to 1031, its size on main.

Refs ENG-1297

* refactor(e2e): open the suite-hook pass without a lazy thunk

withSuiteHooks handed its work a thunk that opened the pass on first use.
Opening one does no I/O: the suite attempt launches nothing until a hook
that names an engine fixture runs. The pass is now opened up front and
closed in finally, and the `opened` slot and the `hooks()` call form go.

Refs ENG-1297

* refactor(e2e): ask the registry which hooks apply to a test

The selection-time fixture check rebuilt the scope chain of a test and
filtered the file's hooks by it, which the realm already did its own way.
registry.ts now exports scopeChain(test) and hooksFor(registration, test),
and both use them.

Refs ENG-1297

* refactor(core): move the fixture types into types/fixtures.ts

types.ts grew from 1679 to 1798 lines in this PR. The fixture scope, the
worker fixtures, and what test.extend() takes (definitions and overrides)
are one coherent group that nothing else in the file defines against, so
they move to types/fixtures.ts and types.ts re-exports them. The public
surface is the same.

types.ts: 1798 lines to 1715.

Refs ENG-1297

* refactor(core): drop the redundant override branch in FixtureDefinitions

A fixture that extends one the base already has was typed three ways: a
conditional branch inside the `Extra` map of FixtureDefinitions, the
`& FixtureOverrides` intersection, and the extend(overrides) overload.

Compiling the type tests without each in turn: the intersection types an
override written beside new fixtures with type arguments, and the overload
types an override-only call without them; both fail the tests when
removed. The conditional branch does not: with it gone the tests pass, and
a base name in `Extra` is `never` again, as it was before overrides. It is
removed, and the reference's copy of the declaration follows.

Refs ENG-1297

* refactor(e2e): split fixture errors from the parser, share hookLog

fixture-names.ts parses a parameter list, and also held FixtureUseError and
declarationSite, which format an error. They move to fixture-errors.ts.
Its identifier pattern held two raw zero-width characters; they are
written as escapes now.

hookLog and LOG_MODULE were pasted into three integration tests; they are
one helper in tests/helpers/hook-log.ts.

Refs ENG-1297

* docs(e2e): name the scope rule in the selection check's summary

The summary of assertFixtureUse still listed a chain fixture named like an
engine's as an error. Such a fixture extends the built-in now; the rule
left is a declared scope that differs from the extended fixture's.

Refs ENG-1297

* refactor(e2e): take execute.ts under 1000 lines

Two more pieces that are not the attempt's own sequence leave the file.

- Holding steps for `e2e run --step`: reading the screen a hold starts on
  and wiring AttemptHolds to the runner's hook move to step-hold.ts, beside
  the holds they configure (holdAttemptSteps, readHeldScreen).
- The result of a finished test or setup unit is a pure function of the
  pair, the verdict, the attempts, and a beforeAll failure: unitResult in
  units.ts, beside pairResult.

execute.ts: 1031 lines to 956. It was 1031 on main and 1226 at the review.

Refs ENG-1297

* test(e2e): match the not-awaited message without a step label

Main's #1880 names an unlabeled step by its api alone ("gadget.hang
finished"), where the message used to quote an empty label. The suite-hook
test's pattern required a label between the two, so it failed on the merge
with main.

* feat(e2e): an override inherits auto from the fixture it extends

A fixture that extends another and does not state `auto` now has the
extended fixture's, the way it has its scope: an override of an auto
fixture is set up for every test, and one of a built-in fixture on demand.
An `auto` that differs from the extended fixture's is a COLLECTION_ERROR
naming both, worded like the scope mismatch. This matches Playwright.

It also fixes which fixtures the plan starts from. An auto fixture was a
root by its own flag, so with an auto base and its override in one chain
the base was set up and the override skipped, while the name resolved to
the override; an override that replaced the base without naming it still
left the base running. An auto fixture is now a root only where its name
stands for it: the base runs once through the override's own name, or not
at all when the override replaces it.

Refs ENG-1297

* fix(core): name the hook or fixture that left a step running

STEP_NOT_AWAITED said "the test body returned before ..." for a step a
beforeAll, afterAll or beforeEach hook, a fixture's setup or a worker
fixture's teardown left running. The recorder now keeps the owner each
step was started under, and the runner says which code runs: the pool
for fixtures, hooks and the body, the suite attempt for suite hooks, and
a hosted session for itself.

---------

Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
2026-11-18 13:09:51 +00:00
Natasha Tran 902f044b49 feat: add a dot reporter (#1911)
* feat: add a dot reporter

* fix: flush dot output and separate list formatting

* docs: clarify buffered dot reporter output
2026-11-18 12:58:46 +00:00
Kacper K d16ad2c2d5 feat(cli): add e2e report command to open HTML reports (#1892) 2026-11-18 08:39:35 +02:00
ParbezandOskar Kwaśniewski fabb0c07fb feat(expect): take an optional message on locator expectations (#1865)
* feat(expect): take an optional message on locator expectations

* docs(expect): name expect.soft(locator, message) and scope the message to assertion failures

* feat(expect): open an ambiguous locator's error and expect(screen) failures with the message

* fix(expect): open an ambiguous locator's toHaveScreenshot error with the message

labelAmbiguous moves to expect/heading.ts and wraps the screenshot capture, so
expect(locator, message).toHaveScreenshot() labels LOCATOR_AMBIGUOUS as the
polling matchers do. Tests cover it, a screen .not and the CI no-stored path
with a message. The reference drops a sentence about step names.

* docs(expect): update the ja and zh pages for the locator message

The translations landed on main after this branch was cut, so the English edits left docs/ja and docs/zh stale and docs:check failed on the code blocks of reference/expect.mdx. Bring both languages level with the English pages, the Playwright guide rows included, and rewrap one line of the English soft assertions paragraph.

---------

Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
2026-11-17 21:30:02 +00:00
Kacper Kapuściak b369e382bb docs(ja): translate all 81 documentation pages (#1875)
* docs: add the Japanese translation

Adds docs/ja/, a Japanese page for every English docs page at the same
path, with the tab and group labels in docs/ja/navigation.json. The site
serves them at /docs/ja and gives each translated anchor its English id by
position, so check-docs-translations.ts keeps every translation's outline
equal to its English page's. The npm package keeps shipping only the
English pages.

* docs: check translated code blocks, keep docs/ja out of Context7 and the skill wording test

* docs(ja): sync with the English pages' latest changes (test.skipIf, tool schemas, star link)

* docs(ja): start with the quickstart page only

* docs(ja): translate getting-started and platform guides

* docs(ja): translate all documentation pages
2026-11-17 15:22:48 +00:00