-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1367 from grafana/release/v0.47.0
Documentation for k6 v0.47.0
- Loading branch information
Showing
368 changed files
with
18,458 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ocs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/cookie.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: "Cookie" | ||
excerpt: "Browser module: Cookie Class" | ||
--- | ||
|
||
Cookie class represents a cookie in the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext). | ||
|
||
See the [HTTP Cookies documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) on the Mozilla website for more details about cookies. | ||
|
||
| Property | Type | Default | Description | | ||
| -------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| name | string | `""` | The cookie's name. Required. | | ||
| value | string | `""` | The cookie's value. Required. | | ||
| domain | string | `""` | The cookie's domain. | | ||
| path | string | `'/'` | The cookie's path. | | ||
| url | string | `""` | The cookie's URL. | | ||
| expires | number | `-1` | The cookie's expiration date as the number of seconds since the UNIX epoch. `-1` means a session cookie. | | ||
| httpOnly | bool | `false` | A cookie is inaccessible to the JavaScript [document.cookie](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie) API when this property is `true`. | | ||
| secure | bool | `false` | The cookie's secure flag. | | ||
| sameSite | string | `'Lax'` | The cookie's same site flag. It can be one of `'Strict'`, `'Lax'`, and `'None'`. | |
80 changes: 80 additions & 0 deletions
80
...cs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/cookies.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
title: 'cookies([urls])' | ||
excerpt: 'Retrieves context cookies.' | ||
--- | ||
|
||
Returns a list of [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) from the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext) filtered by the provided `urls`. If no `urls` are provided, all cookies are returned. | ||
|
||
| Parameter | Type | Description | | ||
|----------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| urls | array | A string array of URLs to filter the [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) in the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext). | | ||
|
||
### Returns | ||
|
||
| Type | Description | | ||
| ---- | ----------- | | ||
| array | A list of [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie). | | ||
|
||
<Blockquote mod="info"> | ||
|
||
[Cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) can be added with [BrowserContext.addCookies](/javascript-api/k6-experimental/browser/browsercontext/addcookies/). | ||
|
||
</Blockquote> | ||
|
||
### Example | ||
|
||
<CodeGroup labels={[]}> | ||
|
||
```javascript | ||
import { browser } from 'k6/experimental/browser'; | ||
|
||
export const options = { | ||
scenarios: { | ||
ui: { | ||
executor: 'shared-iterations', | ||
options: { | ||
browser: { | ||
type: 'chromium', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default async function () { | ||
const context = browser.newContext(); | ||
const page = context.newPage(); | ||
|
||
try { | ||
// get cookies from the browser context | ||
let cookies = context.cookies(); | ||
console.log("initial cookies length:", cookies.length); // prints 0 | ||
|
||
// let's add more cookies to filter by urls | ||
context.addCookies([ | ||
{ name: 'foo', value: 'foovalue', sameSite: 'Strict', url: 'http://foo.com' }, | ||
{ name: 'bar', value: 'barvalue', sameSite: 'Lax', url: 'https://bar.com' }, | ||
{ name: 'baz', value: 'bazvalue', sameSite: 'Lax', url: 'https://baz.com' } | ||
]); | ||
|
||
// get all cookies | ||
cookies = context.cookies(); | ||
console.log("filtered cookies length:", cookies.length); // prints 3 | ||
|
||
// get cookies filtered by urls | ||
cookies = context.cookies('http://foo.com', 'https://baz.com'); | ||
console.log("filtered cookies length:", cookies.length); // prints 2 | ||
|
||
// the first filtered cookie | ||
console.log("1st cookie's name :", cookies[0].name); // prints foo | ||
console.log("1st cookie's value:", cookies[0].value); // prints foovalue | ||
// the first filtered cookie | ||
console.log("2nd cookie's name :", cookies[1].name); // prints baz | ||
console.log("2nd cookie's value:", cookies[1].value); // prints bazvalue | ||
} finally { | ||
page.close(); | ||
} | ||
} | ||
``` | ||
|
||
</CodeGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...down/docs/02 javascript api/07 k6-experimental/01 browser/03-console-message.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "ConsoleMessage" | ||
excerpt: "Browser module: ConsoleMessage Class" | ||
--- | ||
|
||
<BrowserDocsWIP/> | ||
|
||
## Supported APIs | ||
|
||
| Method | Playwright Relevant Distinctions | | ||
| - | - | | ||
| <a href="https://playwright.dev/docs/api/class-consolemessage#console-message-args" target="_blank" >consoleMessage.args()</a> | - | | ||
| <a href="https://playwright.dev/docs/api/class-consolemessage#console-message-page" target="_blank" >consoleMessage.page()</a> | - | | ||
| <a href="https://playwright.dev/docs/api/class-consolemessage#console-message-text" target="_blank" >consoleMessage.text()</a> | - | | ||
| <a href="https://playwright.dev/docs/api/class-consolemessage#console-message-type" target="_blank" >consoleMessage.type()</a> | - | |
Oops, something went wrong.