11import assert from 'node:assert/strict' ;
22import { beforeEach , test } from 'vitest' ;
3+ import { readAndroidCaptureFailureReason } from '@agent-device/contracts/android-snapshot-quality' ;
34import { AppError } from '@agent-device/kernel/errors' ;
45import { captureAndroidSnapshotWithHelper } from '../snapshot-helper-capture.ts' ;
56import { resetAndroidSnapshotHelperRetirements } from '../snapshot-helper-retirement.ts' ;
@@ -140,8 +141,8 @@ test('a helper failure reported under a zero am exit status keeps its own reason
140141 exitCode : 0 ,
141142 stdout : [
142143 'INSTRUMENTATION_RESULT: agentDeviceProtocol=android-snapshot-helper-v1' ,
143- 'INSTRUMENTATION_RESULT: errorType=com.callstack.agentdevice.snapshothelper.AccessibilityCaptureStabilizer$IncompleteCaptureException ' ,
144- 'INSTRUMENTATION_RESULT: message=Android accessibility capture remained incomplete after 500 ms ' ,
144+ 'INSTRUMENTATION_RESULT: errorType=java.util.concurrent.TimeoutException ' ,
145+ 'INSTRUMENTATION_RESULT: message=Timed out waiting for the accessibility hierarchy ' ,
145146 'INSTRUMENTATION_RESULT: ok=false' ,
146147 'INSTRUMENTATION_CODE: 1' ,
147148 ] . join ( '\n' ) ,
@@ -153,8 +154,8 @@ test('a helper failure reported under a zero am exit status keeps its own reason
153154 captureAndroidSnapshotWithHelper ( { adb, deviceKey : 'android:emulator-5554' } ) ,
154155 ( error : unknown ) =>
155156 error instanceof AppError &&
156- error . message === 'Android accessibility capture remained incomplete after 500 ms ' &&
157- typeof error . details ?. helper === 'object ' ,
157+ readAndroidCaptureFailureReason ( error ) === 'accessibility-timeout ' &&
158+ error . details ?. errorType === 'java.util.concurrent.TimeoutException ' ,
158159 ) ;
159160} ) ;
160161
0 commit comments