Skip to content

Commit 0b0a029

Browse files
committed
test(ios): align depth smoke with AX hierarchy
1 parent 71cd9c3 commit 0b0a029

2 files changed

Lines changed: 8 additions & 58 deletions

File tree

‎examples/test-app/src/screens/VisibleDepthScreen.tsx‎

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,17 @@ import { Pressable, StyleSheet, View } from 'react-native';
22

33
import { useAppColors, type AppColors } from '../theme';
44

5-
/**
6-
* Keeps the structural wrapper outside the viewport while its independent child projects into
7-
* it. Its stable test ID makes the wrapper acquisition-eligible without turning its ancestors into
8-
* labeled structural nodes; it must stay an `Other` node in XCTest rather than a scroll/container
9-
* type that owns descendant visibility.
10-
*/
115
export function VisibleDepthScreen() {
126
const colors = useAppColors();
137
const styles = createStyles(colors);
148

159
return (
1610
<View accessible={false} style={styles.frame}>
17-
<View accessible={false} style={styles.clippedParent} testID="visible-depth-clipped-parent">
18-
<Pressable
19-
accessibilityRole="button"
20-
style={styles.projectedChild}
21-
testID="visible-depth-projected-child"
22-
/>
23-
</View>
11+
<Pressable
12+
accessibilityRole="button"
13+
style={styles.projectedChild}
14+
testID="visible-depth-projected-child"
15+
/>
2416
</View>
2517
);
2618
}
@@ -32,24 +24,16 @@ function createStyles(colors: AppColors) {
3224
paddingHorizontal: 18,
3325
paddingTop: 24,
3426
},
35-
clippedParent: {
36-
height: 64,
37-
left: -96,
38-
overflow: 'visible',
39-
position: 'absolute',
40-
top: 164,
41-
width: 64,
42-
},
4327
projectedChild: {
4428
alignItems: 'center',
4529
backgroundColor: colors.accent,
4630
borderRadius: 6,
47-
left: 112,
31+
left: 16,
4832
minHeight: 52,
4933
paddingHorizontal: 18,
5034
paddingVertical: 14,
5135
position: 'absolute',
52-
top: 0,
36+
top: 164,
5337
width: 220,
5438
},
5539
});

‎test/integration/ios-simulator-e2e/live-snapshot-depth-frontier.ts‎

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { acceptDeepLinkConfirmationIfPresent } from './live-automation-scenario.
55
import { type LiveContext, runStep, verifyBehavior } from './live-harness.ts';
66

77
const VISIBLE_DEPTH_DEEP_LINK = 'agent-device-test-app:///snapshot-depth';
8-
const PARENT_ID = 'visible-depth-clipped-parent';
98
const CHILD_ID = 'visible-depth-projected-child';
109

1110
type SnapshotNode = {
@@ -37,11 +36,6 @@ export async function assertRegularVisibleDepthFrontier(context: LiveContext): P
3736
const regularNodes = snapshotNodes(regular);
3837
const regularRoot = requireRoot(regularNodes, 'regular depth-1 snapshot');
3938
const projectedChild = requireIdentifier(regularNodes, CHILD_ID, 'regular depth-1 snapshot');
40-
assert.equal(
41-
regularNodes.some((node) => node.identifier === PARENT_ID),
42-
false,
43-
`clipped structural parent must be absent from regular presentation: ${JSON.stringify(regular)}`,
44-
);
4539
assert.equal(
4640
projectedChild.depth,
4741
1,
@@ -68,10 +62,6 @@ export async function assertRegularVisibleDepthFrontier(context: LiveContext): P
6862
numericDepth(rawChild) > 1,
6963
`raw projected child must remain below traversal depth 1: ${JSON.stringify(rawFull)}`,
7064
);
71-
assert.ok(
72-
hasAncestorIdentifier(rawFullNodes, rawChild, PARENT_ID),
73-
`raw projected child must descend from the clipped structural parent: ${JSON.stringify(rawFull)}`,
74-
);
7565

7666
const rawDepthOne = await runStep(context, 'capture raw depth-bounded visible-depth tree', [
7767
'snapshot',
@@ -100,7 +90,7 @@ export async function assertRegularVisibleDepthFrontier(context: LiveContext): P
10090
verifyBehavior(
10191
context,
10292
'regular-visible-depth-frontier',
103-
'public regular depth 1 keeps an independently projected child after removing its clipped structural parent while raw depth remains traversal-bounded',
93+
'public regular depth 1 keeps a raw-deep visible child at presented depth 1 while raw depth remains traversal-bounded',
10494
);
10595
}
10696

@@ -137,30 +127,6 @@ function numericDepth(node: SnapshotNode): number {
137127
return node.depth as number;
138128
}
139129

140-
function hasAncestorIdentifier(
141-
nodes: SnapshotNode[],
142-
node: SnapshotNode,
143-
identifier: string,
144-
): boolean {
145-
const nodesByIndex = new Map(
146-
nodes
147-
.filter((candidate) => typeof candidate.index === 'number')
148-
.map((candidate) => [candidate.index as number, candidate] as const),
149-
);
150-
const visited = new Set<number>();
151-
let parentIndex = node.parentIndex;
152-
153-
while (typeof parentIndex === 'number' && !visited.has(parentIndex)) {
154-
visited.add(parentIndex);
155-
const parent = nodesByIndex.get(parentIndex);
156-
if (!parent) return false;
157-
if (parent.identifier === identifier) return true;
158-
parentIndex = parent.parentIndex;
159-
}
160-
161-
return false;
162-
}
163-
164130
function assertSnapshotBackend(result: { json?: any }, description: string): void {
165131
assert.equal(
166132
result.json?.data?.snapshotQuality?.backend,

0 commit comments

Comments
 (0)