@@ -6,29 +6,30 @@ import {
66 resetGetRuntimeFixture ,
77} from './interaction-get-runtime-fixture.ts' ;
88import fs from 'node:fs' ;
9- import path from 'node:path' ;
109import { handleSnapshotCommands as handleProductionSnapshotCommands } from '../snapshot.ts' ;
1110import { captureSnapshot } from '../snapshot-capture.ts' ;
1211import { SessionStore } from '../../session-store.ts' ;
1312import { setActiveProviderDeviceRuntimes } from '../../../provider-device-runtime.ts' ;
14- import type { ProviderDeviceRuntime } from '@agent-device/contracts/device' ;
1513import type { DaemonResponse , SessionState } from '../../types.ts' ;
1614import { AppError } from '@agent-device/kernel/errors' ;
1715import { platformResourceCleanup } from '../../../platform-runtime-resource-cleanup.ts' ;
1816import { buildSnapshotSignatures } from '../../../snapshot/snapshot-freshness/index.ts' ;
1917import { buildInteractionSurfaceSignature } from '../../interaction-outcome-policy.ts' ;
2018import { buildSnapshotPresentationKey } from '@agent-device/kernel/snapshot' ;
21- import { attachSnapshotPresentationEvidence } from '@agent-device/contracts/capture' ;
2219import { snapshotCliOutput } from '../../../commands/capture/output.ts' ;
2320import type { CaptureSnapshotResult } from '@agent-device/contracts/client' ;
24- import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts' ;
2521import {
2622 fixtureScreenshotCaptures ,
2723 fixtureSettingsMutations ,
2824 resetSnapshotRuntimeFixture ,
2925 snapshotRuntimeFixture ,
3026} from '../../__tests__/snapshot-runtime-fixture.ts' ;
3127import type { BindDeviceRuntime } from '../../request-runtime-binding.ts' ;
28+ import {
29+ makeProviderRuntimeOwning ,
30+ makeSession ,
31+ makeSessionStore ,
32+ } from './snapshot-handler-fixture.ts' ;
3233
3334vi . mock ( '../snapshot-interactor-capture.ts' , async ( ) => {
3435 const fixture = await import ( '../../__tests__/legacy-snapshot-capture-fixture.ts' ) ;
@@ -75,15 +76,6 @@ function handleSnapshotCommands(
7576 } ) ;
7677}
7778
78- function makeSessionStore ( ) : SessionStore {
79- const root = mkdtempForTestSync ( 'agent-device-snapshot-handler-' ) ;
80- return new SessionStore ( path . join ( root , 'sessions' ) ) ;
81- }
82-
83- type SessionExtra = Partial < SessionState > ;
84- function makeSession ( name : string , d : SessionState [ 'device' ] , extra ?: SessionExtra ) : SessionState {
85- return { name, device : d , createdAt : Date . now ( ) , actions : [ ] , ...extra } ;
86- }
8779// An Apple wait runs inside an opened app: that bundle id is XCUITest's attach target, and
8880// without one the plan asks for the without-active-app row local Apple refuses.
8981const appAttach = ( d : SessionState [ 'device' ] ) : Partial < SessionState > =>
@@ -125,20 +117,6 @@ const providerIosDevice: SessionState['device'] = {
125117 booted : true ,
126118} ;
127119
128- function makeProviderRuntimeOwning (
129- device : SessionState [ 'device' ] ,
130- provider = 'browserstack' ,
131- ) : ProviderDeviceRuntime {
132- return {
133- provider,
134- leaseLifecycle : { } ,
135- deviceInventoryProvider : async ( ) => [ device ] ,
136- ownsDevice : ( candidate ) => candidate . id === device . id ,
137- getInteractor : ( ) => undefined ,
138- shutdown : async ( ) => undefined ,
139- } ;
140- }
141-
142120afterEach ( ( ) => {
143121 setActiveProviderDeviceRuntimes ( [ ] ) ;
144122} ) ;
@@ -488,55 +466,6 @@ test('snapshot on provider-backed iOS runs without a tracked app', async () => {
488466 expect ( bindCount ) . toBe ( 1 ) ;
489467} ) ;
490468
491- test ( 'Limrun unknown truncation stays omitted through daemon and public output' , async ( ) => {
492- const sessionStore = makeSessionStore ( ) ;
493- const sessionName = 'limrun-ios-unknown-truncation' ;
494- const limrunDevice : SessionState [ 'device' ] = {
495- platform : 'apple' ,
496- appleOs : 'ios' ,
497- id : 'limrun:ios:lease-a' ,
498- name : 'Limrun iOS' ,
499- kind : 'simulator' ,
500- target : 'mobile' ,
501- booted : true ,
502- } ;
503- sessionStore . set ( sessionName , makeSession ( sessionName , limrunDevice ) ) ;
504- setActiveProviderDeviceRuntimes ( [ makeProviderRuntimeOwning ( limrunDevice , 'limrun' ) ] ) ;
505- legacyDispatchCapture . mockResolvedValue (
506- attachSnapshotPresentationEvidence (
507- {
508- nodes : [ { index : 0 , depth : 0 , type : 'Application' , label : 'Demo' } ] ,
509- backend : 'xctest' ,
510- producer : 'limrun-ios-tree' ,
511- warnings : [ 'tree completeness is not independently verified' ] ,
512- } ,
513- { owner : 'ios-snapshot-engine' } ,
514- ) ,
515- ) ;
516-
517- const response = await handleSnapshotCommands ( {
518- req : {
519- token : 't' ,
520- session : sessionName ,
521- command : 'snapshot' ,
522- positionals : [ ] ,
523- flags : { } ,
524- } ,
525- sessionName,
526- logPath : '/tmp/daemon.log' ,
527- sessionStore,
528- } ) ;
529-
530- expect ( response ?. ok ) . toBe ( true ) ;
531- if ( ! response ?. ok ) return ;
532- expect ( response . data ) . not . toHaveProperty ( 'truncated' ) ;
533-
534- const cliOutput = await snapshotCliOutput ( {
535- result : response . data as unknown as CaptureSnapshotResult ,
536- } ) ;
537- expect ( cliOutput . jsonData ) . not . toHaveProperty ( 'truncated' ) ;
538- } ) ;
539-
540469test ( 'diff on local iOS still requires a tracked app' , async ( ) => {
541470 const sessionStore = makeSessionStore ( ) ;
542471 const sessionName = 'ios-sim-no-app-diff' ;
0 commit comments