Skip to content

Commit cc1fc3c

Browse files
authored
Merge pull request LambdaTest#1047 from akshayverma28/stage
Network Throttling and Espresso Network Logs changes
2 parents fc930df + 3e38ab5 commit cc1fc3c

File tree

2 files changed

+40
-17
lines changed

2 files changed

+40
-17
lines changed

docs/app-auto-network-throttling.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,16 @@ By the end of this guide, you will learn how to:
7979
}
8080
```
8181

82-
8382
:::note
84-
To utilize the **networkProfile** capability, ensure that you include `network: True` in the capabilities
83+
To utilize the **networkProfile** capability, ensure that you include `network: True` in the capabilities.
8584
:::
8685

87-
8886
### During Test Execution
8987

9088
- **LambdaHook:** Dynamically alter the network profile within the test session using the following LambdaHook:
91-
9289
```python
9390
driver.execute_script("updateNetworkProfile=3g-umts-good")
9491
```
95-
- **Offline** mode can be supported during test execution by using using the following LambdaHook (only for **android**):
96-
97-
```python
98-
driver.execute_script("updateNetworkProfile=offline")
99-
```
10092

10193
### Supported Network Profiles
10294

@@ -109,31 +101,60 @@ To utilize the **networkProfile** capability, ensure that you include `network:
109101
| 3g-umts-good | 5 Mbps | 2 Mbps | 100 ms |
110102
| 4g-lte-good | 15 Mbps | 7 Mbps | 70 ms |
111103
| 4g-lte-advanced-good | 25 Mbps | 12 Mbps | 20 ms |
112-
| default | NA | NA | NA |
104+
| default | NA | NA | NA |
113105

114-
> Download speed is currently stable, expect additional feature updates shortly.
115106

116107
### Custom Profiles
117108

118109
- **LambdaHook:** Define and implement custom network profiles with LambdaHook by specifying the maximum download speed (kbps), maximum upload speed (kbps), and latency (ms) for the custom condition, as illustrated in the example.
119-
120110
```python
121111
driver.execute_script("customNetworkProfile: { \"downloadSpeed\": 500, \"uploadSpeed\" : 250, \"latency\": 100 }" )
122112
```
123113

124-
### Default/Reset network configuration
114+
### Default/Reset Network Configuration
125115

126116
- **LambdaHook:** Employ this webhook to seamlessly restore the device's network profile to its default state. Invocation of this LambdaHook removes any predefined or custom network settings, ensuring the device is reset to its original configuration.
127-
128117
```python
129118
driver.execute_script("updateNetworkProfile=default")
130119
```
131120

132-
:::caution
121+
### Offline Mode
122+
123+
#### Android
124+
125+
- To initialize tests in **offline mode**, set the `networkProfile` capability to `offline` during session initiation:
126+
```python
127+
caps = {
128+
"network": True,
129+
"networkProfile": "offline" # Set to offline mode
130+
}
131+
```
132+
133+
- **LambdaHook:** You can also switch to offline mode during the test execution with the following command:
134+
```python
135+
driver.execute_script("updateNetworkProfile=offline")
136+
```
137+
138+
#### iOS
139+
140+
- For **iOS** devices, offline mode cannot be set using the `networkProfile` capability. Instead, use the offline mode API by sending a cURL request within the running test session:
141+
```bash
142+
curl --location 'https://mobile-api.lambdatest.com/mobile-automation/api/v1/sessions/<session-id>/update_network' \
143+
--header 'Authorization: Basic <username:access_key>' \
144+
--header 'Content-Type: application/json' \
145+
--data '{"mode": "offline"}'
146+
```
147+
148+
149+
:::note
150+
- **Network throttling** results may vary sometimes based on multiple factors including network conditions and device performance.
151+
133152
- **Wrong Capability Name or Value:** Providing an incorrect capability value results in a bad request error with a descriptive message.
134-
- **LambdaHook Error:** If you pass any wrong value in LambdaHook,you will receive an error message.
135-
:::
136153

154+
- **LambdaHook Error:** If you pass any wrong value in LambdaHook, you will receive an error message.
155+
156+
- In offline mode, **live video** will not be available for the duration of the test session.
157+
:::
137158

138159
> In case you have any questions, feel free to share them with us.Our experts are available on <span className="doc__lt" onClick={() => window.openLTChatWidget()}>**24/7 Customer chat support**</span>. You can also drop us a mail at support@lambdatest.com. Happy testing! 🙂
139160

docs/espresso-supported-capabilities.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ This document provide details about the features and capabilities supported for
5555
| queueTimeout | Integer | Total execution time of the build. Example: `queueTimeout: 300`. Maximum value is `10800`|
5656
| idleTimeout | Integer | Enter the time in seconds for maximum running time of a test in a build. Example: `idleTimeout: 120`|
5757
| deviceLog | Boolean | To generate the device logs, pass the value as `deviceLog: true` |
58+
| network | Boolean | To generate the network logs , pass the value as `network: true` |
59+
| network.har | Boolean | To generate the network logs in .har format, pass the value as `network.har: true` only works with `network:true` |
5860
| build | String | To set the Espresso build name. Example: `build: My Espresso Build`. |
5961
| geoLocation | String | Set the geolocation country code if you want to enable the same in your test. Example - `geoLocation: FR`|
6062
| tunnel, tunnelName | Boolean | To activate the tunnel mode, pass the value as `tunnel: true` and provide the name of your tunnel as `tunnelName: NewTunnel` |

0 commit comments

Comments
 (0)