@@ -16,8 +16,8 @@ import {
1616import {
1717 bottomTabsRealCaptureFixture ,
1818 recordArticleEvidence ,
19- toSnapshotNodes ,
20- } from '@agent-device/replay-port/target-classification-fixtures ' ;
19+ buildNodes ,
20+ } from '@agent-device/test-kit ' ;
2121
2222/** Verified outcomes carry the verified member + matchCount (for the post-resolution guard). */
2323function assertVerified (
@@ -33,7 +33,7 @@ function assertVerified(
3333const PLATFORM = 'ios' as const ;
3434
3535test ( 'classifyReplayTarget: real-capture fixture verifies by @ref when the tree is unchanged' , async ( ) => {
36- const recorded = await recordArticleEvidence ( ) ;
36+ const recorded = recordArticleEvidence ( computeTargetEvidence ) ;
3737 const replayNodes = bottomTabsRealCaptureFixture ( ) ;
3838 const winner = replayNodes . find ( ( node ) => node . label === 'Article, unselected' ) ;
3939 assert . ok ( winner ) ;
@@ -50,7 +50,7 @@ test('classifyReplayTarget: real-capture fixture verifies by @ref when the tree
5050} ) ;
5151
5252test ( 'classifyReplayTarget: real-capture fixture — a relabeled node is identity-mismatch (path 3)' , async ( ) => {
53- const recorded = await recordArticleEvidence ( ) ;
53+ const recorded = recordArticleEvidence ( computeTargetEvidence ) ;
5454 const replayNodes = bottomTabsRealCaptureFixture ( ) ;
5555 const winner = replayNodes . find ( ( node ) => node . label === 'Article, unselected' ) ;
5656 assert . ok ( winner ) ;
@@ -99,7 +99,7 @@ function saveButtonRecorded(overrides: Partial<TargetAnnotationV1> = {}): Target
9999}
100100
101101function saveButtonTree ( ) : SnapshotNode [ ] {
102- return toSnapshotNodes ( [
102+ return buildNodes ( [
103103 { index : 0 , type : 'Window' , depth : 0 } ,
104104 { index : 1 , type : 'Toolbar' , label : 'Editor' , depth : 1 , parentIndex : 0 } ,
105105 {
@@ -116,7 +116,7 @@ function saveButtonTree(): SnapshotNode[] {
116116
117117test ( 'classifyReplayTarget path 2: selector-miss when the recorded target is gone' , ( ) => {
118118 const recorded = saveButtonRecorded ( ) ;
119- const nodes = toSnapshotNodes ( [
119+ const nodes = buildNodes ( [
120120 { index : 0 , type : 'Window' , depth : 0 } ,
121121 { index : 1 , type : 'Toolbar' , label : 'Editor' , depth : 1 , parentIndex : 0 } ,
122122 ] ) ;
@@ -152,7 +152,7 @@ test('classifyReplayTarget path 4: verified via @ref on an unchanged tree', () =
152152} ) ;
153153
154154test ( 'classifyReplayTarget uses the later chain alternative that resolution selected after an earlier tie' , ( ) => {
155- const nodes = toSnapshotNodes ( [
155+ const nodes = buildNodes ( [
156156 {
157157 index : 0 ,
158158 type : 'Button' ,
@@ -231,7 +231,7 @@ test('classifyReplayTarget path 5: a unique-but-wrong rebind is caught even when
231231 // Two "Go back" buttons at different depths: the label-only selector
232232 // matches both, but only one carries the recorded id. The disambiguation
233233 // heuristic (deepest-then-smallest-area) prefers the decoy.
234- const nodes = toSnapshotNodes ( [
234+ const nodes = buildNodes ( [
235235 { index : 0 , type : 'Window' , rect : { x : 0 , y : 0 , width : 400 , height : 800 } , depth : 0 } ,
236236 {
237237 index : 1 ,
@@ -279,7 +279,7 @@ test('classifyReplayTarget path 5: a unique-but-wrong rebind is caught even when
279279// ---------------------------------------------------------------------------
280280
281281function duplicateRowTree ( ) : SnapshotNode [ ] {
282- return toSnapshotNodes ( [
282+ return buildNodes ( [
283283 { index : 0 , type : 'Window' , depth : 0 } ,
284284 { index : 1 , type : 'ScrollView' , identifier : 'list' , depth : 1 , parentIndex : 0 } ,
285285 // Two anonymous section wrappers (role only, no label) — a real
@@ -439,7 +439,7 @@ test('classifyReplayTarget: document-order determinism for equal rect centers',
439439 // tie-break were nondeterministic or reversed, the winner (e3) would not
440440 // match `orderedRegion[0]` and this would report a mismatch instead of
441441 // verified.
442- const nodes = toSnapshotNodes ( [
442+ const nodes = buildNodes ( [
443443 { index : 0 , type : 'ScrollView' , identifier : 'list' , depth : 0 } ,
444444 { index : 1 , type : 'Other' , depth : 1 , parentIndex : 0 } ,
445445 { index : 2 , type : 'Other' , depth : 1 , parentIndex : 0 } ,
@@ -508,7 +508,7 @@ function androidSharedIdListFixture(
508508 parentIndex : wrapperIndex ,
509509 } ) ;
510510 } ) ;
511- return toSnapshotNodes ( raw ) ;
511+ return buildNodes ( raw ) ;
512512}
513513
514514test ( '#1269 e2e: a demoted shared-id row rebinds by role+label after the shared-id rows reorder on replay' , ( ) => {
@@ -663,7 +663,7 @@ test('#1280 e2e: a retargeted press on a row container rebinds its labeled desce
663663// ---------------------------------------------------------------------------
664664
665665test ( '#2498 e2e: a read recorded on a collapsed wrapper chain verifies on the same tree' , ( ) => {
666- const nodes = toSnapshotNodes ( UNVERIFIED_HITTABILITY_WRAPPER_CHAIN_NODES ) ;
666+ const nodes = buildNodes ( UNVERIFIED_HITTABILITY_WRAPPER_CHAIN_NODES ) ;
667667 const reports = nodes . filter ( ( node ) => node . identifier === 'scoring_home_button' ) ;
668668 const control = resolveElementReportedTwice ( nodes , reports ) ;
669669 assert . ok ( control , 'dispatch resolves the toolbar button, not the item host that reports it' ) ;
@@ -684,7 +684,7 @@ test('#2498 e2e: a read recorded on a collapsed wrapper chain verifies on the sa
684684} ) ;
685685
686686test ( '#2498 e2e: matches in distinct subtrees stay a refusal, not a collapse to one of them' , ( ) => {
687- const nodes = toSnapshotNodes ( ELEMENT14_DISTINCT_SUBTREE_NODES ) ;
687+ const nodes = buildNodes ( ELEMENT14_DISTINCT_SUBTREE_NODES ) ;
688688 const recordedWinner = nodes . find ( ( node ) => node . type === 'XCUIElementTypeButton' ) ;
689689 assert . ok ( recordedWinner ) ;
690690 const recorded = computeTargetEvidence ( { node : recordedWinner , preActionNodes : nodes } ) ;
0 commit comments