mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Use macOS 26 runners for iOS E2E tests (#57993)
Summary: Moves the RNTester and template app iOS E2E jobs from `macos-15-large` to `macos-26-large`. The new runner image ships with Xcode 26, which is now required by `idb-companion`, and the jobs use the image default Xcode so its hosted simulator platform is available. The Maestro runner discovers an available iPhone Pro simulator and boots it by UDID instead of depending on a device name tied to an older runner image. ### CI follow-ups - `test_e2e_ios_templateapp / test (Debug)` failed before the E2E tests because the explicitly selected Xcode 26.0.1 installation did not include the iOS Simulator platform. Removed the explicit Xcode selection from both E2E workflows so `macos-26-large` uses its default Xcode 26.6 installation and hosted simulator setup. - The RNTester E2E attempts then installed `idb-companion` successfully but failed to boot the hardcoded `iPhone 16 Pro`, which is not present on the macOS 26 image. Updated the Maestro iOS runner to discover an available iPhone Pro from the newest installed runtime and boot it by UDID, with a unit test covering selection across runtimes. ## Changelog: [INTERNAL] [FIXED] - Run iOS E2E tests on macOS 26 runners with Xcode 26. Pull Request resolved: https://github.com/react/react-native/pull/57993 Test Plan: - `git diff --check` - `yarn prettier --check .github/workflow-scripts/maestro-ios.js .github/workflow-scripts/__tests__/maestro-ios-test.js .github/workflows/e2e-ios-rntester.yml .github/workflows/e2e-ios-templateapp.yml` - `ruby -ryaml -e "ARGV.each { |path| YAML.parse_file(path) }" .github/workflows/e2e-ios-rntester.yml .github/workflows/e2e-ios-templateapp.yml` - `node --check .github/workflow-scripts/maestro-ios.js` - `yarn jest .github/workflow-scripts/__tests__/maestro-ios-test.js --runInBand --config '{"testEnvironment":"node","transform":{}}'` Reviewed By: alanleedev, mdvacca Differential Revision: D116460922 Pulled By: cipolleschi fbshipit-source-id: e769f017b874c9da76d63f19727c358719dbdbc6
This commit is contained in:
1 parent
526016d950
commit
2dd6d4b482
4 files changed
+46
-23
No files matched your search
@@ -20,7 +20,7 @@ jest.mock('fs', () => ({
|
||||
const childProcess = require('child_process');
|
||||
const fs = require('fs');
|
||||
|
||||
const {executeFlows} = require('../maestro-ios');
|
||||
const {executeFlows, findAvailableSimulator} = require('../maestro-ios');
|
||||
|
||||
describe('Maestro iOS runner', () => {
|
||||
beforeEach(() => {
|
||||
@@ -59,4 +59,23 @@ describe('Maestro iOS runner', () => {
|
||||
expect(call[0]).toContain('test "flow.yml"');
|
||||
}
|
||||
});
|
||||
|
||||
it('selects an iPhone Pro simulator from the latest runtime', () => {
|
||||
childProcess.execSync.mockReturnValue(
|
||||
JSON.stringify({
|
||||
devices: {
|
||||
'iOS 18.5': [{name: 'iPhone 16 Pro', udid: 'old-pro'}],
|
||||
'iOS 26.5': [
|
||||
{name: 'iPhone 17 Pro Max', udid: 'new-pro-max'},
|
||||
{name: 'iPhone 17 Pro', udid: 'new-pro'},
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(findAvailableSimulator()).toEqual({
|
||||
name: 'iPhone 17 Pro',
|
||||
udid: 'new-pro',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -25,10 +25,26 @@ node maestro-android.js <path to app> <app_id> <maestro_flow> <flavor> <working_
|
||||
|
||||
const MAX_ATTEMPTS = 5;
|
||||
|
||||
function launchSimulator(simulatorName) {
|
||||
console.log(`Launching simulator ${simulatorName}`);
|
||||
function findAvailableSimulator() {
|
||||
const output = childProcess.execSync(
|
||||
'xcrun simctl list devices available -j',
|
||||
);
|
||||
const devices = Object.values(JSON.parse(String(output)).devices)
|
||||
.flat()
|
||||
.reverse();
|
||||
const simulator = devices.find(device => /^iPhone .* Pro$/.test(device.name));
|
||||
|
||||
if (simulator == null) {
|
||||
throw new Error('Unable to find an available iPhone Pro simulator');
|
||||
}
|
||||
|
||||
return simulator;
|
||||
}
|
||||
|
||||
function launchSimulator(simulator) {
|
||||
console.log(`Launching simulator ${simulator.name} (${simulator.udid})`);
|
||||
try {
|
||||
childProcess.execSync(`xcrun simctl boot "${simulatorName}"`);
|
||||
childProcess.execSync(`xcrun simctl boot "${simulator.udid}"`);
|
||||
} catch (error) {
|
||||
if (
|
||||
!error.message.includes('Unable to boot device in current state: Booted')
|
||||
@@ -43,14 +59,6 @@ function installAppOnSimulator(appPath) {
|
||||
childProcess.execSync(`xcrun simctl install booted "${appPath}"`);
|
||||
}
|
||||
|
||||
function extractSimulatorUDID() {
|
||||
console.log('Retrieving device UDID');
|
||||
const command = `xcrun simctl list devices booted -j | jq -r '[.devices[]] | add | first | .udid'`;
|
||||
const udid = String(childProcess.execSync(command)).trim();
|
||||
console.log(`UDID is ${udid}`);
|
||||
return udid;
|
||||
}
|
||||
|
||||
function bringSimulatorInForeground() {
|
||||
console.log('Bringing simulator in foreground');
|
||||
childProcess.execSync('open -a simulator');
|
||||
@@ -166,13 +174,12 @@ async function main(args = process.argv.slice(2)) {
|
||||
console.info(`WORKING_DIRECTORY: ${workingDirectory}`);
|
||||
console.info('==============================\n');
|
||||
|
||||
const simulatorName = 'iPhone 16 Pro';
|
||||
launchSimulator(simulatorName);
|
||||
const simulator = findAvailableSimulator();
|
||||
launchSimulator(simulator);
|
||||
installAppOnSimulator(appPath);
|
||||
const udid = extractSimulatorUDID();
|
||||
bringSimulatorInForeground();
|
||||
await launchAppOnSimulator(appId, udid, isDebug);
|
||||
executeFlows(appId, udid, maestroFlow, jsengine);
|
||||
await launchAppOnSimulator(appId, simulator.udid, isDebug);
|
||||
executeFlows(appId, simulator.udid, maestroFlow, jsengine);
|
||||
console.log('Test finished');
|
||||
}
|
||||
|
||||
@@ -182,4 +189,5 @@ if (require.main === module) {
|
||||
|
||||
module.exports = {
|
||||
executeFlows,
|
||||
findAvailableSimulator,
|
||||
};
|
||||
Reference in new issue
Block a user