Taiko
Documentation

Home / API Reference

emulateNetwork

Activates emulation of network conditions.

Examples

# Emulate offline conditions
await emulateNetwork("Offline")
# Emulate slow network conditions
await emulateNetwork("Good2G")
# Emulate precise network conditions
await emulateNetwork({ offline: false, downloadThroughput: 6400, uploadThroughput: 2560, latency: 500 })
# Emulate precise network conditions with any subset of these properties, with default fallbacks of `offline` as true and all numbers as 0
await emulateNetwork({ downloadThroughput: 6400, uploadThroughput: 2560, latency: 500 })

Parameters


networkType

'GPRS','Regular2G','Good2G','Good3G','Regular3G','Regular4G','DSL','WiFi','Offline', {offline: boolean, downloadThroughput: number, uploadThroughput: number, latency: number}


Returns

Promise<void>