diff --git a/.changeset/fresh-mobile-inputs.md b/.changeset/fresh-mobile-inputs.md new file mode 100644 index 0000000000..dafb68f8de --- /dev/null +++ b/.changeset/fresh-mobile-inputs.md @@ -0,0 +1,5 @@ +--- +'@e2e-dev/mobile': patch +--- + +Re-read mobile fill and clear targets before typing, including cached replay. Missing inputs, changed security state, or incomplete captures retry after a fresh observation. diff --git a/docs/reference/mobile.mdx b/docs/reference/mobile.mdx index f0fd7bfdd4..1ba87e5c8a 100644 --- a/docs/reference/mobile.mdx +++ b/docs/reference/mobile.mdx @@ -239,6 +239,11 @@ mobile({ platform: 'ios', transition: 800 }); // default: 500 budget the way a tap does. A control that arrives with the screen they reveal waits out the budget before the next action lands on it. +`fill` and `clear` re-read the field before typing. Missing fields, changed +security state, or incomplete captures return `NODE_STALE` before mutation, +then retry after a fresh observation. Non-input targets return +`UNSUPPORTED_CAPABILITY`. + #### `videoTouches` ```ts diff --git a/packages/e2e/tests/integration/agent-input-stale.test.ts b/packages/e2e/tests/integration/agent-input-stale.test.ts new file mode 100644 index 0000000000..b98e06bb5c --- /dev/null +++ b/packages/e2e/tests/integration/agent-input-stale.test.ts @@ -0,0 +1,103 @@ +/** A stale fill must re-enter secret authorization, on live actions and cached replay alike. */ + +import { describe, expect, it } from 'vitest'; +import type { StepExecutor } from '../../src/agent/executor.ts'; +import { EngineError, type SemanticNode } from 'e2e/engine'; +import { createFakeEngine } from '../helpers/fake-engine.ts'; +import { nodeIdFor } from '../helpers/fake-loop-model.ts'; +import { createProject, resultByTitle, runExisting } from '../helpers/run-project.ts'; + +const SUITE = `import { test, credentials, expect } from 'e2e'; +test('fills the account password', async ({ agent, screen }) => { + await agent.act('fill the password', { params: { password: credentials.user('member').password } }); + await expect(screen.getByRole('status')).toBeVisible(); +}); +`; + +describe('secret fill stale retry', () => { + for (const replay of [false, true]) { + it.each([false, true])(`reauthorizes a changed sink with disabled=%s during ${replay ? 'replay' : 'live execution'}`, async (disabled) => { + const field: SemanticNode = { + ref: { id: 'password', revision: '' }, role: 'textbox', name: 'Password', + testId: 'password', inputPurpose: 'password', states: { secure: true }, + rect: { x: 40, y: 237, width: 322, height: 49 }, + }; + const tree = { ref: { id: 'root', revision: '' }, role: 'document', children: [field] }; + let stale = false; + let dispatched = 0; + const origins: string[] = []; + const pixels: boolean[] = []; + const fake = createFakeEngine({ + tree, + onStartAttempt: () => { tree.children = [field]; }, + locate: () => tree.children.filter((node) => node.role === 'status'), + perform: (_ref, action, operation) => { + if (action.kind !== 'fill') throw new Error('expected fill'); + origins.push(operation.origin); + if (stale) { + stale = false; + tree.children = [{ ...field, states: { secure: true, disabled }, rect: { x: 40, y: 126, width: 322, height: 49 } }]; + throw new EngineError('NODE_STALE', 'input moved before mutation', { retryable: true }); + } + dispatched += 1; + tree.children.push({ ref: { id: 'saved', revision: '' }, role: 'status', name: 'Saved' }); + }, + // No pixel payload is needed: this records any request after authorization. + pixels: () => { pixels.push(true); return undefined; }, + }); + const taint: boolean[] = []; + const executor: StepExecutor = { + name: 'stale-secret', + async runStep(context) { + const observation = await context.observe(); + try { + await context.actions.typeSecret({ id: nodeIdFor(observation.text, /textbox "Password"/) }, 'member.password'); + } finally { + taint.push(context.pixelsTainted); + expect((await context.observe({ pixels: true })).pixels).toBeUndefined(); + } + return { status: 'passed', summary: 'filled' }; + }, + }; + const project = createProject({ 'tests/input.e2e.ts': SUITE }); + const options = { + config: { + targets: [{ name: 'fake', platform: 'fake', engine: fake.engine }], + agents: { default: { executor } }, + credentials: { member: { username: 'example', password: 'private-fixture-value' } }, + cache: 'read-write' as const, + }, + }; + try { + if (replay) { + const recorded = await runExisting(project, options); + const recording = resultByTitle(recorded, 'fills the account password'); + expect(recording.status).toBe('passed'); + expect(recording.attempts[0]?.steps.find((entry) => entry.api === 'agent.act')?.cache).toMatchObject({ write: 'saved' }); + dispatched = 0; + origins.length = 0; + pixels.length = 0; + taint.length = 0; + } + stale = true; + const outcome = await runExisting(project, options); + const result = resultByTitle(outcome, 'fills the account password'); + const step = result.attempts[0]!.steps.find((entry) => entry.api === 'agent.act')!; + expect(result.status, JSON.stringify(result.attempts[0]?.error)).toBe(disabled ? 'failed' : 'passed'); + expect(dispatched).toBe(disabled ? 0 : 1); + expect(origins).toEqual(Array(disabled ? 1 : 2).fill(replay ? 'test' : 'agent')); + // A denied replay hands off to the executor, whose own denied action also counts. + expect(step.metrics?.actionSteps).toBe(replay && disabled ? 2 : 1); + expect(step.events.filter((event) => event.kind === 'observation' && event.name === 'relocate')).toHaveLength(1); + expect(step.events.filter((event) => event.kind === 'policy' && event.name === 'secret.fill' && event.status === 'passed')).toHaveLength(disabled ? 1 : 2); + if (disabled) expect(JSON.stringify(step)).toContain('POLICY_DENIED'); + if (!replay || disabled) expect(taint).toEqual([true]); + else expect(step.cache).toMatchObject({ mode: 'self-finalized', replayedActions: 1 }); + expect(pixels).toEqual([]); + expect(JSON.stringify(outcome)).not.toContain('private-fixture-value'); + } finally { + project.cleanup(); + } + }, 60_000); + } +}); diff --git a/packages/mobile/src/nodes.ts b/packages/mobile/src/nodes.ts index 3ba4cfebf1..7ae8b2b08f 100644 --- a/packages/mobile/src/nodes.ts +++ b/packages/mobile/src/nodes.ts @@ -94,7 +94,8 @@ const ROLE_MAP: Readonly> = { }; const SECURE_KINDS = new Set(['secure-text-field', 'securetextfield', 'password-field']); -const TEXT_INPUT_ROLES = new Set(['textbox', 'searchbox', 'combobox']); +/** Semantic roles that accept text input. */ +export const TEXT_INPUT_ROLES: ReadonlySet = new Set(['textbox', 'searchbox', 'combobox']); const CHECKABLE_ROLES = new Set(['switch', 'checkbox']); const CHECKED_VALUES = new Set(['1', 'on', 'true', 'checked', 'selected']); const UNCHECKED_VALUES = new Set(['0', 'off', 'false', 'unchecked']); diff --git a/packages/mobile/src/surface.ts b/packages/mobile/src/surface.ts index 250c35a965..6acc433be1 100644 --- a/packages/mobile/src/surface.ts +++ b/packages/mobile/src/surface.ts @@ -52,6 +52,7 @@ import { normalizeKind, projectSnapshot, ROOT_ID, + TEXT_INPUT_ROLES, screenRoot, screenTitle, type ProjectedNode, @@ -1175,27 +1176,18 @@ export class AgentDeviceSurface { } /** - * Lets a control that came with the last action finish arriving before a - * test acts on it, and answers the binding to act on. A control already - * present at the same place in the snapshot the last action was resolved - * from is acted on at once only when keyboard state also stayed the same. - * A keyboard change can precede the app's relayout, so anything else waits - * out the remainder of the transition budget since that action and is then - * found again in a fresh snapshot. The budget is the only signal that the - * transition is over, since the tree cannot tell a sliding control from a - * landed one; the fresh snapshot is where the control landed. Android - * reports a window's frames while it slides in, so a ref resolved - * mid-flight would send the action where the control was: below the - * screen, for a modal rising from the bottom. + * Waits for a control that arrived or moved with the last action, returning + * whether it waited. Controls already present at the same place need no wait, + * unless keyboard state changed: a keyboard change can precede the app's relayout. */ - private async settled(entry: NodeBinding, operation: OperationContext): Promise { + private async waitForTransition(entry: NodeBinding, operation: OperationContext): Promise { const since = Date.now() - this.lastActionAt; const remaining = this.transitionMs - since; - if (remaining <= 0) return entry; + if (remaining <= 0) return false; const before = this.screenBeforeAction; if (before !== undefined && before.keyboardVisible === entry.keyboardVisible) { const prior = this.refind(entry, before.index); - if (prior !== undefined && sameRect(prior.node.rect, entry.node.rect)) return entry; + if (prior !== undefined && sameRect(prior.node.rect, entry.node.rect)) return false; } await sleep(remaining, operation.signal); // The sleep resolves on abort; the action behind it must not go out once @@ -1203,13 +1195,27 @@ export class AgentDeviceSurface { if (operation.signal.aborted) { throw new EngineError('CANCELLED', 'transition wait cancelled', { retryable: false }); } - return this.relocated(entry, operation); + return true; } - /** The same control in a fresh snapshot; the binding as it was when the snapshot no longer lists it. */ - private async relocated(entry: NodeBinding, operation: OperationContext): Promise { - const projected = this.project(await this.snapshotOrEmpty(operation, false)); + /** Refreshes a control after a transition wait, keeping the binding when no wait was needed. */ + private async settled(entry: NodeBinding, operation: OperationContext): Promise { + if (await this.waitForTransition(entry, operation)) return this.relocated(entry, operation); + return entry; + } + + /** The same control in a fresh snapshot; input mutations refuse a missing target or changed security facts. */ + private async relocated(entry: NodeBinding, operation: OperationContext, input = false): Promise { + const raw = await this.snapshotOrEmpty(operation, false); + const projected = this.project(raw); const found = this.refind(entry, projected.index); + if (input && (isTruncated(raw) || found === undefined || + entry.node.inputPurpose !== found.node.inputPurpose || + entry.node.states?.disabled !== found.node.states?.disabled || + entry.node.states?.secure !== found.node.states?.secure || + entry.node.states?.hidden !== found.node.states?.hidden)) { + throw new EngineError('NODE_STALE', `input node ${entry.id} changed before mutation; observe and authorize it again`, { retryable: true }); + } return found === undefined ? entry : this.bind(found, projected); } @@ -1246,6 +1252,10 @@ export class AgentDeviceSurface { return; } const entry = this.resolveRef(ref); + const filling = action.kind === 'fill' || action.kind === 'clear'; + if (filling && (entry.node.role === undefined || !TEXT_INPUT_ROLES.has(entry.node.role))) { + throw unsupported(`agent-device can only ${action.kind} editable fields; node ${entry.id} is ${entry.node.role ?? 'unknown'}`); + } const label = `perform ${action.kind}`; const client = this.requireClient(); // A toggle already in the wanted state sends nothing, so it neither waits @@ -1255,7 +1265,13 @@ export class AgentDeviceSurface { } const before = this.latestScreen; const run = async (): Promise => { - const target = deterministic ? await this.settled(entry, operation) : entry; + let target = entry; + if (filling) { + if (deterministic) await this.waitForTransition(entry, operation); + target = await this.relocated(entry, operation, true); + } else if (deterministic) { + target = await this.settled(entry, operation); + } switch (action.kind) { case 'tap': return input.send(() => client.interactions.press({ ...this.actionTarget(target, true), ...settle })); diff --git a/packages/mobile/tests/unit/engine.test.ts b/packages/mobile/tests/unit/engine.test.ts index de7c21b0e7..28e5fc51e6 100644 --- a/packages/mobile/tests/unit/engine.test.ts +++ b/packages/mobile/tests/unit/engine.test.ts @@ -1162,7 +1162,9 @@ describe('perform', () => { ['interactions.longPress', { ref: '@e4', settle: true, settleQuietMs: 150, durationMs: 1000 }], ['interactions.press', { ref: '@e7', settle: true, settleQuietMs: 150 }], ['interactions.hover', { ref: '@e4' }], + ['capture.snapshot', { interactiveOnly: false }], ['interactions.fill', { ref: '@e7', text: 'blue', settle: true, settleQuietMs: 150 }], + ['capture.snapshot', { interactiveOnly: false }], ['interactions.fill', { ref: '@e7', text: '', settle: true, settleQuietMs: 150 }], ['interactions.press', { ref: '@e6', settle: true, settleQuietMs: 150 }], ['command.keyboard', { action: 'enter' }], @@ -2371,6 +2373,202 @@ describe('video', () => { }); }); +describe('input freshness', () => { + beforeEach(autoAdvanceTimers); + + /** A uniquely identified field and its neighbor, after a slow accessibility capture. */ + function form(y = 237, changes: Partial = {}) { + const field: RawNode = { + ref: '@e20', index: 1, parentIndex: 0, depth: 1, type: 'secure-text-field', + label: 'Account', identifier: 'account', rect: { x: 40, y, width: 322, height: 49 }, ...changes, + }; + return { + ...SETTINGS_SNAPSHOT, + nodes: [ + SETTINGS_NODES[0]!, field, + { ref: '@e21', index: 2, parentIndex: 0, depth: 1, type: 'text-field', label: 'Username', identifier: 'username', rect: { x: 40, y: 218, width: 322, height: 49 } }, + ], + }; + } + + for (const origin of ['test', 'agent'] as const) { + for (const kind of ['fill', 'clear'] as const) { + it(`uses one fresh binding after a slow capture for ${origin} ${kind}`, async () => { + const h = harness(); + await openAttempt(h); + h.fake.respond('capture.snapshot', async () => { await sleep(600); return form(); }); + const old = await observed(h, 'Account'); + const captures = h.fake.methods().filter((method) => method === 'capture.snapshot').length; + h.fake.respond('capture.snapshot', () => form(126, { ref: '@e42' })); + const action = kind === 'fill' ? { kind, value: 'example', sensitive: true } : { kind }; + await h.engine.perform!(old.ref, action, { ...operation(), origin }); + expect(h.fake.lastArgs('interactions.fill')).toMatchObject({ ref: '@e42', text: kind === 'fill' ? 'example' : '' }); + expect(h.fake.methods().filter((method) => method === 'capture.snapshot')).toHaveLength(captures + 1); + expect(h.fake.methods().filter((method) => method === 'interactions.fill')).toHaveLength(1); + }); + + it(`acts on a sliding input with one capture for ${origin} ${kind}`, async () => { + const h = harness(); + await openAttempt(h); + h.fake.respond('capture.snapshot', () => form(2000)); + const sliding = await observed(h, 'Account'); + const captures = h.fake.methods().filter((method) => method === 'capture.snapshot').length; + h.fake.respond('capture.snapshot', () => form(126, { ref: '@e42' })); + const startedAt = Date.now(); + const action = kind === 'fill' ? { kind, value: 'example', sensitive: false } : { kind }; + await h.engine.perform!(sliding.ref, action, { ...operation(), origin }); + expect(h.fake.lastArgs('interactions.fill')).toMatchObject({ ref: '@e42', text: kind === 'fill' ? 'example' : '' }); + expect(h.fake.methods().filter((method) => method === 'capture.snapshot')).toHaveLength(captures + 1); + if (origin === 'test') expect(Date.now() - startedAt).toBeGreaterThanOrEqual(500); + }); + + it(`rejects an originally non-input target before waiting or capturing for ${origin} ${kind}`, async () => { + const h = harness(); + await openAttempt(h); + h.fake.respond('capture.snapshot', () => form(237, { type: 'button' })); + const button = await observed(h, 'Account'); + const captures = h.fake.methods().filter((method) => method === 'capture.snapshot').length; + const startedAt = Date.now(); + const action = kind === 'fill' ? { kind, value: 'example', sensitive: false } : { kind }; + await expect(h.engine.perform!(button.ref, action, { ...operation(), origin })).rejects.toMatchObject({ code: 'UNSUPPORTED_CAPABILITY', retryable: false }); + expect(Date.now()).toBe(startedAt); + expect(h.fake.methods().filter((method) => method === 'capture.snapshot')).toHaveLength(captures); + expect(h.fake.methods()).not.toContain('interactions.fill'); + }); + } + } + + it('refreshes an unchanged input even when the transition shortcut skips the wait', async () => { + const h = harness(); + await openAttempt(h); + await h.engine.perform!((await observed(h, 'Back')).ref, { kind: 'tap' }, { ...operation(), origin: 'test' }); + const search = await observed(h, 'Search'); + const captures = h.fake.methods().filter((method) => method === 'capture.snapshot').length; + h.fake.respond('capture.snapshot', () => ({ ...SETTINGS_SNAPSHOT, nodes: SETTINGS_NODES.map((node) => node.label === 'Search' ? { ...node, ref: '@e42' } : node) })); + const startedAt = Date.now(); + await h.engine.perform!(search.ref, { kind: 'clear' }, { ...operation(), origin: 'test' }); + expect(Date.now()).toBe(startedAt); + expect(h.fake.lastArgs('interactions.fill')).toEqual({ ref: '@e42', text: '' }); + expect(h.fake.methods().filter((method) => method === 'capture.snapshot')).toHaveLength(captures + 1); + }); + + it.each([ + ['missing', () => ({ ...form(), nodes: [SETTINGS_NODES[0]!] })], + ['renamed', () => form(237, { label: 'Other account' })], + ['different identifier', () => form(237, { identifier: 'other' })], + ['truncated', () => ({ ...form(), truncated: true })], + ['non-editable', () => form(237, { type: 'button' })], + ['no longer secure', () => form(237, { type: 'text-field' })], + ['disabled', () => form(237, { enabled: false })], + ['hidden', () => form(237, { visibleToUser: false })], + ] as const)('rejects a %s target without dispatching or exposing the value', async (_name, snapshot) => { + const h = harness({ transition: 0 }); + await openAttempt(h); + h.fake.respond('capture.snapshot', () => form()); + const old = await observed(h, 'Account'); + h.fake.respond('capture.snapshot', snapshot); + const failure = h.engine.perform!(old.ref, { kind: 'fill', value: 'not-for-diagnostics', sensitive: true }, operation()); + await expect(failure).rejects.toMatchObject({ code: 'NODE_STALE', retryable: true }); + await expect(failure).rejects.not.toThrow('not-for-diagnostics'); + expect(h.fake.methods()).not.toContain('interactions.fill'); + }); + + for (const kind of ['fill', 'clear'] as const) { + it.each([0, 1])(`can ${kind} identical OTP input %i with the existing nearest-node matching`, async (selected) => { + const h = harness(); + await openAttempt(h); + const digits = (refs: readonly string[], shift: number) => ({ + ...SETTINGS_SNAPSHOT, + nodes: [ + SETTINGS_NODES[0]!, + ...refs.map((ref, index) => ({ ref, index: index + 1, parentIndex: 0, depth: 1, type: 'text-field', label: 'Digit', rect: { x: 40, y: 100 + index * 100 + shift, width: 49, height: 49 } })), + ], + }); + h.fake.respond('capture.snapshot', () => digits(['@e20', '@e21'], 0)); + const snapshot = await h.engine.observe!(operation()); + const target = [...walk(snapshot.root)].filter((node) => node.name === 'Digit')[selected]!; + h.fake.respond('capture.snapshot', () => digits(['@e41', '@e42'], 10)); + const captures = h.fake.methods().filter((method) => method === 'capture.snapshot').length; + const action = kind === 'fill' ? { kind, value: '7', sensitive: false } : { kind }; + await h.engine.perform!(target.ref, action, { ...operation(), origin: 'test' }); + expect(h.fake.lastArgs('interactions.fill')).toMatchObject({ ref: selected === 0 ? '@e41' : '@e42' }); + expect(h.fake.methods().filter((method) => method === 'capture.snapshot')).toHaveLength(captures + 1); + }); + } + + it('recovers from a truncated capture after re-observation', async () => { + const h = harness({ transition: 0 }); + await openAttempt(h); + h.fake.respond('capture.snapshot', () => form()); + const old = await observed(h, 'Account'); + h.fake.respond('capture.snapshot', () => ({ ...form(), truncated: true })); + await expect(h.engine.perform!(old.ref, { kind: 'clear' }, operation())).rejects.toMatchObject({ code: 'NODE_STALE', retryable: true }); + expect(h.fake.methods()).not.toContain('interactions.fill'); + h.fake.respond('capture.snapshot', () => form()); + await h.engine.perform!((await observed(h, 'Account')).ref, { kind: 'clear' }, operation()); + expect(h.fake.methods().filter((method) => method === 'interactions.fill')).toHaveLength(1); + }); + + it('uses the newest backend ref for an unchanged uniquely identified input without taking pixels', async () => { + const h = harness({ transition: 0 }); + await openAttempt(h); + h.fake.respond('capture.snapshot', () => form()); + const old = await observed(h, 'Account'); + h.fake.respond('capture.snapshot', () => form(237, { ref: '@e42', focused: true })); + await h.engine.perform!(old.ref, { kind: 'fill', value: 'example', sensitive: true }, operation()); + expect(h.fake.lastArgs('interactions.fill')).toMatchObject({ ref: '@e42', text: 'example' }); + expect(h.fake.methods()).not.toContain('capture.screenshot'); + expect(h.fake.lastArgs('capture.snapshot')).toEqual({ interactiveOnly: false }); + }); + + it('does not silently accept changed security facts during a transition', async () => { + const h = harness(); + await openAttempt(h); + h.fake.respond('capture.snapshot', () => form()); + const old = await observed(h, 'Account'); + h.fake.respond('capture.snapshot', () => form(126, { enabled: false })); + const captures = h.fake.methods().filter((method) => method === 'capture.snapshot').length; + await expect(h.engine.perform!(old.ref, { kind: 'fill', value: 'example', sensitive: true }, { ...operation(), origin: 'test' })).rejects.toMatchObject({ code: 'NODE_STALE' }); + expect(h.fake.methods()).not.toContain('interactions.fill'); + expect(h.fake.methods().filter((method) => method === 'capture.snapshot')).toHaveLength(captures + 1); + }); + + it('does not send input if the preflight consumed the input budget', async () => { + const h = harness({ transition: 0 }); + await openAttempt(h); + h.fake.respond('capture.snapshot', () => form()); + const old = await observed(h, 'Account'); + h.fake.respond('capture.snapshot', async () => { await sleep(600); return form(); }); + await expect(h.engine.perform!(old.ref, { kind: 'clear' }, { ...operation(), timeoutMs: 500 })).rejects.toMatchObject({ code: 'OPERATION_TIMEOUT' }); + expect(h.fake.methods()).not.toContain('interactions.fill'); + }); + + it.each(['fill', 'clear'] as const)('does not capture or send %s after its transition wait is cancelled', async (kind) => { + const h = harness({ transition: 300 }); + await openAttempt(h); + const search = await observed(h, 'Search'); + const captures = h.fake.methods().filter((method) => method === 'capture.snapshot').length; + const controller = new AbortController(); + const action = kind === 'fill' ? { kind, value: 'example', sensitive: false } : { kind }; + const pending = h.engine.perform!(search.ref, action, { ...operation(controller.signal), origin: 'test' }); + setTimeout(() => controller.abort(), 20); + await expect(pending).rejects.toMatchObject({ code: 'CANCELLED' }); + expect(h.fake.methods().filter((method) => method === 'capture.snapshot')).toHaveLength(captures); + expect(h.fake.methods()).not.toContain('interactions.fill'); + }); + + it('does not dispatch when aborted during the preflight capture', async () => { + const h = harness({ transition: 0 }); + await openAttempt(h); + h.fake.respond('capture.snapshot', () => form()); + const old = await observed(h, 'Account'); + const controller = new AbortController(); + h.fake.respond('capture.snapshot', async () => { controller.abort(); return form(); }); + await expect(h.engine.perform!(old.ref, { kind: 'clear' }, operation(controller.signal))).rejects.toMatchObject({ code: 'CANCELLED' }); + expect(h.fake.methods()).not.toContain('interactions.fill'); + }); +}); + describe('deterministic actions', () => { const test = (): OperationContext => ({ ...operation(), origin: 'test' }); diff --git a/plugins/e2e/skills/e2e/references/setup.md b/plugins/e2e/skills/e2e/references/setup.md index 172ab0d40e..300b259eb4 100644 --- a/plugins/e2e/skills/e2e/references/setup.md +++ b/plugins/e2e/skills/e2e/references/setup.md @@ -380,6 +380,10 @@ export default { `transition` (default 500 ms). Opening or closing the keyboard also uses the remaining budget. Agent actions settle `settle` ms (default 150) before the next observation, `settle: false` skips it. +- Mobile `fill` and `clear` re-read the field before typing, replay included. + Missing fields, changed security state, or incomplete captures return + `NODE_STALE` before mutation, then retry after a fresh observation. + Non-input targets return `UNSUPPORTED_CAPABILITY`. - `screen`, `expect`, `app`, `agent` work unchanged; `test` from `@e2e-dev/mobile` types the `device` fixture (`installApp`, `openLink`, `setPermission`, `setNetwork`, `setAppearance`, `clearKeychain`, `fold` diff --git a/skills/e2e/references/setup.md b/skills/e2e/references/setup.md index 172ab0d40e..300b259eb4 100644 --- a/skills/e2e/references/setup.md +++ b/skills/e2e/references/setup.md @@ -380,6 +380,10 @@ export default { `transition` (default 500 ms). Opening or closing the keyboard also uses the remaining budget. Agent actions settle `settle` ms (default 150) before the next observation, `settle: false` skips it. +- Mobile `fill` and `clear` re-read the field before typing, replay included. + Missing fields, changed security state, or incomplete captures return + `NODE_STALE` before mutation, then retry after a fresh observation. + Non-input targets return `UNSUPPORTED_CAPABILITY`. - `screen`, `expect`, `app`, `agent` work unchanged; `test` from `@e2e-dev/mobile` types the `device` fixture (`installApp`, `openLink`, `setPermission`, `setNetwork`, `setAppearance`, `clearKeychain`, `fold`