diff --git a/e2e/mobilewright.config.ts b/e2e/mobilewright.config.ts index c0f8ba3..bb4f7c8 100644 --- a/e2e/mobilewright.config.ts +++ b/e2e/mobilewright.config.ts @@ -9,7 +9,9 @@ export default defineConfig({ // simctl — mobilewright's LaunchOptions only supports locales. autoAppLaunch: false, viewTree: 'on-failure', - timeout: 60_000, + // Per-test budget: resetAndLaunch (uninstall -> install -> launch) counts + // against the test, and CI runners are 2-3x slower than local. + timeout: 120_000, expect: { timeout: 8_000 }, retries: 1, workers: 1, diff --git a/e2e/tests/helpers.ts b/e2e/tests/helpers.ts index a00e1c5..b925423 100644 --- a/e2e/tests/helpers.ts +++ b/e2e/tests/helpers.ts @@ -52,7 +52,8 @@ export async function resetAndLaunch(device: Device): Promise { }); // expect.poll() is not available in @mobilewright/test's expect — poll manually. - const deadline = Date.now() + 20_000; + // First launch after a fresh install can be slow on a loaded simulator. + const deadline = Date.now() + 60_000; for (;;) { if (foregroundApp(udid) === BUNDLE_ID) return; if (Date.now() > deadline) { diff --git a/mise.toml b/mise.toml index 1974380..06a669b 100644 --- a/mise.toml +++ b/mise.toml @@ -254,6 +254,11 @@ set -euo pipefail cd Apps/iOS xcodegen generate +# CoreSimulator cold start on fresh CI runners can exceed the pick script's +# timeout — warm the daemon first. Never let the 26.2 pick hard-fail: an empty +# or timed-out result falls through to any available iPhone below. +xcrun simctl list runtimes >/dev/null 2>&1 || true + UDID=$(python3 "$PWD/../../scripts/simctl_pick_udid.py" \ --runtime "com.apple.CoreSimulator.SimRuntime.iOS-26-2" \ --prefer "iPhone 16" \ @@ -261,7 +266,7 @@ UDID=$(python3 "$PWD/../../scripts/simctl_pick_udid.py" \ --prefer "iPhone 16 Plus" \ --prefer "iPhone 16 Pro Max" \ --contains "iPhone" \ - --timeout-seconds 15) || { echo "Failed to query simulators. Try: mise run ios:sim:reset" >&2; exit 1; } + --timeout-seconds 60) || true if [ -z "$UDID" ]; then # CI images may not ship the iOS 26.2 runtime — fall back to any iPhone. @@ -305,7 +310,10 @@ if [ ! -d e2e/node_modules ]; then (cd e2e && npm ci --no-audit --no-fund) fi -# 1. Build the current app (xcodegen + env injection + xcodebuild) +# 1. Warm CoreSimulator (cold CI runners: first simctl call is slow enough to +# trip simctl_pick_udid.py's timeout inside ios:build:dev) and build the +# current app (xcodegen + env injection + xcodebuild). +xcrun simctl list runtimes >/dev/null 2>&1 || true mise run ios:build:dev # 2. Boot a simulator silently (no Simulator.app window) @@ -314,7 +322,7 @@ UDID=$(python3 "$PWD/scripts/simctl_pick_udid.py" \ --prefer "iPhone 16" \ --prefer "iPhone 16 Pro" \ --contains "iPhone" \ - --timeout-seconds 15) || { echo "Failed to query simulators. Try: mise run ios:sim:reset" >&2; exit 1; } + --timeout-seconds 60) || true if [ -z "$UDID" ]; then # CI images may not ship the iOS 26.2 runtime — fall back to any iPhone.