Skip to content

Commit

Permalink
Add release notes for throttleNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 committed Nov 21, 2023
1 parent ea3890a commit 2af68e5
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions release notes/v0.48.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,44 @@ Allows users to throttle the CPU from chrome/chromium's perspective, which helps
...
```
### Add support for browser module's `page.throttleNetwork` [browser#1094](https://github.com/grafana/xk6-browser/pull/1094)
Allows users to throttle the characteristics of the network from chrome/chromium's perspective, which helps emulate poor network connections when testing the website's frontend. The mandatory argument is of type `NetworkProfile` and is defined as:
```ts
export interface NetworkProfile {
/*
* Minimum latency from request sent to response headers received (ms).
*/
latency: number;

/*
* Maximal aggregated download throughput (bytes/sec). -1 disables download
* throttling.
*/
download: number;

/*
* Maximal aggregated upload throughput (bytes/sec). -1 disables upload
* throttling.
*/
upload: number;
}
```
You can either define your own network profiles or use the ones we have defined by importing `networkProfiles` from the `browser` module. The documentation for this API can be found [here](https://grafana.com/docs/k6/v0.48.x/javascript-api/k6-experimental/browser/page/throttlenetwork).
```js
import { browser, networkProfiles } from 'k6/experimental/browser';
...
const context = browser.newContext();
const page = context.newPage();

try {
page.throttleNetwork(networkProfiles['Slow 3G']);
...
```
## UX improvements and enhancements
- [browser#1074](https://github.com/grafana/xk6-browser/pull/1074) Adds a new `browser.closeContext()` [method](https://k6.io/docs/javascript-api/k6-experimental/browser/closecontext/) to facilitate closing the current active browser context.
Expand Down

0 comments on commit 2af68e5

Please sign in to comment.