( deviceId: string, appPath: string, executor: CommandExecutor, )
| 16 | * Install an app on a physical device. |
| 17 | */ |
| 18 | export async function installAppOnDevice( |
| 19 | deviceId: string, |
| 20 | appPath: string, |
| 21 | executor: CommandExecutor, |
| 22 | ): Promise<StepResult> { |
| 23 | log('info', `Installing app on device ${deviceId}`); |
| 24 | const result = await executor( |
| 25 | ['xcrun', 'devicectl', 'device', 'install', 'app', '--device', deviceId, appPath], |
| 26 | 'Install app on device', |
| 27 | false, |
| 28 | ); |
| 29 | if (!result.success) { |
| 30 | return { success: false, error: result.error ?? 'Failed to install app' }; |
| 31 | } |
| 32 | return { success: true }; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Launch an app on a physical device and return the process ID if available. |
no test coverage detected