Skip to content

Commit 2c30d54

Browse files
committed
test(ios): prove reported viewport evidence survives presentation
1 parent 16763e0 commit 2c30d54

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎packages/platform-apple/src/snapshot-presentation.test.ts‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import type { RawSnapshotNode } from '@agent-device/kernel/snapshot';
66
import type { IosSystemSurfaceProvenance } from '@agent-device/contracts/ios-system-surface';
77
import type { AppleRunnerSnapshotResult } from './snapshot-presentation.ts';
88
import { presentAppleRunnerSnapshot, readAppleSnapshotResult } from './snapshot-presentation.ts';
9-
import { assertSnapshotScreenOrigin } from '@agent-device/contracts/capture';
9+
import {
10+
assertSnapshotScreenOrigin,
11+
attachSnapshotViewportEvidence,
12+
copySnapshotViewportEvidence,
13+
} from '@agent-device/contracts/capture';
1014

1115
const NO_VIEWPORT_ROOT = { index: 0, type: 'Application', label: 'App' };
1216

@@ -87,9 +91,21 @@ test('reported runner viewport retains screen authority through the wire reader
8791
},
8892
IOS_SIMULATOR,
8993
);
94+
assert.deepEqual(read.viewportEvidence, { kind: 'reported', rect });
9095
const presented = presentAppleRunnerSnapshot('device-1', undefined, read);
9196
assert.deepEqual(presented.viewport, { width: 551, height: 813 });
92-
await assert.doesNotReject(assertSnapshotScreenOrigin(presented.nodes, 'Captured action'));
97+
assert.deepEqual(presented.nodes.find((node) => node.identifier === 'action')?.rect, {
98+
x: 481,
99+
y: 314,
100+
width: 220,
101+
height: 42,
102+
});
103+
const priorUnknown = attachSnapshotViewportEvidence([], {
104+
kind: 'missing',
105+
reason: 'not-provided',
106+
});
107+
copySnapshotViewportEvidence(presented.nodes, priorUnknown);
108+
await assert.doesNotReject(assertSnapshotScreenOrigin(priorUnknown, 'Captured action'));
93109
});
94110

95111
function presentSparse(overrides: Partial<AppleRunnerSnapshotResult> = {}) {

0 commit comments

Comments
 (0)