Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/tools/ios/prepare-ios-simulator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os from 'node:os';
import path from 'node:path';

import {fs, net, plist, zip} from '@appium/support';
Expand Down Expand Up @@ -115,6 +114,11 @@ async function getLatestWDAVersionFromCache(): Promise<string | null> {
return filteredVersions.length > 0 ? filteredVersions[0] : null;
}

async function getSimulatorArchitecture(simulatorUdid: string): Promise<string> {
const {stdout} = await exec('xcrun', ['simctl', 'spawn', simulatorUdid, 'uname', '-m']);
return stdout.trim();
Comment thread
KazuCocoa marked this conversation as resolved.
Outdated
}
Comment on lines +117 to +121

async function installAppOnSimulator(appPath: string, simulatorUdid: string): Promise<void> {
await exec('xcrun', ['simctl', 'install', simulatorUdid, appPath]);
}
Expand Down Expand Up @@ -202,6 +206,7 @@ async function getWDAState(simulatorUdid: string): Promise<WDAState> {
// ── Main pipeline ──

async function resolveWdaAppPath(
simulatorUdid: string,
forceRefreshWda: boolean,
platform: 'ios' | 'tvos' = 'ios',
): Promise<{
Expand All @@ -228,8 +233,7 @@ async function resolveWdaAppPath(
};
}

const arch = os.arch();
const archStr = arch === 'arm64' ? 'arm64' : 'x86_64';
const archStr = await getSimulatorArchitecture(simulatorUdid);
const artifactPrefix = platform === 'tvos' ? 'WebDriverAgentRunner_tvOS' : 'WebDriverAgentRunner';

// Check cache first (unless force refresh)
Expand Down Expand Up @@ -405,7 +409,7 @@ async function prepareSimulator(
// ── Step 2: Download WDA ──
let wdaAppPath: string;
try {
const resolved = await resolveWdaAppPath(forceRefreshWda, platform);
const resolved = await resolveWdaAppPath(udid, forceRefreshWda, platform);
wdaAppPath = resolved.wdaAppPath;
result.wdaAppPath = wdaAppPath;

Expand Down