iOS Simulator: simulate airplane mode (offline) + add E2E network status flow
iOS Simulator: simulate airplane mode (offline) + add E2E network status flow
Issue: 2895
Description
This PR makes setAirplaneMode work on iOS Simulator by simulating “offline mode” via host macOS proxy blackholing, with safe snapshot/restore handling.
It also adds an end-to-end flow that validates online → offline → online transitions on iOS.
Why
- iOS Simulator has no reliable airplane-mode toggle
setAirplaneModeis currently a no-op on iOS- Maestro cannot deterministically test offline UX on iOS, unlike Android
This blocks E2E coverage for:
- Offline login / error states
- Cached content
- Retry and recovery UI
What changed
maestro-client/src/main/java/maestro/drivers/IOSDriver.kt
-
Implements simulator “airplane mode” as:
- Snapshot current macOS proxy configuration
- Set web + secure proxies to
127.0.0.1:<closed-port> - Restore snapshot on disable and driver close (best-effort)
-
isAirplaneModeEnablednow reflects the simulated state
maestro-ios-driver/src/main/kotlin/util/XCRunnerCLIUtils.kt
-
Adds proxy snapshot / restore for:
- Web proxy
- Secure proxy
-
Explicitly enables / disables proxy state
-
Adds
MAESTRO_NETWORK_SERVICEoverride (default: Wi-Fi) to support different macOS setups
maestro-ios-driver/src/main/kotlin/xcuitest/XCTestDriverClient.kt
- Forces
Proxy.NO_PROXY - Ensures the local XCTest control channel is not affected by host proxy changes
maestro-ios-xctest-runner/maestro-driver-ios/ViewController.swift
-
Adds a small visible UI indicator:
NETWORK_ONLINE / NETWORK_OFFLINE -
Periodically checks connectivity via
https://example.com
maestro-ios-driver/src/main/resources/driver-iPhoneSimulator/Debug-iphonesimulator/*.zip
- Updates prebuilt runner artifacts
- Ensures CI and contributors get the new driver UI without rebuilding locally
e2e/workspaces/maestro_driver_ios_network/airplane_mode_network_status.yaml
-
New E2E flow asserting:
ONLINE → OFFLINE → ONLINE -
Uses
setAirplaneModeon iOS
How to test
Boot an iOS simulator and run:
./maestro-cli/build/install/maestro/bin/maestro \
--platform ios \
--udid <UDID> \
test \
--reinstall-driver \
e2e/workspaces/maestro_driver_ios_network/airplane_mode_network_status.yaml
Optional (if your macOS network service is not Wi-Fi):
MAESTRO_NETWORK_SERVICE="USB 10/100/1000 LAN" maestro ...
Notes / risks
-
This temporarily modifies host macOS proxy settings
- Previous state is snapshotted and restored on disable and driver close (best-effort)
-
Proxy blackholing affects web + secure proxies only
- Intended as a practical, deterministic “offline enough” solution for simulator traffic