Update Network
Predefined network condition usage
def update_network(
driver: TestUIDriver,
network_mode: str,
network_config: dict or None = None
) -> None
Updates network conditions for participant while the test is running.
The network_mode
parameter specifies what network conditions should be used.
Available network configurations and network_mode
values can be found
here
or they can be accessed using constants.
network_config
(optional) - parameter that specifies exact network conditioner
field values.
Custom network configuration is taken into effect only if
provided network_mode
is "custom".
Currently available custom network configuration metrics are:
Network parameter | Traffic direction | JSON key | Unit of measure | Min value | Max value |
---|---|---|---|---|---|
Bandwidth | Outgoing | rate_up | mbit | 0 | |
Incoming | rate_down | mbit | 0 | ||
Latency | Outgoing | latency_up | ms | 0 | |
Incoming | latency_down | ms | 0 | ||
Jitter | Outgoing | jitter_up | ms | 0 | |
Incoming | jitter_down | ms | 0 | ||
Packet loss | Outgoing | loss_up | % | 0 | 100 |
Incoming | loss_down | % | 0 | 100 |
For custom network configuration jitter parameters must be defined together with latency. If jitter parameters are set without also defining latency parameters, then jitter configuration will not be applied.
The network parameters not defined in custom network configuration will be reset to their default values.
def test(driver: TestUIDriver):
driver.navigate_to("https://www.bing.com")
e(driver, "css", ".dimmer").wait_until_visible(seconds=10)
update_network(driver, LOADERO_CONSTANTS.network.mobile_3g)
def test(driver: TestUIDriver):
customNetworkConfig = {
"latency_up": 100,
"latency_down": 50,
"jitter_up": 20,
"jitter_down": 10,
"rate_up": 50,
"rate_down": 80,
"loss_up": 5,
"loss_down": 75
}
driver.navigate_to("https://www.bing.com")
e(driver, "css", ".dimmer").wait_until_visible(seconds=10)
update_network(
driver, LOADERO_CONSTANTS.network.custom, customNetworkConfig
)