* fix(cache): wait for cached drag destinations (ENG-1556) * fix(cache): use already resolved drag points (ENG-1556) * fix(cache): keep the recorded drag source while waiting (ENG-1556) * fix(cache): stop drag replay when same-named sources disappear (ENG-1556) * fix(cache): count visible drag sources on a stable tier (ENG-1556) * fix(cache): scope visible drag source checks to destination waits (ENG-1556) * fix(cache): preserve drag match tier and endpoint visibility (ENG-1556) * docs(cache): clarify cached drag fallback when a neighbor disappears (ENG-1556) * docs(cache): note positioned drag fallback in release notes (ENG-1556) * test(cache): give each late-destination drag case its own looks (ENG-1556) The table built its screens through an if ladder keyed on a change name. Each row now lists what every look shows and the drag or stop it expects, so a case reads on its own and can take a third look. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(cache): wait for a drag's drop target that is listed but hidden (ENG-1556) A coordinate drag treated a drop target that was found with no visible box three ways, depending on the look it turned up on: hidden on the first look, the drag went to the hidden box; hidden on a later look while the source group was tracked, the replay stopped at once; shown one look later, it waited and dragged. relocateEnds now reads such a destination as still loading on every look of a drag between points, so the poll keeps going and the timed-out look names target-not-found. The source group is still counted on those looks. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(cache): let a positioned drag source settle while the drop target loads (ENG-1556) A source recorded as one of several same-named controls (0 of 2) drags on main once the count on screen settles to the recorded one, as retryable documents. The source-group guard stopped that drag when the drop target was still loading, so the outcome depended on the destination's timing. A recorded position already names the source once the count catches up, so relocateEnds no longer tracks the group of a positioned source. The tests also pin what the count guard does on purpose: it stops when the group grows and drops back, or a twin goes hidden, and it cannot see a source and a twin that swap places. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * refactor(cache): simplify the drag source-group guard and say what it misses (ENG-1556) The guard forced its refusal with a made-up relocation result. It now leaves the source slot empty and lets refused name the failure; keeping the re-found source in the slot would place and drag it. relocationGroupCounter returns the counter alone and relocateEnds keeps the running count, instead of a returned object the caller mutated. The relocateEnds comment states that the guard is a count: it stops on a group that goes 2, 3, 2 or a twin that goes hidden, and cannot see a same-count swap. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * docs(cache): describe the cached drag wait in one sentence (ENG-1556) The cache guide, the agent skill reference, its plugin copy and the changeset described replay internals. Each now says what a user sees: a drag between two points waits for a late or hidden drop target, and stops if one of the source's look-alikes disappears. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(cache): place a recorded point only in a visible control (ENG-1556) The hit test that records a point skips hidden nodes, but replay placed a recorded point inside a re-found node's box without asking whether the node shows. A cached tap or hover landed on a hidden control's box, and so did a drag whose source was listed but hidden. placeWithin now takes a found node's visible box, the rule it already used among look-alikes. The paths that place a point wait for a node that is listed before it shows: placePoint through relocate's usable check, and both ends of a drag in relocateEnds. A look that finds the node hidden also drops the look-alikes of an earlier look, so a timed-out wait cannot place the point from them. Actions on a node id are unchanged: the engine decides whether it can act on the node. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * docs(cache): limit the cached point wording to what replay does (ENG-1556) The wait applies to a point recorded inside a control; a bare point replays as before. The stop on a disappearing look-alike applies to a drag whose source the recorded point has to pick out of same-named controls, not to a source recorded with its position. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(cache): assert the twin refusal holds past the first look (ENG-1556) The coordinate drag refusal test also passed if replay stopped on the first look, before the destination showed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(cache): wait for a recorded point's control while it lies outside the viewport (ENG-1556) placeWithin placed a recorded point inside a re-found control's box without asking whether that point is on screen. The point verbs keep a point inside the viewport, so a control wholly outside it was tapped or dragged at the viewport's edge, outside the control. Main does the same. A box now holds a point only where the point the verb keeps inside the viewport still lies in the box. A control that straddles the edge replays as before. The waits in relocate and relocateEnds ask placeWithin instead of repeating its visible-box check, so the rule lives in one place and a control whose point cannot be placed yet is waited for. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * docs(cache): say target-not-found also covers a control that stays hidden or off screen (ENG-1556) The reasons table said a recorded control did not appear. For a tap, hover or drag at a recorded point the same reason is reported when the control is listed but stays hidden or outside the viewport. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(cache): preserve point targets while replay waits * test(cache): cover all viewport edges during point replay * test(cache): verify hover and offscreen look-alike removal * test(cache): pin the stop when a hidden drop target gains a twin (ENG-1556) No test failed with the lostIdentity check in relocateEnds switched off. The check is not redundant: when the source is still absent, its wait keeps the poll going, so a drop target that was listed hidden and then joined by a look-alike is only refused for that look. Once the source shows and one look-alike is left, the drag goes to it. The new row lists that sequence. It stops on the second look at the head and sends the drag with the check off. The table gains laterLook: what one more look would show, for a case that must stop before it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * docs(cache): say the cached point wait in one sentence (ENG-1556) The passage had grown back to three sentences in the cache guide and two in the skill reference after the review asked for one, and the changeset to four. Each is one sentence now: a tap, hover or drag at a point recorded inside a control waits until the point lands inside that control on screen, and a drag whose point alone tells an end apart from same-named controls stops if one of them leaves the visible area meanwhile. The changeset also names the late or hidden drop target. Cut from the guide: "If same-named controls appear, replay needs enough information to tell them apart", which the sentence before it covers. Cut from the changeset: "Points recorded outside controls replay as before", which described no change. The target-not-found row keeps its note on hidden and off-screen controls. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(cache): pin a positioned drag end that turns ambiguous after it was found hidden (ENG-1556) The branch of relocateEnds that handles an end found without a usable box and then ambiguous had no test for an end recorded with a position. Limiting the branch to ends without a position, or ending the wait for a positioned one, left every test green. Two rows pin it. A positioned source found hidden is waited for until its count settles and it shows, then dragged. While it stays ambiguous, a look-alike that sits under the recorded point is refused when the wait runs out. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(cache): assert the wait for a positioned tap target found hidden (ENG-1556) The test that names this wait checked only the final refusal, so a positioned target that stopped on the look it turned ambiguous passed it. It now asserts that replay kept looking. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(cache): name the hidden drop target row by what a passing replay observes (ENG-1556) The row's name ended "never dragging to the twin once the source shows", but a passing replay stops on the second look and never sees the source. The name now says what the row observes. laterLook stays: a replay that misses the stop takes that look and sends the drag, so the row fails on the wrong drag itself and not only on the stop reason. Its comment says when it is served. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(cache): move the bare-point replay suites into their own file (ENG-1556) trace-replay.test.ts had grown from 964 lines to 1369. The two bare-point suites (taps, hovers and scrolls; drags) move as they are to trace-replay-points.test.ts, and the scripted host and fixtures both files use move to tests/helpers/replay-host.ts. No test changes: the same 107 names pass before and after, 42 in the first file and 65 in the new one. The files are 633, 654 and 106 lines. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * refactor(cache): drop the source half of the lost-identity check (ENG-1556) relocateEnds stopped a bare-point drag when an end recorded without a position had waited for its box and then turned ambiguous. For the source that stop changed nothing: its point has no place on that look, so the poll ends there with target-ambiguous either way. Nine sequences with a hidden or offscreen source that gains a twin reach the removed check on the old code and give the same outcome without it, and all 107 replay tests pass. The drop target half stays: with it removed too, "stops when a hidden drop target gains a twin while the source is absent" fails. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(cache): pin the stop when a hidden source gains a visible twin under the point (ENG-1556) A drag source recorded without a position that is listed hidden and then joined by a visible look-alike under the recorded point must stop the drag. Since the source half of the lost-identity check went, only the missing look on that ambiguous result stops it, and no row covered that for a source without a position: with judge changed to hand it the look, all 107 tests passed and the drag started from the look-alike. This row fails under that change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(cache): keep looking for a recorded test id after its control was found hidden (ENG-1556) A coordinate tap, hover or drag end recorded by test id, beside a same-named control without one, can be found hidden or without a box, leave the screen for a look and come back. The look without it is a twin refusal, which keeps looking for the test id. Sinceff9b79129the branch for an end that waits for its box ran first and ended the replay on that look with target-ambiguous, where the merge base dragged from the recorded source one look later. relocate and relocateEnds now remember the refusal before that branch, and the drop target's lost-identity stop leaves a refused end alone. Plain ambiguity after a hidden unique control gains a look-alike still stops at once, and a refused end that never comes back still sends no input: it waits out the settle window first, as the merge base did. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(cache): pin the hand-off when a look-alike picked by the point is too narrow (ENG-1556) A control picked among same-named ones by the recorded point hands off with target-ambiguous when the dispatched pixel rounds outside its box, rather than waiting as an identified control does. No row covered that pixel check: with it removed, every row still passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(cache): inline the drop target's lost-identity check (ENG-1556) It had one caller sincee4aebd0beand was typed against the source end. No behavior change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(cache): say why an ambiguous relocation can carry no screen (ENG-1556) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(cache): name a group that grows during a drag's wait as a limit of the guard (ENG-1556) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cache): stop a drag when a look-alike joins an end while it waits (ENG-1556) The guard on a drag's ends counted only drops in an end's visible look-alikes, and only for an end its point picked out of a group. A same-named control that mounted under the recorded point while the drag waited for the other end, beside a unique end or a group that grew, was picked by the point on the last look. The guard now also counts a unique end found while the drag waits, and stops on any change in the count, so a visible unique end that gains a look-alike stops as a hidden one does. Review: kdy1 on #2395 (thread 4734170548). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cache): hand off when the placed pixel also lies in an overlapping look-alike (ENG-1556) Among same-named controls, the recorded point picks the one box that holds it, and the pixel sent is the recorded place inside that box. That pixel could lie inside a sibling that overlaps the picked box, where the one on top receives the input. The rule beside it already hands off when the recorded point itself lies in two overlapping siblings; the pixel sent now gets the same check. A look-alike nested inside the picked box still counts as the same control. Review: kdy1 on #2395 (thread 4734170548). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cache): let a unique drag end leave and come back while the other loads (ENG-1556)726913e1ccounted a unique end like a group, so a unique source or drop target that was unlisted, hidden or out of view for one look while the other end loaded stopped the drag, wheref3710af53and main wait and drag. An end found alone now stops only once a look-alike is listed beside it, shown or not: that also catches a unique source that goes hidden while a look-alike shows under the recorded point, which the visible count missed. A twin refusal keeps looking for the recorded test id, as before. A group the point picks from still stops on any change in its visible count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cache): hand off when any other look-alike covers the placed pixel (ENG-1556)741287b73let the placed pixel through when the other look-alike under it had a box inside the picked one, taking box containment for nesting. The tree carries no ancestry, so a smaller same-named sibling drawn on top of the picked control looks the same. Any other look-alike covering the pixel now hands off. In an unchanged layout the pixel is the recorded point, which lies in no other look-alike's box, so nothing that replayed there changes. Review: cubic on #2395 (thread 4756009849). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(cache): cover a unique drag source that leaves beside a twin (ENG-1556) A source recorded by test ID that was found alone, then refused as a twin of a look-alike without one while it was gone, must keep the drag waiting and drag once it is back. No row reached the `twinLeft` exemption of the alone guard; this one fails without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(cache): read a placed point's look-alike boxes once (ENG-1556) The overlap check skipped the picked box by reference, which held only because the box lookup returns each node's own rect. Both the point filter and the overlap scan now read one list of boxes, so the picked box is that list's own entry whatever the lookup returns. No behavior change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cache): hold a waiting end to the tier an earlier look found it on (ENG-1556) While a cached tap, hover, or drag waited for a control found by test ID without a usable place (no box, hidden, out of view), the next look fell back to role and name once the test ID left, and acted on a same-named control the earlier look had told apart. The merge base stopped there. Once a look finds an end, a later lone match on a weaker tier is refused like a twin of the recorded node: the wait keeps looking for the test ID and hands off with target-ambiguous at its cap. It holds for a single point and for both ends of a drag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cache): stop a drag on an unsettled drop point while a listed source loads (ENG-1556) A drag whose source was listed but not yet placeable (hidden, no box, out of view) kept waiting past a drop target the recorded point could not settle, and dragged into the look-alike left on a later look. The merge base stopped on the first look with target-ambiguous. A listed source still loading no longer holds the drag past a drop target no wait can settle. A source that is not listed at all still waits, as main does and pins for node drags. The cache docs, the changeset and the agent skill say both rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(cache): say which loading source lets an unsettled drop point stop a drag (ENG-1556) Only a source already on screen and not yet usable (hidden, without a box, or out of view) stops a drag on an ambiguous drop point; a source not on screen yet still waits. The release note, the cache page and the agent skill said any loading source did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: michal-e2e <357875193+michal-e2e@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
@e2e-dev/core
Drive a browser, an iOS or Android app, or a Mac app from code.
@e2e-dev/core is the engines, screen, and agent of
e2e without the test runner: no config
file, no report, no expect. The test runner, e2e, is built on it.
When to use it
| You want to | Use |
|---|---|
| Write tests and run them locally and in CI, with reports | e2e: npx e2e init |
| Give a coding agent a live session on your app | The MCP server: npx e2e mcp |
| Drive an app from your own program: a script, a scraper, a bot, test data setup | @e2e-dev/core |
Open a second browser or device inside an e2e test |
@e2e-dev/core, from the test |
Install
Install it beside an engine: @e2e-dev/web for browsers, @e2e-dev/mobile
for iOS simulators and Android emulators.
npm install @e2e-dev/core @e2e-dev/web
It needs Node.js 22.22.3 or later on 22.x, or 24.8 or later. The agent also
needs the AI SDK: npm install ai.
Drive a browser
// prices.ts
import { launch } from '@e2e-dev/core';
import { web } from '@e2e-dev/web/engine';
await using shop = await launch(web(), { app: { url: 'https://shop.example.com' } });
await using session = await shop.newSession();
await session.app.open('/products/A-1001');
console.log(await session.screen.getByTestId('sale-price').textContent());
node prices.ts
launch prepares an engine and returns a host. newSession() opens one
isolated session on it, with screen, app, and the engine's fixture
(browser or device). await using closes both at the end of the block.
On Node.js 22, call close() in a finally instead.
Import engines from their /engine entry, as above. That entry needs no
e2e.
Drive an app on a device
import { launch } from '@e2e-dev/core';
import { mobile } from '@e2e-dev/mobile/engine';
await using shopApp = await launch(mobile({ platform: 'ios' }), {
app: { bundleId: 'com.example.shop', linkBase: 'https://shop.example.com' },
});
await using session = await shopApp.newSession();
await session.app.open('/products/A-1001');
Let the agent act
import { createAgent } from '@e2e-dev/core/agent';
import { gateway } from 'ai';
const agent = createAgent(session, {
model: gateway('anthropic/claude-sonnet-5-5'),
cache: { dir: '.shop-bot/cache' },
});
await agent.act('Add the item to the cart', { cacheKey: 'add-to-cart' });
With cache, act records each flow and replays it on the next run with no
model call. Every act then names its recording with cacheKey.
API
| Entry | Exports |
|---|---|
@e2e-dev/core |
launch, SessionState, isE2EError, and the types of a host, a session, screen, app, and locators |
@e2e-dev/core/agent |
createAgent, defineTool, and the agent and executor types |
@e2e-dev/core/engine |
defineEngine and the contract an engine implements |
Everything under @e2e-dev/core/lib/* is internal to e2e and the engines,
and may change in any release.
launch(engine, options) takes:
| Option | Default | Meaning |
|---|---|---|
app |
- | url for web(); bundleId or appPath for mobile() |
secrets |
- | Values by name, filled with host.secret(name) and redacted from errors and the agent |
headed |
false |
Show the browser window |
timeout |
30000 ms per action, 120000 ms per app open | One timeout for every operation |
signal |
- | Cancels the launch and everything on the host |
handleSignals |
true |
Close the host on SIGINT, SIGTERM, and SIGHUP |
artifactsDir |
a temp directory | Where screenshots, downloads, and recordings go |
cwd |
process.cwd() |
What paths resolve from |
env |
process.env |
The environment the engine reads |
onNotice |
- | Progress outside operations, such as a browser download |
A host holds one session at a time. For parallel work, launch more hosts.
Every failure is an error with a code: check it with isE2EError(error).
Docs
- Guide: sessions, saved state, secrets, errors, and the agent with its replay cache.
- Reference: every option and error.
- screen and app: what a session holds.
- Write an engine: build on
@e2e-dev/core/engine.