77 MACOS_DEVICE ,
88} from '../../../__tests__/test-utils/index.ts' ;
99
10- const dispatchCommand = vi . hoisted ( ( ) => vi . fn ( ) ) ;
11- vi . mock ( '../../../core/dispatch. ts' , ( ) => ( { dispatchCommand } ) ) ;
10+ const captureSnapshotWithInteractor = vi . hoisted ( ( ) => vi . fn ( ) ) ;
11+ vi . mock ( '../snapshot-interactor-capture. ts' , ( ) => ( { captureSnapshotWithInteractor } ) ) ;
1212
1313test ( 'buildSnapshotState handles undefined nodes gracefully' , ( ) => {
1414 const state = buildSnapshotState ( { nodes : undefined , truncated : undefined } , undefined ) ;
@@ -105,8 +105,8 @@ test('buildSnapshotState applies iOS interactive presentation for xctest snapsho
105105} ) ;
106106
107107test ( 'iOS interactive capture does not send local presentation scope to XCTest' , async ( ) => {
108- dispatchCommand . mockClear ( ) ;
109- dispatchCommand . mockResolvedValueOnce ( { nodes : [ ] , backend : 'xctest' } ) ;
108+ captureSnapshotWithInteractor . mockClear ( ) ;
109+ captureSnapshotWithInteractor . mockResolvedValueOnce ( { nodes : [ ] , backend : 'xctest' } ) ;
110110
111111 await captureSnapshotData ( {
112112 device : IOS_SIMULATOR ,
@@ -116,14 +116,16 @@ test('iOS interactive capture does not send local presentation scope to XCTest',
116116 logPath : '/tmp/snapshot-capture-test.log' ,
117117 } ) ;
118118
119- expect ( dispatchCommand ) . toHaveBeenCalledOnce ( ) ;
120- expect ( dispatchCommand . mock . calls [ 0 ] ?. [ 4 ] ) . toEqual (
121- expect . objectContaining ( { snapshotInteractiveOnly : true , snapshotScope : undefined } ) ,
119+ expect ( captureSnapshotWithInteractor ) . toHaveBeenCalledOnce ( ) ;
120+ expect ( captureSnapshotWithInteractor ) . toHaveBeenCalledWith (
121+ expect . objectContaining ( {
122+ options : expect . objectContaining ( { interactiveOnly : true , scope : undefined } ) ,
123+ } ) ,
122124 ) ;
123125} ) ;
124126
125127test ( 'snapshot capture preserves backend scope outside iOS interactive presentation' , async ( ) => {
126- dispatchCommand . mockClear ( ) ;
128+ captureSnapshotWithInteractor . mockClear ( ) ;
127129 for ( const [ device , flags ] of [
128130 [ ANDROID_EMULATOR , { snapshotInteractiveOnly : true , snapshotScope : 'action file' } ] ,
129131 [
@@ -132,7 +134,7 @@ test('snapshot capture preserves backend scope outside iOS interactive presentat
132134 ] ,
133135 [ MACOS_DEVICE , { snapshotInteractiveOnly : true , snapshotScope : 'action file' } ] ,
134136 ] as const ) {
135- dispatchCommand . mockResolvedValueOnce ( { nodes : [ ] } ) ;
137+ captureSnapshotWithInteractor . mockResolvedValueOnce ( { nodes : [ ] } ) ;
136138 await captureSnapshotData ( {
137139 device,
138140 session : undefined ,
@@ -142,7 +144,7 @@ test('snapshot capture preserves backend scope outside iOS interactive presentat
142144 } ) ;
143145 }
144146
145- expect ( dispatchCommand . mock . calls . map ( ( call ) => call [ 4 ] ?. snapshotScope ) ) . toEqual ( [
147+ expect ( captureSnapshotWithInteractor . mock . calls . map ( ( call ) => call [ 0 ] ?. options . scope ) ) . toEqual ( [
146148 'action file' ,
147149 'action file' ,
148150 'action file' ,
0 commit comments