Skip to content

Commit ddfbf7f

Browse files
Test 43 of CI
1 parent 66f8895 commit ddfbf7f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

specs/utils/ios-simulator.mjs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ export async function create(
4343
// const { stdout } = await execAsync(`xcrun simctl create "${name}" "${deviceType}" "${runtime}"`);
4444

4545
// const udid = stdout.trim();
46+
const udid = await getBootedSimulatorUUID();
4647

47-
console.log(`✅ Simulator created (uuid: '${/**udid */ ""}')`);
48+
console.log(`✅ Simulator created (uuid: '${udid}')`);
4849

4950
return {
5051
name,
51-
udid: undefined,
52+
udid,
5253
deviceType,
5354
};
5455
}
@@ -64,6 +65,22 @@ export async function boot(simulator) {
6465
console.log("✅ Simulator booted.");
6566
}
6667

68+
/**
69+
* Gets the UUID of the currently booted simulator, if any.
70+
* @returns {Promise<string|null>} The UUID of the booted simulator, or null if none is booted.
71+
*/
72+
export async function getBootedSimulatorUUID() {
73+
try {
74+
const { stdout } = await execAsync(
75+
'xcrun simctl list devices | grep "(Booted)" | grep -o "[A-F0-9-]\\{36\\}"',
76+
);
77+
const uuid = stdout.trim();
78+
return uuid || null;
79+
} catch {
80+
return null;
81+
}
82+
}
83+
6784
/**
6885
* Installs an application on a simulator.
6986
* @param {Simulator} simulator The simulator object.

0 commit comments

Comments
 (0)