@@ -113,49 +113,6 @@ async function waitForFileText(filePath: string, attempts = 20): Promise<string>
113113 throw lastError ;
114114}
115115
116- test ( 'shouldRetryIosSimulatorScreenshot retries the timeout reason the adapter stamps' , ( ) => {
117- // The reason the local simctl adapter stamps from the tool's protocol header; see
118- // screenshot-simctl-protocol.test.ts for the producer that mints it.
119- const error = new AppError ( 'COMMAND_FAILED' , 'xcrun exited with code 60' , {
120- stderr : 'Timeout waiting for screen surfaces' ,
121- exitCode : 60 ,
122- reason : SIMCTL_SCREENSHOT_TIMEOUT_REASON ,
123- } ) ;
124- assert . equal ( shouldRetryIosSimulatorScreenshot ( error ) , true ) ;
125- } ) ;
126-
127- test ( 'shouldRetryIosSimulatorScreenshot retries a command host-kit killed at its deadline' , ( ) => {
128- const error = new AppError ( 'COMMAND_FAILED' , 'xcrun timed out after 20000ms' , {
129- args : [ 'simctl' , 'io' , 'sim-1' , 'screenshot' , '/tmp/out.png' ] ,
130- timeoutMs : 20_000 ,
131- } ) ;
132- assert . equal ( shouldRetryIosSimulatorScreenshot ( error ) , true ) ;
133- } ) ;
134-
135- test ( 'shouldRetryIosSimulatorScreenshot ignores unrelated screenshot failures' , ( ) => {
136- const error = new AppError ( 'COMMAND_FAILED' , 'Failed to capture iOS screenshot' , {
137- stderr : 'No such file or directory' ,
138- exitCode : 2 ,
139- } ) ;
140- assert . equal ( shouldRetryIosSimulatorScreenshot ( error ) , false ) ;
141- } ) ;
142-
143- test ( 'the same screenshot timeout wording without the typed reason is not retryable' , ( ) => {
144- // Identical wording and argv to the two positives above, minus the typed evidence: the retry
145- // decision must not be reachable from the tool's prose or from this module's own argv.
146- const worded = new AppError ( 'COMMAND_FAILED' , 'Detected file type from extension: PNG' , {
147- stderr : 'Timeout waiting for screen surfaces' ,
148- exitCode : 60 ,
149- } ) ;
150- const wordedAndSpelled = new AppError ( 'COMMAND_FAILED' , 'xcrun timed out after 20000ms' , {
151- args : [ 'simctl' , 'io' , 'sim-1' , 'screenshot' , '/tmp/out.png' ] ,
152- stderr : 'Timeout waiting for screen surfaces' ,
153- exitCode : 60 ,
154- } ) ;
155- assert . equal ( shouldRetryIosSimulatorScreenshot ( worded ) , false ) ;
156- assert . equal ( shouldRetryIosSimulatorScreenshot ( wordedAndSpelled ) , false ) ;
157- } ) ;
158-
159116test ( 'captureSimulatorScreenshotWithFallback falls back to runner after retry exhaustion' , async ( ) => {
160117 const tmpDir = await mkdtempForTest ( 'agent-device-ios-runner-fallback-' ) ;
161118 let ensureBootedCalls = 0 ;
0 commit comments