From d683ab21efdc81348d30e83257408ae69865d186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 18 Nov 2026 11:32:13 +0100 Subject: [PATCH] test(interaction): stop the interaction-contract lane waiting real time The lane's daemon scenarios each paid the post-open first-screen stabilization: the open marked the next capture, whose loop polled on a 200ms schedule, so every scenario scripted and absorbed two settling runner reads. The open now opts out with the product flag postGestureStabilization: false, and the harness scripts the one read its own snapshot performs. The scenarios prove dispatch shape, not the first-screen wait, which the provider-scenarios lane owns with its own scripted settling pair. Three --settle contract tests slept the settle loop's quiet windows on the wall clock while the harness already exposes createContractClock; they now pass it, so the loop runs its polls on the contract clock. The daemon-backed scenarios that lacked the documented parallel-budget exception now carry PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, matching their siblings; coordinate errorTaxonomy timed out at the 5s default on main (run 44134141716). Local whole-lane duration: 15.1-16.0s to 9.5-10.0s; the settle tests go from ~1.5s each to under 6ms. Co-Authored-By: Claude Opus 5.5 --- .../coordinate.contract.test.ts | 80 +++-- .../interaction-contract/daemon-harness.ts | 10 +- .../interaction-response-shape.test.ts | 322 ++++++++++-------- .../maestro-direct-selector.contract.test.ts | 31 +- .../maestro-fallback.contract.test.ts | 100 +++--- .../runtime-ref.contract.test.ts | 1 + .../runtime-selector.contract.test.ts | 1 + 7 files changed, 306 insertions(+), 239 deletions(-) diff --git a/test/integration/interaction-contract/coordinate.contract.test.ts b/test/integration/interaction-contract/coordinate.contract.test.ts index 6ae749819d..e6a3b04385 100644 --- a/test/integration/interaction-contract/coordinate.contract.test.ts +++ b/test/integration/interaction-contract/coordinate.contract.test.ts @@ -3,10 +3,11 @@ import { test } from 'vitest'; import type { InteractionGuarantee } from '@agent-device/contracts/interaction-guarantees'; import { makeSnapshotState } from '@agent-device/selectors/snapshot-geometry-fixtures'; import { assertRpcError, assertRpcOk } from '../provider-scenarios/assertions.ts'; +import { PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS } from '../provider-scenarios/test-timeouts.ts'; import { scenarioName } from './coverage-manifest.ts'; import { COORDINATE_COVERAGE } from './coordinate.coverage.ts'; import { settledWelcomeSnapshot, viewportOnlySnapshot } from './fixtures.ts'; -import { createContractDevice } from './runtime-harness.ts'; +import { createContractClock, createContractDevice } from './runtime-harness.ts'; import { runnerTapEntry, runnerTapErrorEntry, withIosContractDaemon } from './daemon-harness.ts'; // ADR 0011 Layer 3, coordinate path: raw x/y tap, intentionally minimal @@ -63,6 +64,7 @@ test(scenario('settleObservation'), async () => { return { snapshot: settledWelcomeSnapshot() }; }, tap: async () => ({ ok: true }), + clock: createContractClock(), }); const result = await device.interactions.press( @@ -77,38 +79,50 @@ test(scenario('settleObservation'), async () => { assert.deepEqual(settle.diff?.summary, { additions: 1, removals: 1, unchanged: 0 }); }); -test(scenario('errorTaxonomy'), async () => { - await withIosContractDaemon( - [runnerTapErrorEntry(new Error('runner tap crashed'))], - async (daemon) => { - const press = await daemon.callCommand('press', ['100', '200']); - // An unclassified backend failure gets the shared fallback classification - // from normalizeError: stable code, original message, actionable hint. - const error = assertRpcError(press, 500, 'UNKNOWN', /runner tap crashed/); - assert.ok(typeof error.hint === 'string' && error.hint.length > 0); - assert.ok(typeof error.diagnosticId === 'string'); - }, - ); -}); +test( + scenario('errorTaxonomy'), + async () => { + await withIosContractDaemon( + [runnerTapErrorEntry(new Error('runner tap crashed'))], + async (daemon) => { + const press = await daemon.callCommand('press', ['100', '200']); + // An unclassified backend failure gets the shared fallback classification + // from normalizeError: stable code, original message, actionable hint. + const error = assertRpcError(press, 500, 'UNKNOWN', /runner tap crashed/); + assert.ok(typeof error.hint === 'string' && error.hint.length > 0); + assert.ok(typeof error.diagnosticId === 'string'); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); -test(scenario('responseConstruction'), async () => { - await withIosContractDaemon([runnerTapEntry({ x: 100, y: 200 })], async (daemon) => { - const press = await daemon.callCommand('press', ['100', '200']); - const data = assertRpcOk(press); - // Canonical point response set: the tapped coordinates, no fabricated - // identity fields (the path has no resolved node by design). - assert.equal(data.x, 100); - assert.equal(data.y, 200); - assert.equal(data.ref, undefined); - assert.equal(data.selector, undefined); - }); -}); +test( + scenario('responseConstruction'), + async () => { + await withIosContractDaemon([runnerTapEntry({ x: 100, y: 200 })], async (daemon) => { + const press = await daemon.callCommand('press', ['100', '200']); + const data = assertRpcOk(press); + // Canonical point response set: the tapped coordinates, no fabricated + // identity fields (the path has no resolved node by design). + assert.equal(data.x, 100); + assert.equal(data.y, 200); + assert.equal(data.ref, undefined); + assert.equal(data.selector, undefined); + }); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); // Inapplicable cell (ADR 0012), so intentionally absent from the coverage manifest. -test('coordinate resolutionDisclosure: inapplicable — no resolution field is attached', async () => { - await withIosContractDaemon([runnerTapEntry({ x: 100, y: 200 })], async (daemon) => { - const press = await daemon.callCommand('press', ['100', '200']); - const data = assertRpcOk(press); - assert.equal(data.resolution, undefined); - }); -}); +test( + 'coordinate resolutionDisclosure: inapplicable — no resolution field is attached', + async () => { + await withIosContractDaemon([runnerTapEntry({ x: 100, y: 200 })], async (daemon) => { + const press = await daemon.callCommand('press', ['100', '200']); + const data = assertRpcOk(press); + assert.equal(data.resolution, undefined); + }); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); diff --git a/test/integration/interaction-contract/daemon-harness.ts b/test/integration/interaction-contract/daemon-harness.ts index 826ccc9bee..b3793e0c02 100644 --- a/test/integration/interaction-contract/daemon-harness.ts +++ b/test/integration/interaction-contract/daemon-harness.ts @@ -22,7 +22,11 @@ import { export const CONTRACT_APP = 'com.example.app'; const CONTRACT_DEVICE_ID = PROVIDER_SCENARIO_IOS_SIMULATOR.id; -const SETTLING_CAPTURE_READS = 2; +// The open opts out of post-open stabilization: the lane proves dispatch shape, and the stabilization +// loop would poll the first capture on a 200ms schedule for a screen nothing here watches. The +// harness's own snapshot is then the first capture after the open and reads the first screen once. +// Each scenario's conversation with the runner follows, exactly as scripted. +const SETTLING_CAPTURE_READS = 1; /** * Provider-transcript harness for contract scenarios whose path involves the @@ -37,9 +41,6 @@ export async function withIosContractDaemon( run: (daemon: ProviderScenarioHarness, transcript: ProviderScenarioTranscript) => Promise, options: { saveScript?: boolean | string } = {}, ): Promise { - // The scripted open is not read back, so the first capture after it settles over a quiet pair of - // reads and pauses the direct selector path. A snapshot consumes that pair here, keeping each - // scenario's own conversation with the runner exactly as scripted. const transcript = createProviderTranscript([ ...Array.from({ length: SETTLING_CAPTURE_READS }, () => runnerSnapshotEntry(FIRST_SCREEN_NODES), @@ -74,6 +75,7 @@ export async function withIosContractDaemon( const open = await daemon.callCommand('open', [CONTRACT_APP], { platform: 'ios', udid: CONTRACT_DEVICE_ID, + postGestureStabilization: false, ...(options.saveScript !== undefined ? { saveScript: options.saveScript } : {}), }); assertRpcOk(open); diff --git a/test/integration/interaction-contract/interaction-response-shape.test.ts b/test/integration/interaction-contract/interaction-response-shape.test.ts index bce9255eb2..8a8e62bc15 100644 --- a/test/integration/interaction-contract/interaction-response-shape.test.ts +++ b/test/integration/interaction-contract/interaction-response-shape.test.ts @@ -83,160 +83,196 @@ test( PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, ); -test('interaction response shape: fill @ref uses the canonical ref envelope', async () => { - await withIosContractDaemon( - [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerTypeEntry({})], - async (daemon, transcript) => { - assertRpcOk(await daemon.callCommand('snapshot', [], { snapshotInteractiveOnly: true })); +test( + 'interaction response shape: fill @ref uses the canonical ref envelope', + async () => { + await withIosContractDaemon( + [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerTypeEntry({})], + async (daemon, transcript) => { + assertRpcOk(await daemon.callCommand('snapshot', [], { snapshotInteractiveOnly: true })); - const data = assertRpcOk(await daemon.callCommand('fill', ['@e2', 'Hello'])); - assertRunnerRequest(transcript, 'ios.runner.type', typeRequest(200, 322, 'Hello')); + const data = assertRpcOk(await daemon.callCommand('fill', ['@e2', 'Hello'])); + assertRunnerRequest(transcript, 'ios.runner.type', typeRequest(200, 322, 'Hello')); - assertCanonicalRef(data, { - message: 'Filled 5 chars', - x: 200, - y: 322, - extra: { - delayMs: 0, - text: 'Hello', - warning: 'fill target @e2 resolved to "Button", attempting fill anyway.', - }, - }); - }, - ); -}); + assertCanonicalRef(data, { + message: 'Filled 5 chars', + x: 200, + y: 322, + extra: { + delayMs: 0, + text: 'Hello', + warning: 'fill target @e2 resolved to "Button", attempting fill anyway.', + }, + }); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); -test('interaction response shape: longpress @ref uses the canonical ref envelope', async () => { - await withIosContractDaemon( - [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerLongPressEntry({})], - async (daemon, transcript) => { - assertRpcOk(await daemon.callCommand('snapshot', [], { snapshotInteractiveOnly: true })); +test( + 'interaction response shape: longpress @ref uses the canonical ref envelope', + async () => { + await withIosContractDaemon( + [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerLongPressEntry({})], + async (daemon, transcript) => { + assertRpcOk(await daemon.callCommand('snapshot', [], { snapshotInteractiveOnly: true })); - const data = assertRpcOk(await daemon.callCommand('longpress', ['@e2', '700'])); - assertRunnerRequest(transcript, 'ios.runner.longPress', longPressRequest(200, 322, 700)); + const data = assertRpcOk(await daemon.callCommand('longpress', ['@e2', '700'])); + assertRunnerRequest(transcript, 'ios.runner.longPress', longPressRequest(200, 322, 700)); - assertCanonicalRef(data, { - message: 'Long pressed @e2 (200, 322)', - x: 200, - y: 322, - extra: { durationMs: 700, gesture: 'longpress' }, - }); - }, - ); -}); - -test('interaction response shape: press selector uses the canonical selector envelope', async () => { - await withIosContractDaemon( - [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerTapEntry({})], - async (daemon, transcript) => { - const data = assertRpcOk(await daemon.callCommand('press', ['label=Continue'])); - assertRunnerRequest(transcript, 'ios.runner.tap', tapRequest(200, 322)); - - assertCanonicalSelector(data, { - message: 'Tapped label=Continue (200, 322)', - x: 200, - y: 322, + assertCanonicalRef(data, { + message: 'Long pressed @e2 (200, 322)', + x: 200, + y: 322, + extra: { durationMs: 700, gesture: 'longpress' }, + }); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); + +test( + 'interaction response shape: press selector uses the canonical selector envelope', + async () => { + await withIosContractDaemon( + [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerTapEntry({})], + async (daemon, transcript) => { + const data = assertRpcOk(await daemon.callCommand('press', ['label=Continue'])); + assertRunnerRequest(transcript, 'ios.runner.tap', tapRequest(200, 322)); + + assertCanonicalSelector(data, { + message: 'Tapped label=Continue (200, 322)', + x: 200, + y: 322, + }); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); + +test( + 'interaction response shape: fill selector uses the canonical selector envelope', + async () => { + await withIosContractDaemon( + [ + runnerSnapshotEntry(RUNNER_CONTINUE_NODES), + runnerTypeEntry({ ...NOISY_DEFAULT_TAP_RESULT, x: 200, y: 322 }), + ], + async (daemon, transcript) => { + const data = assertRpcOk(await daemon.callCommand('fill', ['label=Continue', 'Hello'])); + assertRunnerRequest(transcript, 'ios.runner.type', typeRequest(200, 322, 'Hello')); + + assertCanonicalSelector(data, { + message: 'Filled 5 chars', + x: 200, + y: 322, + extra: { + delayMs: 0, + text: 'Hello', + warning: 'fill target label=Continue resolved to "Button", attempting fill anyway.', + }, + }); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); + +test( + 'interaction response shape: longpress selector uses the canonical selector envelope', + async () => { + await withIosContractDaemon( + [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerLongPressEntry({})], + async (daemon, transcript) => { + const data = assertRpcOk(await daemon.callCommand('longpress', ['label=Continue', '700'])); + assertRunnerRequest(transcript, 'ios.runner.longPress', longPressRequest(200, 322, 700)); + + assertCanonicalSelector(data, { + message: 'Long pressed label=Continue (200, 322)', + x: 200, + y: 322, + extra: { durationMs: 700, gesture: 'longpress' }, + }); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); + +test( + 'interaction response shape: press point uses the canonical point envelope', + async () => { + await withIosContractDaemon([runnerTapEntry({})], async (daemon, transcript) => { + const data = assertRpcOk(await daemon.callCommand('press', ['100', '200'])); + assertRunnerRequest(transcript, 'ios.runner.tap', tapRequest(100, 200)); + + assertCanonicalPoint(data, { + message: 'Tapped (100, 200)', + x: 100, + y: 200, }); - }, - ); -}); - -test('interaction response shape: fill selector uses the canonical selector envelope', async () => { - await withIosContractDaemon( - [ - runnerSnapshotEntry(RUNNER_CONTINUE_NODES), - runnerTypeEntry({ ...NOISY_DEFAULT_TAP_RESULT, x: 200, y: 322 }), - ], - async (daemon, transcript) => { - const data = assertRpcOk(await daemon.callCommand('fill', ['label=Continue', 'Hello'])); - assertRunnerRequest(transcript, 'ios.runner.type', typeRequest(200, 322, 'Hello')); - - assertCanonicalSelector(data, { + }); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); + +test( + 'interaction response shape: fill point uses the canonical point envelope', + async () => { + await withIosContractDaemon([runnerTypeEntry({})], async (daemon, transcript) => { + const data = assertRpcOk(await daemon.callCommand('fill', ['100', '200', 'Hello'])); + assertRunnerRequest(transcript, 'ios.runner.type', typeRequest(100, 200, 'Hello')); + + assertCanonicalPoint(data, { message: 'Filled 5 chars', - x: 200, - y: 322, - extra: { - delayMs: 0, - text: 'Hello', - warning: 'fill target label=Continue resolved to "Button", attempting fill anyway.', - }, - }); - }, - ); -}); - -test('interaction response shape: longpress selector uses the canonical selector envelope', async () => { - await withIosContractDaemon( - [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerLongPressEntry({})], - async (daemon, transcript) => { - const data = assertRpcOk(await daemon.callCommand('longpress', ['label=Continue', '700'])); - assertRunnerRequest(transcript, 'ios.runner.longPress', longPressRequest(200, 322, 700)); - - assertCanonicalSelector(data, { - message: 'Long pressed label=Continue (200, 322)', - x: 200, - y: 322, - extra: { durationMs: 700, gesture: 'longpress' }, + x: 100, + y: 200, + extra: { delayMs: 0, text: 'Hello' }, }); - }, - ); -}); + }); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); -test('interaction response shape: press point uses the canonical point envelope', async () => { - await withIosContractDaemon([runnerTapEntry({})], async (daemon, transcript) => { - const data = assertRpcOk(await daemon.callCommand('press', ['100', '200'])); - assertRunnerRequest(transcript, 'ios.runner.tap', tapRequest(100, 200)); +test( + 'interaction response shape: type tolerates a zero-sized runner reference frame', + async () => { + await withIosContractDaemon( + [runnerTypeEntry({ referenceWidth: 0, referenceHeight: 0 })], + async (daemon) => { + const data = assertRpcOk(await daemon.callCommand('type', ['Hello'])); + + // A zero-sized runner frame is unusable coordinate evidence. The daemon + // drops it instead of normalizing through zero or rejecting bare type. + assert.equal(data.referenceWidth, undefined); + assert.equal(data.referenceHeight, undefined); + assert.equal(data.text, 'Hello'); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); - assertCanonicalPoint(data, { - message: 'Tapped (100, 200)', - x: 100, - y: 200, - }); - }); -}); - -test('interaction response shape: fill point uses the canonical point envelope', async () => { - await withIosContractDaemon([runnerTypeEntry({})], async (daemon, transcript) => { - const data = assertRpcOk(await daemon.callCommand('fill', ['100', '200', 'Hello'])); - assertRunnerRequest(transcript, 'ios.runner.type', typeRequest(100, 200, 'Hello')); - - assertCanonicalPoint(data, { - message: 'Filled 5 chars', - x: 100, - y: 200, - extra: { delayMs: 0, text: 'Hello' }, - }); - }); -}); - -test('interaction response shape: type tolerates a zero-sized runner reference frame', async () => { - await withIosContractDaemon( - [runnerTypeEntry({ referenceWidth: 0, referenceHeight: 0 })], - async (daemon) => { - const data = assertRpcOk(await daemon.callCommand('type', ['Hello'])); - - // A zero-sized runner frame is unusable coordinate evidence. The daemon - // drops it instead of normalizing through zero or rejecting bare type. - assert.equal(data.referenceWidth, undefined); - assert.equal(data.referenceHeight, undefined); - assert.equal(data.text, 'Hello'); - }, - ); -}); - -test('interaction response shape: longpress point uses the canonical point envelope', async () => { - await withIosContractDaemon([runnerLongPressEntry({})], async (daemon, transcript) => { - const data = assertRpcOk(await daemon.callCommand('longpress', ['100', '200', '700'])); - assertRunnerRequest(transcript, 'ios.runner.longPress', longPressRequest(100, 200, 700)); - - assertCanonicalPoint(data, { - message: 'Long pressed (100, 200)', - x: 100, - y: 200, - extra: { durationMs: 700, gesture: 'longpress' }, +test( + 'interaction response shape: longpress point uses the canonical point envelope', + async () => { + await withIosContractDaemon([runnerLongPressEntry({})], async (daemon, transcript) => { + const data = assertRpcOk(await daemon.callCommand('longpress', ['100', '200', '700'])); + assertRunnerRequest(transcript, 'ios.runner.longPress', longPressRequest(100, 200, 700)); + + assertCanonicalPoint(data, { + message: 'Long pressed (100, 200)', + x: 100, + y: 200, + extra: { durationMs: 700, gesture: 'longpress' }, + }); }); - }); -}); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); function assertCanonicalRef( data: WireData, diff --git a/test/integration/interaction-contract/maestro-direct-selector.contract.test.ts b/test/integration/interaction-contract/maestro-direct-selector.contract.test.ts index fb63c34189..afa9a87aa4 100644 --- a/test/integration/interaction-contract/maestro-direct-selector.contract.test.ts +++ b/test/integration/interaction-contract/maestro-direct-selector.contract.test.ts @@ -1,6 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { assertRpcOk } from '../provider-scenarios/assertions.ts'; +import { PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS } from '../provider-scenarios/test-timeouts.ts'; import { runnerTapEntry, withIosContractDaemon } from './daemon-harness.ts'; import { scenarioName } from './coverage-manifest.ts'; import { MAESTRO_DIRECT_SELECTOR_COVERAGE } from './maestro-direct-selector.coverage.ts'; @@ -9,17 +10,21 @@ const MAESTRO_FLAGS = { maestro: { allowNonHittableCoordinateFallback: true } }; // Permission is not usage: when the runner hits the element normally, the // completed dispatch is the direct-selector path, not the coordinate fallback. -test(scenarioName(MAESTRO_DIRECT_SELECTOR_COVERAGE, 'responseConstruction'), async () => { - await withIosContractDaemon( - [runnerTapEntry({ x: 50, y: 60, message: 'tapped' })], - async (daemon, transcript) => { - const data = assertRpcOk(await daemon.callCommand('click', ['label=Pin'], MAESTRO_FLAGS)); +test( + scenarioName(MAESTRO_DIRECT_SELECTOR_COVERAGE, 'responseConstruction'), + async () => { + await withIosContractDaemon( + [runnerTapEntry({ x: 50, y: 60, message: 'tapped' })], + async (daemon, transcript) => { + const data = assertRpcOk(await daemon.callCommand('click', ['label=Pin'], MAESTRO_FLAGS)); - const tapRequest = transcript.calls[0]?.request as Record | undefined; - assert.equal(tapRequest?.allowNonHittableCoordinateFallback, true); - assert.equal(data.maestroNonHittableCoordinateFallbackAllowed, true); - assert.equal(data.maestroNonHittableCoordinateFallbackUsed, false); - assert.deepEqual(data.resolution, { source: 'direct-ios', kind: 'not-observed' }); - }, - ); -}); + const tapRequest = transcript.calls[0]?.request as Record | undefined; + assert.equal(tapRequest?.allowNonHittableCoordinateFallback, true); + assert.equal(data.maestroNonHittableCoordinateFallbackAllowed, true); + assert.equal(data.maestroNonHittableCoordinateFallbackUsed, false); + assert.deepEqual(data.resolution, { source: 'direct-ios', kind: 'not-observed' }); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); diff --git a/test/integration/interaction-contract/maestro-fallback.contract.test.ts b/test/integration/interaction-contract/maestro-fallback.contract.test.ts index 2c335eb9c4..2ad1f49eb3 100644 --- a/test/integration/interaction-contract/maestro-fallback.contract.test.ts +++ b/test/integration/interaction-contract/maestro-fallback.contract.test.ts @@ -69,55 +69,63 @@ test( // dispatch that RAN — a runtime fill the fallback never touched still // discloses how the daemon resolved it, whether or not the request carried the // Maestro permission. -test('runtime fill the coordinate fallback did not execute keeps its resolution disclosure', async () => { - await withIosContractDaemon( - [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerTypeEntry({ x: 200, y: 322 })], - async (daemon) => { - const data = assertRpcOk( - await daemon.callCommand('fill', ['label=Continue', '1234'], MAESTRO_FLAGS), - ); +test( + 'runtime fill the coordinate fallback did not execute keeps its resolution disclosure', + async () => { + await withIosContractDaemon( + [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerTypeEntry({ x: 200, y: 322 })], + async (daemon) => { + const data = assertRpcOk( + await daemon.callCommand('fill', ['label=Continue', '1234'], MAESTRO_FLAGS), + ); - assert.equal(data.maestroNonHittableCoordinateFallbackAllowed, true); - assert.equal(data.maestroNonHittableCoordinateFallbackUsed, false); - assert.deepEqual(data.resolution, { - source: 'runtime', - phase: 'pre-action', - kind: 'unique', - }); - }, - ); -}); + assert.equal(data.maestroNonHittableCoordinateFallbackAllowed, true); + assert.equal(data.maestroNonHittableCoordinateFallbackUsed, false); + assert.deepEqual(data.resolution, { + source: 'runtime', + phase: 'pre-action', + kind: 'unique', + }); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); -test('Maestro fill of a non-hittable input resolves through the runtime path', async () => { - await withIosContractDaemon( - [ - runnerSnapshotEntry(RUNNER_NON_HITTABLE_TEXT_INPUT_NODES), - runnerTypeEntry({ - x: 100, - y: 60, - maestroNonHittableCoordinateFallbackUsed: true, - }), - ], - async (daemon, transcript) => { - const data = assertRpcOk( - await daemon.callCommand('fill', ['label=Pin', '1234'], MAESTRO_FLAGS), - ); +test( + 'Maestro fill of a non-hittable input resolves through the runtime path', + async () => { + await withIosContractDaemon( + [ + runnerSnapshotEntry(RUNNER_NON_HITTABLE_TEXT_INPUT_NODES), + runnerTypeEntry({ + x: 100, + y: 60, + maestroNonHittableCoordinateFallbackUsed: true, + }), + ], + async (daemon, transcript) => { + const data = assertRpcOk( + await daemon.callCommand('fill', ['label=Pin', '1234'], MAESTRO_FLAGS), + ); - assert.equal(transcript.calls[0]?.command, 'ios.runner.snapshot'); - assert.equal(transcript.calls[1]?.command, 'ios.runner.type'); - const typeRequest = transcript.calls[1]?.request as Record | undefined; - assert.equal(typeRequest?.selectorKey, undefined); - assert.equal(typeRequest?.x, 100); - assert.equal(typeRequest?.y, 60); - assert.equal(typeRequest?.allowNonHittableCoordinateFallback, true); - assert.equal(data.resolution, undefined); - assert.equal(data.targetHittable, false); - assert.equal(data.maestroNonHittableCoordinateFallbackAllowed, true); - assert.equal(data.maestroNonHittableCoordinateFallbackUsed, true); - assert.equal(data.maestroFallbackReason, 'non-hittable-coordinate'); - }, - ); -}); + assert.equal(transcript.calls[0]?.command, 'ios.runner.snapshot'); + assert.equal(transcript.calls[1]?.command, 'ios.runner.type'); + const typeRequest = transcript.calls[1]?.request as Record | undefined; + assert.equal(typeRequest?.selectorKey, undefined); + assert.equal(typeRequest?.x, 100); + assert.equal(typeRequest?.y, 60); + assert.equal(typeRequest?.allowNonHittableCoordinateFallback, true); + assert.equal(data.resolution, undefined); + assert.equal(data.targetHittable, false); + assert.equal(data.maestroNonHittableCoordinateFallbackAllowed, true); + assert.equal(data.maestroNonHittableCoordinateFallbackUsed, true); + assert.equal(data.maestroFallbackReason, 'non-hittable-coordinate'); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); test( scenario('offscreen'), diff --git a/test/integration/interaction-contract/runtime-ref.contract.test.ts b/test/integration/interaction-contract/runtime-ref.contract.test.ts index 4db849a7ae..d48392a761 100644 --- a/test/integration/interaction-contract/runtime-ref.contract.test.ts +++ b/test/integration/interaction-contract/runtime-ref.contract.test.ts @@ -211,6 +211,7 @@ test(scenario('settleObservation'), async () => { const device = createContractDevice(continueButtonSnapshot(), { captureSnapshot: async () => ({ snapshot: settledWelcomeSnapshot() }), tap: async () => ({ ok: true }), + clock: createContractClock(), }); const result = await device.interactions.press(ref('@e1'), { diff --git a/test/integration/interaction-contract/runtime-selector.contract.test.ts b/test/integration/interaction-contract/runtime-selector.contract.test.ts index 970af7e650..4e97a5635d 100644 --- a/test/integration/interaction-contract/runtime-selector.contract.test.ts +++ b/test/integration/interaction-contract/runtime-selector.contract.test.ts @@ -347,6 +347,7 @@ test(scenario('settleObservation'), async () => { // the (already stable) post-action tree. captureSnapshot: async () => ({ snapshot: captures++ === 0 ? before : after }), tap: async () => ({ ok: true }), + clock: createContractClock(), }); const result = await device.interactions.press(selector('label=Continue'), {