diff --git a/packages/daemon/src/__tests__/support/command-surface-fake.test.ts b/packages/daemon/src/__tests__/support/command-surface-fake.test.ts index 6f2c3e29b3..38dba395e5 100644 --- a/packages/daemon/src/__tests__/support/command-surface-fake.test.ts +++ b/packages/daemon/src/__tests__/support/command-surface-fake.test.ts @@ -31,18 +31,6 @@ test('the forwarding surface returns and stores the snapshot tree the daemon bac expect(set).toHaveBeenCalledWith(expect.objectContaining({ name: 'default', snapshot })); }); -test('the forwarding surface falls back to a flat node list from a backend that returns no snapshot', async () => { - const { config, set } = configReturning({ nodes: [node] }); - const surface = await forwardingCreateCommandSurface(config); - - const result = await surface.capture.snapshot({ session: 'default' }); - - expect(result.nodes).toEqual([node]); - expect(set).toHaveBeenCalledWith( - expect.objectContaining({ snapshot: expect.objectContaining({ nodes: [node] }) }), - ); -}); - test('the forwarding surface diff stores the observed tree and reports whether it initialized the baseline', async () => { const snapshot: SnapshotState = { nodes: [node], createdAt: 1, backend: 'android' }; const first = configReturning({ snapshot }); diff --git a/packages/daemon/src/__tests__/support/command-surface-fake.ts b/packages/daemon/src/__tests__/support/command-surface-fake.ts index 0deb0a5c68..0c6fc4aa0d 100644 --- a/packages/daemon/src/__tests__/support/command-surface-fake.ts +++ b/packages/daemon/src/__tests__/support/command-surface-fake.ts @@ -88,7 +88,7 @@ export const forwardingCreateCommandSurface: CreateDaemonCommandSurface = async }, ); const stored = captured?.snapshot ?? { - nodes: captured?.nodes ?? [], + nodes: [], createdAt: Date.now(), backend: 'android' as const, }; diff --git a/src/commands/capture/runtime/snapshot-freshness.test.ts b/src/commands/capture/runtime/snapshot-freshness.test.ts index 6ad4b97e95..45c19ab88a 100644 --- a/src/commands/capture/runtime/snapshot-freshness.test.ts +++ b/src/commands/capture/runtime/snapshot-freshness.test.ts @@ -37,9 +37,7 @@ const ANDROID_ROWS = Array.from({ length: 24 }, (_, index) => ({ test('runtime snapshot warns when Android freshness retries still return the previous route', async () => { const device = snapshotDevice({ - nodes: ANDROID_ROWS, - truncated: false, - backend: 'android', + snapshot: makeSnapshotState(ANDROID_ROWS, { truncated: false, backend: 'android' }), freshness: { action: 'press', retryCount: 3, @@ -58,9 +56,7 @@ test('runtime diff snapshot carries the stale-route warning for recent Android p baseline.createdAt = 1_000; const device = snapshotDevice( { - nodes: ANDROID_ROWS, - truncated: false, - backend: 'android', + snapshot: makeSnapshotState(ANDROID_ROWS, { truncated: false, backend: 'android' }), freshness: { action: 'press', retryCount: 3, @@ -78,9 +74,7 @@ test('runtime diff snapshot carries the stale-route warning for recent Android p test('runtime snapshot raises no stale-route warning once the freshness retries succeeded', async () => { const device = snapshotDevice({ - nodes: ANDROID_ROWS, - truncated: false, - backend: 'android', + snapshot: makeSnapshotState(ANDROID_ROWS, { truncated: false, backend: 'android' }), freshness: { action: 'press', retryCount: 1, staleAfterRetries: false }, }); @@ -106,16 +100,17 @@ test.each([ previous.presentationKey = buildSnapshotPresentationKey({ interactiveOnly: interactive }); const device = snapshotDevice( { - nodes: Array.from({ length: 8 }, (_, index) => ({ - ref: `e${index + 1}`, - index, - depth: 0, - type: 'android.widget.Button', - label: `Action ${index + 1}`, - hittable: true, - })), - truncated: false, - backend: 'android', + snapshot: makeSnapshotState( + Array.from({ length: 8 }, (_, index) => ({ + ref: `e${index + 1}`, + index, + depth: 0, + type: 'android.widget.Button', + label: `Action ${index + 1}`, + hittable: true, + })), + { truncated: false, backend: 'android' }, + ), }, { name: 'default', snapshot: previous }, ); @@ -130,29 +125,28 @@ test.each([ test('runtime snapshot reports normalized visibility metadata for scroll-hidden content', async () => { const device = snapshotDevice({ - nodes: [ - { - ref: 'e1', - index: 0, - depth: 0, - type: 'android.widget.ScrollView', - label: 'Messages', - rect: { x: 0, y: 100, width: 390, height: 500 }, - hiddenContentBelow: true, - }, - { - ref: 'e2', - index: 1, - depth: 1, - parentIndex: 0, - type: 'android.widget.Button', - label: 'Visible message', - rect: { x: 0, y: 140, width: 390, height: 48 }, - hittable: true, - }, - ], - truncated: false, - backend: 'android', + snapshot: makeSnapshotState( + [ + { + index: 0, + depth: 0, + type: 'android.widget.ScrollView', + label: 'Messages', + rect: { x: 0, y: 100, width: 390, height: 500 }, + hiddenContentBelow: true, + }, + { + index: 1, + depth: 1, + parentIndex: 0, + type: 'android.widget.Button', + label: 'Visible message', + rect: { x: 0, y: 140, width: 390, height: 48 }, + hittable: true, + }, + ], + { truncated: false, backend: 'android' }, + ), analysis: { rawNodeCount: 2, maxDepth: 1 }, }); diff --git a/src/commands/interaction/runtime/wait-capture-options.test.ts b/src/commands/interaction/runtime/wait-capture-options.test.ts index ecb634b290..28819ed03b 100644 --- a/src/commands/interaction/runtime/wait-capture-options.test.ts +++ b/src/commands/interaction/runtime/wait-capture-options.test.ts @@ -21,12 +21,11 @@ const BATTERY = makeSnapshotState( ); function pollingDevice(captureOptions: Array) { - const captures = [LOCATION_REQUIRED, BATTERY]; const backend: AgentDeviceBackend = { platform: 'android', captureSnapshot: async (_context, options) => { captureOptions.push(options); - return { snapshot: captures[Math.min(captureOptions.length, captures.length) - 1] }; + return { snapshot: captureOptions.length === 1 ? LOCATION_REQUIRED : BATTERY }; }, }; return createAgentDevice({