55 openIosSimulatorApp ,
66 wasSimulatorRecentlyObservedBooted ,
77} from '../simulator.ts' ;
8- import { IOS_BOOT_TIMEOUT_MS , IOS_SIMULATOR_FOCUS_TIMEOUT_MS } from '../config.ts' ;
8+ import { IOS_BOOT_TIMEOUT_MS , IOS_SIMULATOR_SHOW_TIMEOUT_MS } from '../config.ts' ;
99import { AppError } from '@agent-device/kernel/errors' ;
1010import { runCmd } from '@agent-device/host-kit/command' ;
1111import { IOS_TEST_SIMULATOR } from './apple-core-stub-helpers.ts' ;
@@ -66,29 +66,29 @@ test('ensureBootedSimulator opens Simulator after cold boot', async () => {
6666 'xcrun simctl list devices -j' : simulatorStateSequence ( 'Shutdown' , 'Booted' ) ,
6767 'xcrun simctl boot sim-1' : OK_RESULT ,
6868 'xcrun simctl bootstatus sim-1 -b' : OK_RESULT ,
69- 'open -a Simulator' : OK_RESULT ,
69+ 'open -g - a Simulator' : OK_RESULT ,
7070 } ) ;
7171
7272 await ensureBootedSimulator ( IOS_TEST_SIMULATOR ) ;
7373
7474 assert . equal (
7575 mockRunCmd . mock . calls . some (
76- ( [ cmd , args ] ) => cmd === 'open' && args . join ( ' ' ) === '-a Simulator' ,
76+ ( [ cmd , args ] ) => cmd === 'open' && args . join ( ' ' ) === '-g - a Simulator' ,
7777 ) ,
7878 true ,
7979 ) ;
8080} ) ;
8181
8282test ( 'openIosSimulatorApp opens Simulator' , async ( ) => {
8383 mockRunCmdResponses ( {
84- 'open -a Simulator' : OK_RESULT ,
84+ 'open -g - a Simulator' : OK_RESULT ,
8585 } ) ;
8686
8787 await openIosSimulatorApp ( ) ;
8888
8989 assert . deepEqual (
9090 mockRunCmd . mock . calls . map ( ( [ cmd , args ] ) => [ cmd , args . join ( ' ' ) ] ) ,
91- [ [ 'open' , '-a Simulator' ] ] ,
91+ [ [ 'open' , '-g - a Simulator' ] ] ,
9292 ) ;
9393} ) ;
9494
@@ -108,8 +108,8 @@ test('ensureBootedSimulator leaves the Simulator app alone when already booted',
108108test ( 'openIosSimulatorApp times out instead of hanging indefinitely' , async ( ) => {
109109 mockRunCmd . mockImplementation ( async ( cmd , args , options ) => {
110110 assert . equal ( cmd , 'open' ) ;
111- assert . deepEqual ( args , [ '-a' , 'Simulator' ] ) ;
112- assert . equal ( options ?. timeoutMs , IOS_SIMULATOR_FOCUS_TIMEOUT_MS ) ;
111+ assert . deepEqual ( args , [ '-g' , '- a', 'Simulator' ] ) ;
112+ assert . equal ( options ?. timeoutMs , IOS_SIMULATOR_SHOW_TIMEOUT_MS ) ;
113113 throw new AppError ( 'COMMAND_FAILED' , 'open timed out after 10000ms' , {
114114 timeoutMs : options ?. timeoutMs ,
115115 } ) ;
@@ -174,7 +174,7 @@ test('ensureBootedSimulator retries a transient simctl boot failure and boots on
174174 return bootCalls === 1 ? failedSimctlBoot ( 'Unable to boot sim-1 right now' ) : OK_RESULT ;
175175 } ,
176176 'xcrun simctl bootstatus sim-1 -b' : OK_RESULT ,
177- 'open -a Simulator' : OK_RESULT ,
177+ 'open -g - a Simulator' : OK_RESULT ,
178178 } ) ;
179179
180180 await settleBoot ( ensureBootedSimulator ( IOS_TEST_SIMULATOR ) ) ;
@@ -184,7 +184,7 @@ test('ensureBootedSimulator retries a transient simctl boot failure and boots on
184184 assert . equal ( bootCalls , 2 ) ;
185185 assert . equal (
186186 mockRunCmd . mock . calls . some (
187- ( [ cmd , args ] ) => cmd === 'open' && args . join ( ' ' ) === '-a Simulator' ,
187+ ( [ cmd , args ] ) => cmd === 'open' && args . join ( ' ' ) === '-g - a Simulator' ,
188188 ) ,
189189 true ,
190190 ) ;
@@ -298,7 +298,7 @@ test('ensureBootedSimulator reports a simulator that never reaches Booted after
298298 assert . equal ( mockRunCmd . mock . calls . filter ( ( [ , args ] ) => args [ 1 ] === 'boot' ) . length , 3 ) ;
299299 assert . equal (
300300 mockRunCmd . mock . calls . some (
301- ( [ cmd , args ] ) => cmd === 'open' && args . join ( ' ' ) === '-a Simulator' ,
301+ ( [ cmd , args ] ) => cmd === 'open' && args . join ( ' ' ) === '-g - a Simulator' ,
302302 ) ,
303303 false ,
304304 ) ;
0 commit comments