Skip to main content

routeTraffic

Routes network traffic on the iOS device through a tunnel or proxy. Returns a cleanup function to restore normal network behavior.
const cleanupProxy = await ios.routeTraffic(config: RouteTrafficConfig): Promise<() => Promise<void>>

Parameters

apps
string[]
required
List of app bundle IDs to route. Pass an empty array [] to route all apps.
domains
string[]
Optional list of domains to route. If omitted, all domains are routed.
tunnel
object
required
The tunnel configuration. Must be one of the following types:
  • { type: "direct" } — Routes traffic directly with no proxy or VPN.
  • { type: "http-proxy", host, port, username?, password? } — Routes through an HTTP proxy.
  • { type: "wireguard", configPath } — Routes through a WireGuard VPN using a config file.
  • { type: "openvpn", configPath } — Routes through an OpenVPN connection using a config file.
  • { type: "relay", host, port, username, password, dialer?, secure? } — Routes through a relay server.
socksHost
string
Optional SOCKS proxy host.
socksPort
number
Optional SOCKS proxy port.
inspect
boolean
If true, enables traffic inspection/logging.

Returns

A cleanup function () => Promise<void>. Call it at the end of your test to restore normal network routing.

Example

const cleanupProxy = await ios.routeTraffic({
  apps: [],
  tunnel: {
    type: "http-proxy",
    host: "proxy.example.com",
    port: 8080,
  },
});

// ... run your test steps ...

await cleanupProxy();

getNetworkStatus

Returns the current network routing status of the device.
await ios.getNetworkStatus(): Promise<NetworkStatus>

Response

route
"direct" | "http-proxy" | "wireguard" | "openvpn" | "relay"
required
The currently active routing method.
tunnels
object
required
A map of tunnel names to their current status. Each entry includes:
  • status: "down" | "starting" | "up" | "error"
  • interface (optional): Network interface name.
  • error (optional): Error message if status is "error".
routingTables
object
Active routing table information, including the active table name and a map of table entries.
traffic
object
Traffic statistics broken down by route and network interface (packets and bytes).
vpnApp
object
required
Information about the VPN app on the device:
  • bundleId: App bundle identifier.
  • installed: Whether the VPN app is installed.
  • pid (optional): Process ID if running.
routedApps
string[]
required
Bundle IDs of apps currently being routed.
routedDomains
string[]
required
Domains currently being routed.

simulateNetworkCondition

Simulates degraded network conditions such as throttled bandwidth or packet loss. Returns a cleanup function to restore normal conditions.
const cleanup = await ios.simulateNetworkCondition(config: NetworkConditionConfig): Promise<() => Promise<void>>

Parameters

bandwidthKbps
number
Bandwidth cap in kilobits per second.
latencyMs
number
Added latency in milliseconds.
jitterMs
number
Latency jitter in milliseconds.
packetLossPercent
number
Percentage of packets to drop (0–100).

Presets

PresetDescription
ios.NETWORK_2G_EDGE2G/EDGE conditions
ios.NETWORK_3G3G conditions
ios.NETWORK_4G_LTE4G LTE conditions
ios.NETWORK_5G5G conditions
ios.NETWORK_SATELLITESatellite connection
ios.NETWORK_WIFI_CONGESTEDCongested WiFi
ios.NETWORK_VERY_BADVery poor conditions
ios.NETWORK_OFFLINENo network connectivity

Returns

A cleanup function () => Promise<void>. Call it to restore normal network conditions.

Example

const cleanup = await ios.simulateNetworkCondition(ios.NETWORK_3G);

// ... test behavior under 3G conditions ...

await cleanup();

getNetworkCondition

Returns the currently active simulated network condition, if any.
await ios.getNetworkCondition(): Promise<NetworkConditionStatus>

Response

enabled
boolean
required
Whether network condition simulation is currently active.
config
object
The active condition config, if enabled. Includes optional fields: bandwidthKbps, latencyMs, jitterMs, packetLossPercent.
interface
string
The network interface the condition is applied to.

subscribeNetworkLogs

Subscribes to real-time network traffic logs on the device.
const subscription = ios.subscribeNetworkLogs(): NetworkLogSubscription

Returns

A NetworkLogSubscription object with two methods:
  • on(handler) — Registers a callback that receives each RecordedEntry as it arrives.
  • close() — Unsubscribes and stops receiving logs.

Example

const subscription = ios.subscribeNetworkLogs();

subscription.on((entry) => {
  console.log(entry.http?.uri, entry.http?.statusCode);
});

// ... run your test ...

subscription.close();

RecordedEntry fields

Each log entry may include the following fields depending on the protocol:
service
string
required
The originating service name.
network
string
required
Network type (e.g., wifi, cellular).
remote
string
Remote IP address.
local
string
Local IP address.
host
string
Hostname.
proto
string
Protocol (e.g., tcp, udp).
http
object
HTTP request/response details including method, URI, status code, headers, and body.
websocket
object
WebSocket frame details.
tls
object
TLS handshake details including server name, cipher suite, and version.
dns
object
DNS query/response details.
sid
string
required
Session ID.
time
string
required
Timestamp of the log entry.
duration
number
required
Duration in milliseconds.

calculateAudioFingerprint

Calculates a fingerprint from audio data for comparison or verification.
await ios.calculateAudioFingerprint(driver, audioData: Buffer | string): Promise<AudioFingerprint>

Parameters

driver
Browser
required
The WebDriverIO browser instance.
audioData
Buffer | string
required
Raw audio data to fingerprint.

Response

fingerprint
number[]
required
Array of numeric values representing the audio fingerprint.
duration
number
required
Duration of the audio in seconds.

startSpeakerRecording / stopSpeakerRecording / downloadSpeakerRecording

Records audio from the device speaker during a test.
const session = await ios.startSpeakerRecording(driver): Promise<SpeakerRecordingSession>
const file = await ios.stopSpeakerRecording(driver, sessionId: string): Promise<SpeakerRecordingFile>
const buffer = await ios.downloadSpeakerRecording(driver, filename: string): Promise<Buffer>

Example

const session = await ios.startSpeakerRecording(wdio);

// ... trigger audio playback in the app ...

const file = await ios.stopSpeakerRecording(wdio, session.id);
const audio = await ios.downloadSpeakerRecording(wdio, file.filename);

listPhotos / savePhoto / deleteAllPhotos

Utilities for managing photos in the device’s photo library.
await ios.listPhotos(driver): Promise<ListPhotosResult>
await ios.savePhoto(driver, filePath: string): Promise<SavePhotoResult>
await ios.deleteAllPhotos(driver): Promise<DeletePhotosResult>
deleteAllPhotos permanently removes all photos from the device’s photo library. Use with caution.

installConfigurationProfile

Installs a .mobileconfig configuration profile on the device. Returns a cleanup function to remove the profile.
const removeProfile = await ios.installConfigurationProfile(driver, profileString: string): Promise<() => Promise<unknown>>

Parameters

driver
Browser
required
The WebDriverIO browser instance.
profileString
string
required
The contents of the .mobileconfig file as a string.

Returns

A cleanup function that removes the installed profile when called.
Last modified on April 7, 2026