During an app automation test, how can I alter the network settings?

During an app automation test, how can I alter the network settings?

Hi Alex,

LambdaTest provides an API to change the network conditions. You can use a curl command to make a POST request to their API. Here’s the structure of the curl command:

curl --location --request POST 'https://mobile-api.lambdatest.com/mobile-automation/api/v1/sessions/SessionID/update_network' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic Auth=' \
--data-raw '{"mode": "offline"}'

Is there a way to change network settings during a test, by running a javascript snippet instead of running the curl command?

Hi there,

Thanks for reaching out to us.

You can add the API endpoint in your script wherever you wish to change the network conditions in your test.