Skip to content

Commit 0cee693

Browse files
committed
test(apple): identify trait provenance and producer-specific facts
1 parent 3b8a3bc commit 0cee693

5 files changed

Lines changed: 111 additions & 29 deletions

File tree

‎contracts/fixtures/ios-trait-classification.json‎

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "Independent trait cases at producer seams. Bridge words and Limrun trait names are producer-specific inputs, not a raw encoding equivalence. Limrun keeps reported types, uses IsEditing for a focus witness, and recognizes TabButton during collapsed-bar recovery. XCTest takes XCUIElement types and is not applicable to trait classification; live conformance remains its authority. Absent expected keys mean absent facts.",
2+
"description": "Independent trait cases at producer seams. Bridge words and Limrun trait names are producer-specific inputs, not a raw encoding equivalence. Limrun keeps reported types, uses IsEditing for a focus witness, and recognizes TabButton during collapsed-bar recovery. XCTest takes XCUIElement types and is not applicable to trait classification; live conformance remains its authority. Absent expected keys mean absent facts. Basis describes each producer input: captured bridge words are recorded in the existing tree tests; rule inputs are synthetic. Expected fields pin producer rules, including unobserved precedence branches. Limrun inputs are synthetic seam cases. Captured words do not establish live XCTest parity.",
33
"cases": [
44
{
55
"name": "tab trait overrides cell type",
@@ -9,6 +9,7 @@
99
"runner": "not-applicable"
1010
},
1111
"bridge": {
12+
"basis": "captured",
1213
"input": {
1314
"automationType": 75,
1415
"traits": "146297323520"
@@ -18,6 +19,8 @@
1819
}
1920
},
2021
"limrun": {
22+
"basis": "rule",
23+
"fact": "TabButton makes a collapsed-bar tab candidate",
2124
"input": {
2225
"type": "RadioButton",
2326
"traits": ["Button", "TabButton"]
@@ -36,6 +39,7 @@
3639
"runner": "not-applicable"
3740
},
3841
"bridge": {
42+
"basis": "rule",
3943
"input": {
4044
"automationType": 75,
4145
"traits": "146028888064"
@@ -45,6 +49,8 @@
4549
}
4650
},
4751
"limrun": {
52+
"basis": "rule",
53+
"fact": "Button without TabButton is not a collapsed-bar tab candidate",
4854
"input": {
4955
"type": "RadioButton",
5056
"traits": ["Button"]
@@ -63,6 +69,7 @@
6369
"runner": "not-applicable"
6470
},
6571
"bridge": {
72+
"basis": "captured",
6673
"input": {
6774
"automationType": 0,
6875
"traits": "140746078552064"
@@ -82,6 +89,7 @@
8289
"runner": "not-applicable"
8390
},
8491
"bridge": {
92+
"basis": "rule",
8593
"input": {
8694
"automationType": 0,
8795
"traits": "8590196736"
@@ -101,6 +109,7 @@
101109
"runner": "not-applicable"
102110
},
103111
"bridge": {
112+
"basis": "rule",
104113
"input": {
105114
"automationType": 0,
106115
"traits": "140746095330304"
@@ -120,6 +129,7 @@
120129
"runner": "not-applicable"
121130
},
122131
"bridge": {
132+
"basis": "rule",
123133
"input": {
124134
"automationType": 0,
125135
"traits": "140746078553088"
@@ -139,6 +149,7 @@
139149
"runner": "not-applicable"
140150
},
141151
"bridge": {
152+
"basis": "rule",
142153
"input": {
143154
"automationType": 0,
144155
"traits": "140746078289920"
@@ -148,6 +159,42 @@
148159
}
149160
}
150161
},
162+
{
163+
"name": "search bit without text entry",
164+
"applicability": {
165+
"bridge": "applicable",
166+
"limrun": "not-applicable",
167+
"runner": "not-applicable"
168+
},
169+
"bridge": {
170+
"basis": "rule",
171+
"input": {
172+
"automationType": 0,
173+
"traits": "1024"
174+
},
175+
"expected": {
176+
"type": "Other"
177+
}
178+
}
179+
},
180+
{
181+
"name": "secure bit without text entry",
182+
"applicability": {
183+
"bridge": "applicable",
184+
"limrun": "not-applicable",
185+
"runner": "not-applicable"
186+
},
187+
"bridge": {
188+
"basis": "rule",
189+
"input": {
190+
"automationType": 0,
191+
"traits": "16777216"
192+
},
193+
"expected": {
194+
"type": "Other"
195+
}
196+
}
197+
},
151198
{
152199
"name": "declared input type takes precedence",
153200
"applicability": {
@@ -156,6 +203,7 @@
156203
"runner": "not-applicable"
157204
},
158205
"bridge": {
206+
"basis": "rule",
159207
"input": {
160208
"automationType": 45,
161209
"traits": "140746078552064"
@@ -175,6 +223,7 @@
175223
"runner": "not-applicable"
176224
},
177225
"bridge": {
226+
"basis": "rule",
178227
"input": {
179228
"automationType": 0,
180229
"traits": "8"
@@ -185,6 +234,8 @@
185234
}
186235
},
187236
"limrun": {
237+
"basis": "rule",
238+
"fact": "Selected reports selection",
188239
"input": {
189240
"type": "Other",
190241
"traits": ["Selected"]
@@ -203,6 +254,7 @@
203254
"runner": "not-applicable"
204255
},
205256
"bridge": {
257+
"basis": "rule",
206258
"input": {
207259
"automationType": 0,
208260
"traits": "0"
@@ -212,6 +264,8 @@
212264
}
213265
},
214266
"limrun": {
267+
"basis": "rule",
268+
"fact": "without Selected the selection fact is absent",
215269
"input": {
216270
"type": "Other",
217271
"traits": ["Button"]
@@ -228,6 +282,7 @@
228282
"runner": "not-applicable"
229283
},
230284
"bridge": {
285+
"basis": "captured",
231286
"input": {
232287
"automationType": 52,
233288
"traits": "140883519602688"
@@ -240,6 +295,8 @@
240295
}
241296
},
242297
"limrun": {
298+
"basis": "rule",
299+
"fact": "IsEditing provides a focus witness",
243300
"input": {
244301
"type": "TextView",
245302
"traits": ["IsEditing"]
@@ -258,6 +315,7 @@
258315
"runner": "not-applicable"
259316
},
260317
"bridge": {
318+
"basis": "captured",
261319
"input": {
262320
"automationType": 52,
263321
"traits": "140883517505536"
@@ -269,6 +327,8 @@
269327
}
270328
},
271329
"limrun": {
330+
"basis": "rule",
331+
"fact": "without IsEditing no focus witness is reported",
272332
"input": {
273333
"type": "TextView",
274334
"traits": ["TextEntry"]

‎packages/platform-apple/src/snapshot-source/tree.test.ts‎

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -772,32 +772,44 @@ test('the element-type names the presented-surface rule reads are the ones this
772772
}
773773
});
774774

775-
test('trait classification golden rows name their producer applicability and bridge facts', () => {
776-
const fixture = JSON.parse(
777-
fs.readFileSync(
778-
new URL('../../../../contracts/fixtures/ios-trait-classification.json', import.meta.url),
779-
'utf8',
780-
),
781-
) as {
782-
cases: Array<{
783-
name: string;
784-
applicability: { bridge: string; limrun: string; runner: string };
785-
bridge: {
786-
input: { automationType: number; traits: string };
787-
expected: Record<string, string | boolean>;
788-
};
789-
limrun?: { seam: string };
790-
}>;
791-
};
792-
assert.ok(fixture.cases.length > 0);
775+
const traitClassification = JSON.parse(
776+
fs.readFileSync(
777+
new URL('../../../../contracts/fixtures/ios-trait-classification.json', import.meta.url),
778+
'utf8',
779+
),
780+
) as {
781+
cases: Array<{
782+
name: string;
783+
applicability: { bridge: string; limrun: string; runner: string };
784+
bridge: {
785+
basis: 'captured' | 'rule';
786+
input: { automationType: number; traits: string };
787+
expected: Record<string, string | boolean>;
788+
};
789+
limrun?: { basis: string; fact: string; seam: string };
790+
}>;
791+
};
792+
793+
test('trait corpus declares producer input provenance and applicability', () => {
794+
assert.ok(traitClassification.cases.length > 0);
793795
assert.deepEqual(
794-
new Set(fixture.cases.flatMap((row) => (row.limrun ? [row.limrun.seam] : []))),
796+
new Set(traitClassification.cases.flatMap((row) => (row.limrun ? [row.limrun.seam] : []))),
795797
new Set(['tab', 'selection', 'focus']),
796798
);
797-
for (const row of fixture.cases) {
799+
for (const row of traitClassification.cases) {
798800
assert.equal(row.applicability.bridge, 'applicable', row.name);
799801
assert.equal(row.applicability.runner, 'not-applicable', row.name);
800802
assert.equal(row.applicability.limrun, row.limrun ? 'applicable' : 'not-applicable', row.name);
803+
assert.ok(['captured', 'rule'].includes(row.bridge.basis), row.name);
804+
if (row.limrun) {
805+
assert.equal(row.limrun.basis, 'rule', row.name);
806+
assert.ok(row.limrun.fact.length > 0, row.name);
807+
}
808+
}
809+
});
810+
811+
for (const row of traitClassification.cases) {
812+
test(`bridge trait ${row.bridge.basis} input: ${row.name}`, () => {
801813
const node = decodeSnapshotBridgeTree(
802814
{
803815
[automationType]: row.bridge.input.automationType,
@@ -813,5 +825,5 @@ test('trait classification golden rows name their producer applicability and bri
813825
),
814826
);
815827
assert.deepEqual(actual, row.bridge.expected, row.name);
816-
}
817-
});
828+
});
829+
}

‎packages/provider-limrun/src/ios-collapsed-tab-bar.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,16 @@ const traitClassification = JSON.parse(
315315
) as {
316316
cases: Array<{
317317
name: string;
318-
limrun?: { seam: string; input: IosTreeNode; expected: { tabCandidate: boolean } };
318+
limrun?: {
319+
fact: string;
320+
seam: string;
321+
input: IosTreeNode;
322+
expected: { tabCandidate: boolean };
323+
};
319324
}>;
320325
};
321326
for (const row of traitClassification.cases.filter((entry) => entry.limrun?.seam === 'tab')) {
322-
test(`Limrun trait tab golden: ${row.name}`, async () => {
327+
test(`Limrun trait tab golden: ${row.limrun!.fact}`, async () => {
323328
const frame = { x: 25, y: 795, width: 74, height: 54 };
324329
const { session } = dockedSession({ x: 0, y: 791, width: 402, height: 83 }, () => [
325330
{ ...row.limrun!.input, label: 'Left', frame },

‎packages/provider-limrun/src/ios-snapshot-adapter.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,11 @@ const traitClassification = JSON.parse(
221221
) as {
222222
cases: Array<{
223223
name: string;
224-
limrun?: { seam: string; input: IosTreeNode; expected: { selected?: boolean } };
224+
limrun?: { fact: string; seam: string; input: IosTreeNode; expected: { selected?: boolean } };
225225
}>;
226226
};
227227
for (const row of traitClassification.cases.filter((entry) => entry.limrun?.seam === 'selection')) {
228-
test(`Limrun trait selection golden: ${row.name}`, async () => {
228+
test(`Limrun trait selection golden: ${row.limrun!.fact}`, async () => {
229229
const result = await captureLimrunIosSnapshot(createLimrunSnapshotSession(row.limrun!.input));
230230
expect(result.acquisition.nodes[0]?.selected).toBe(row.limrun!.expected.selected);
231231
});

‎packages/provider-limrun/src/text-entry-focus.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,16 @@ const traitClassification = JSON.parse(
248248
) as {
249249
cases: Array<{
250250
name: string;
251-
limrun?: { seam: string; input: IosTreeNode; expected: { focusWitness: boolean } };
251+
limrun?: {
252+
fact: string;
253+
seam: string;
254+
input: IosTreeNode;
255+
expected: { focusWitness: boolean };
256+
};
252257
}>;
253258
};
254259
for (const row of traitClassification.cases.filter((entry) => entry.limrun?.seam === 'focus')) {
255-
test(`Limrun trait focus golden: ${row.name}`, () => {
260+
test(`Limrun trait focus golden: ${row.limrun!.fact}`, () => {
256261
const input = { ...row.limrun!.input, frame: FIELD_RECT };
257262
expect(readLimrunTextEntryFocus(input) !== null).toBe(row.limrun!.expected.focusWitness);
258263
});

0 commit comments

Comments
 (0)