Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions docs/integration/ci-appium.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The CI scripts are under `scripts/ci/` and the WebDriverIO specs under `e2e/` in
- Set `simulatorStartupTimeout` to 300 seconds or more, and set the WebDriverAgent and session timeouts above the three to five minutes a cold WebDriverAgent build takes.
- Run `xcrun simctl list` once before the run.
- After `/status` is ready, prefetch the Metro bundle. Prebuild WebDriverAgent once under `artifacts/e2e/wda-derived-data` and pass it to the driver with `usePrebuiltWDA` and `derivedDataPath`. Do not put `DerivedData` in `e2e/node_modules`.
- WDA prebuild sets the simulator deployment target to 15.1 so vendored WebDriverAgent builds on current Xcode simulator SDKs (Xcode 26 and 27).
- Do not use `usePreinstalledWDA` on a simulator. It launches the `.xctrunner` app with plain `simctl`, which exits at `domain:dyld(6) code:1` because `simctl` never injects the XCTest frameworks. Appium then polls `127.0.0.1:8100/status` until `wdaLaunchTimeout`. A readiness watchdog, `IOS_WDA_READY_DEADLINE` with a default of 180 seconds, aborts the attempt when the port is dead.
- Use two or three serialized outer WebDriverIO attempts with `connectionRetryCount: 0`. Between attempts, delete sessions, terminate and reinstall the app, stop Appium, clear the Appium and WebDriverAgent ports, and reuse the prebuilt WebDriverAgent. Never overlap `POST /session`.
- Keep `noReset: false`, `enforceAppInstall: true`, and `forceAppLaunch: true`, and do not launch the app with `simctl launch` first.
Expand Down
5 changes: 5 additions & 0 deletions scripts/ci/run-ios-e2e-cell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# IOS_DEVICE_NAME (default iPhone 17)
# SKIP_BUILD=1 SKIP_METRO=1 SKIP_APPIUM_INSTALL=1
# METRO_PORT / APPIUM_PORT (defaults: Metro 8081 both cells; Appium 4723 dynamic / 4725 static)
# WDA_IPHONEOS_DEPLOYMENT_TARGET (default 15.1; always passed to the WDA xcodebuild)
set -euo pipefail

ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
Expand All @@ -31,6 +32,9 @@ fi
export APPIUM_PORT
export APPIUM_HOST="${APPIUM_HOST:-127.0.0.1}"
WDA_PORT="${WDA_PORT:-8100}"
# Vendored appium-webdriveragent still defaults to 12.0, which current
# simulator SDKs reject. Always pass an explicit target (override via env).
WDA_IPHONEOS_DEPLOYMENT_TARGET="${WDA_IPHONEOS_DEPLOYMENT_TARGET:-15.1}"
IOS_E2E_ATTEMPTS="${IOS_E2E_ATTEMPTS:-3}"
WDA_DERIVED="$REPORT_DIR/wda-derived-data"
mkdir -p "$WDA_DERIVED"
Expand Down Expand Up @@ -349,6 +353,7 @@ run_logged "$LOG_DIR/wda-xcodebuild.log" xcodebuild \
-destination "generic/platform=iOS Simulator" \
-derivedDataPath "$WDA_DERIVED" \
CODE_SIGNING_ALLOWED=NO \
IPHONEOS_DEPLOYMENT_TARGET="${WDA_IPHONEOS_DEPLOYMENT_TARGET}" \
build-for-testing
export IOS_WDA_DERIVED_DATA_PATH="$WDA_DERIVED"
export IOS_WDA_APP_PATH="$WDA_DERIVED/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app"
Expand Down
52 changes: 52 additions & 0 deletions src/__tests__/wda-deployment-target.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import fs from 'node:fs';
import path from 'node:path';

/**
* The WDA prebuild must pass IPHONEOS_DEPLOYMENT_TARGET explicitly.
* Vendored appium-webdriveragent still defaults the project to 12.0, which
* current Xcode simulator SDKs reject. This reads the cell script only.
*/
describe('scripts/ci/run-ios-e2e-cell.sh WDA deployment target', () => {
const scriptPath = path.join(
__dirname,
'../../scripts/ci/run-ios-e2e-cell.sh'
);
const source = fs.readFileSync(scriptPath, 'utf8');

function wdaBuildInvocation(): string {
const start = source.indexOf(
'run_logged "$LOG_DIR/wda-xcodebuild.log" xcodebuild'
);
expect(start).toBeGreaterThanOrEqual(0);
const rest = source.slice(start);
const matched = rest.match(/^[\s\S]*?\n[ \t]*build-for-testing\b/);
expect(matched).not.toBeNull();
return (matched?.[0] ?? '')
.replace(/#[^\n]*/g, '')
.replace(/\/\*[\s\S]*?\*\//g, '');
}

it('defaults WDA_IPHONEOS_DEPLOYMENT_TARGET to 15.1 before the WDA build', () => {
const assignment =
'WDA_IPHONEOS_DEPLOYMENT_TARGET="${WDA_IPHONEOS_DEPLOYMENT_TARGET:-15.1}"';
const assignmentAt = source.indexOf(assignment);
const invocationAt = source.indexOf(
'run_logged "$LOG_DIR/wda-xcodebuild.log" xcodebuild'
);
expect(assignmentAt).toBeGreaterThanOrEqual(0);
expect(invocationAt).toBeGreaterThan(assignmentAt);
});

it('passes IPHONEOS_DEPLOYMENT_TARGET on the WebDriverAgentRunner build-for-testing invocation', () => {
const invocation = wdaBuildInvocation();
expect(invocation).toMatch(/-scheme WebDriverAgentRunner/);
expect(invocation).toMatch(
/-destination "generic\/platform=iOS Simulator"/
);
expect(invocation).toMatch(/build-for-testing/);
expect(invocation).toMatch(
/IPHONEOS_DEPLOYMENT_TARGET="\$\{WDA_IPHONEOS_DEPLOYMENT_TARGET\}"/
);
expect(invocation).not.toMatch(/IPHONEOS_DEPLOYMENT_TARGET=12\.0/);
});
});
Loading