Skip to content

Commit d5ddd39

Browse files
committed
test(android): a content description change invalidates snapshot reuse and survives the selector digest
Review follow-up: `contentDescription` joined the presentation-equivalence key and the digest allowlist without a case in either table, so removing it later would have left both suites green.
1 parent c6dbc8a commit d5ddd39

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/commands/capture/runtime/snapshot-unchanged.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ test.each<Partial<SnapshotNode>>([
7070
{ subrole: 'AXCloseButton' },
7171
{ value: 'Draft' },
7272
{ identifier: 'create' },
73+
{ contentDescription: 'Create a draft' },
7374
{ enabled: false },
7475
{ selected: true },
7576
{ focused: true },
@@ -106,6 +107,17 @@ test.each<Partial<SnapshotNode>>([
106107
});
107108
});
108109

110+
test('unchanged metadata keeps a content description that did not change', () => {
111+
const described = () =>
112+
snapshot('Create', {
113+
nodes: [{ ...snapshot('Create').nodes[0]!, contentDescription: 'Create a draft' }],
114+
});
115+
116+
expect(
117+
buildUnchangedSnapshotMetadata({ previous: described(), current: described(), options: {} }),
118+
).toMatchObject({ nodeCount: 1 });
119+
});
120+
109121
test('unchanged metadata detects node count, order and truncation changes', () => {
110122
const first = snapshot('Create').nodes[0]!;
111123
const second = { ...first, index: 1, ref: 'e2', label: 'Cancel' };

‎src/daemon/__tests__/response-views.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ const MATCHED_NODE = {
203203
label: 'Sign in',
204204
value: 'enabled',
205205
identifier: 'login-button',
206+
contentDescription: 'Sign in to Demo',
206207
enabled: true,
207208
selected: false,
208209
focused: false,
@@ -227,6 +228,7 @@ const COMPACT_NODE = {
227228
label: 'Sign in',
228229
value: 'enabled',
229230
identifier: 'login-button',
231+
contentDescription: 'Sign in to Demo',
230232
enabled: true,
231233
selected: false,
232234
focused: false,

0 commit comments

Comments
 (0)