maestro icon indicating copy to clipboard operation
maestro copied to clipboard

iOS Simulator: reliable offline / airplane-mode simulation for Maestro flows

Open Bowlerr opened this issue 1 week ago • 3 comments

Use case

Problem

Maestro currently cannot reliably test offline behavior on iOS simulators.

  • setAirplaneMode is a no-op on iOS
  • iOS Simulator exposes no real airplane-mode toggle
  • As a result, offline-dependent flows are not testable or deterministic on iOS

This blocks validation of common and critical UX paths such as:

  • Offline login and error states
  • Cached / offline-first content
  • Retry and network recovery UI

Android supports this reliably; iOS does not, creating a cross-platform testing gap.


Alternatives considered

  • Network Link Conditioner

    • Not available or scriptable on all macOS / CI environments
    • Requires system profiles and manual setup
    • Not reliably toggleable per test run
  • Simulator network disable / airplane mode

    • No supported API or deterministic CLI control
  • App-level mocking / stubbing

    • Requires app code changes
    • Breaks black-box E2E testing guarantees

Proposal

Add a reliable “offline mode” implementation for iOS simulators that makes setAirplaneMode deterministic.

From a user perspective:

  • setAirplaneMode(true) reliably forces the simulator into an offline state
  • setAirplaneMode(false) restores normal connectivity
  • State is safely cleaned up even if a run fails

One possible implementation:

  • Temporarily blackhole simulator traffic by setting macOS HTTP + HTTPS proxies to 127.0.0.1:<closed-port>
  • Snapshot and restore previous proxy configuration on disable and driver exit
  • Ensure Maestro’s XCTest control channel bypasses the proxy (NO_PROXY)

Anything else?

  • This is intended as an “offline enough” mechanism for simulator E2E testing

  • A minimal E2E validation flow could assert:

    ONLINE → OFFLINE → ONLINE
    

Bowlerr avatar Dec 16 '25 21:12 Bowlerr