-
Notifications
You must be signed in to change notification settings - Fork 224
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 #789 from grafana/docs/582-xk6-browser
Update xk6-browser docs for release v0.5.0
- Loading branch information
Showing
83 changed files
with
2,415 additions
and
920 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
18 changes: 0 additions & 18 deletions
18
src/components/shared/browser-compatibility/browser-compatibility.view.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/components/shared/browser-docs-wip/browser-docs-wip.view.js
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,12 @@ | ||
import Blockquote from 'components/shared/blockquote'; | ||
import React from 'react'; | ||
|
||
const BrowserDocsWIP = () => ( | ||
<Blockquote mod="warning"> | ||
<p> | ||
This documentation is a work in progress, and some of the functionality | ||
that is listed below may not behave as expected. | ||
</p> | ||
</Blockquote> | ||
); | ||
export default BrowserDocsWIP; |
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,3 @@ | ||
import BrowserDocsWIP from './browser-docs-wip.view'; | ||
|
||
export default BrowserDocsWIP; |
16 changes: 7 additions & 9 deletions
16
src/components/shared/table-wrapper/table-wrapper.module.scss
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 |
---|---|---|
@@ -1,15 +1,13 @@ | ||
.table-wrapper { | ||
width: 100%; | ||
overflow: auto; | ||
table { | ||
td:nth-child(1) { | ||
white-space: nowrap; | ||
} | ||
@include sm-down { | ||
tr td:nth-of-type(3) { | ||
width: 100%; | ||
min-width: 230px; //usually 3rd column contains text which is being squished | ||
} | ||
td:nth-child(1) { | ||
white-space: nowrap; | ||
} | ||
@include sm-down { | ||
tr td:nth-of-type(3) { | ||
width: 100%; | ||
min-width: 230px; //usually 3rd column contains text which is being squished | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
src/data/markdown/docs/30 xk6-browser/01 xk6-browser/01 Browser.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,35 @@ | ||
--- | ||
title: "Browser" | ||
excerpt: "xk6-browser: Browser Class" | ||
--- | ||
|
||
The `Browser` class is the entry point for all your tests, and it is what interacts with the actual web browser via [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP). It manages: | ||
- [BrowserContext](/javascript-api/xk6-browser/browsercontext/) which is where you can set a variety of attributes to control the behavior of pages; | ||
- and [Page](/javascript-api/xk6-browser/page/) which is where your rendered site is displayed. | ||
|
||
A new Browser instance (hence a new browser process) can be created using the `launch()` method of the `chromium` module from `'k6/x/browser'`. | ||
|
||
| Method | Description | | ||
|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| [browser.close()](/javascript-api/xk6-browser/browser/close) | Closes the browser and all of its pages (if any were opened). | | ||
| [browser.contexts()](/javascript-api/xk6-browser/browser/contexts) | Allows you to access all open [BrowserContext](/javascript-api/xk6-browser/browsercontext/)s. | | ||
| [browser.isConnected](/javascript-api/xk6-browser/browser/isconnected) <BWIPT id="453"/> | Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. | | ||
| [browser.newContext([options])](/javascript-api/xk6-browser/browser/newcontext/) <BWIPT id="455"/> | Creates and returns a new [BrowserContext](/javascript-api/xk6-browser/browsercontext/). | | ||
| [browser.newPage([options])](/javascript-api/xk6-browser/browser/newpage) <BWIPT id="455"/> | Creates a new [Page](/javascript-api/xk6-browser/page/) in a new [BrowserContext](/javascript-api/xk6-browser/browsercontext/) and returns the page. | | ||
| [browser.on('disconnected')](/javascript-api/xk6-browser/browser/on) | Detects the disconnected event from the browser application. | | ||
| [browser.version()](/javascript-api/xk6-browser/browser/version) | Returns the browser application's version. | | ||
|
||
### Example | ||
|
||
```javascript | ||
import { chromium } from 'k6/x/browser'; | ||
|
||
export default function () { | ||
const browser = chromium.launch(); | ||
const context = browser.newContext(); | ||
const page = context.newPage(); | ||
const res = page.goto('https://test.k6.io/'); | ||
page.close(); | ||
browser.close(); | ||
} | ||
``` |
28 changes: 28 additions & 0 deletions
28
src/data/markdown/docs/30 xk6-browser/01 xk6-browser/01 Browser/close.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,28 @@ | ||
--- | ||
title: 'close()' | ||
excerpt: 'xk6-browser: Browser.close method' | ||
--- | ||
|
||
Closes the browser and all of its pages (if any were opened). | ||
|
||
The [Browser](/javascript-api/xk6-browser/browser/) object cannot be used anymore and is considered disposed of. | ||
|
||
|
||
### Example | ||
|
||
<CodeGroup labels={[]}> | ||
|
||
```javascript | ||
import { chromium } from 'k6/x/browser'; | ||
|
||
export default function () { | ||
const browser = chromium.launch(); | ||
const context = browser.newContext(); | ||
context.newPage(); | ||
|
||
context.close(); | ||
browser.close(); | ||
} | ||
``` | ||
|
||
</CodeGroup> |
32 changes: 32 additions & 0 deletions
32
src/data/markdown/docs/30 xk6-browser/01 xk6-browser/01 Browser/contexts.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,32 @@ | ||
--- | ||
title: 'contexts()' | ||
excerpt: 'xk6-browser: Browser.contexts method' | ||
--- | ||
|
||
Allows you to access all open [BrowserContext](/javascript-api/xk6-browser/browsercontext/)s. | ||
|
||
### Returns | ||
|
||
| Type | Description | | ||
| ----- | ------------------------------------------------------------------------------ | | ||
| Array | Array of [BrowserContext](/javascript-api/xk6-browser/browsercontext/) objects | | ||
|
||
|
||
### Example | ||
|
||
<!-- eslint-skip --> | ||
|
||
```javascript | ||
import { chromium } from 'k6/x/browser'; | ||
|
||
export default function () { | ||
const browser = chromium.launch(); | ||
console.log(browser.contexts().length); // 0 | ||
|
||
const context = browser.newContext(); | ||
console.log(browser.contexts().length); // 1 | ||
|
||
context.close(); | ||
browser.close(); | ||
} | ||
``` |
37 changes: 37 additions & 0 deletions
37
src/data/markdown/docs/30 xk6-browser/01 xk6-browser/01 Browser/isconnected.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,37 @@ | ||
--- | ||
title: 'isConnected()' | ||
excerpt: 'xk6-browser: Browser.isConnected method' | ||
--- | ||
|
||
<Blockquote mod="warning"> | ||
|
||
There is a known issue with this feature. See [issue #453](/~https://github.com/grafana/xk6-browser/issues/453) for details. | ||
|
||
</Blockquote> | ||
|
||
Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. | ||
|
||
### Returns | ||
|
||
| Type | Description | | ||
| ------- | ---------------------------------------------------------------------------------------------- | | ||
| boolean | Returns `true` if [Browser](/javascript-api/xk6-browser/browser/) is connected to the browser application. Otherwise, returns `false`. | | ||
|
||
|
||
### Example | ||
|
||
<CodeGroup labels={[]}> | ||
|
||
```javascript | ||
import { chromium } from 'k6/x/browser'; | ||
|
||
export default function () { | ||
const browser = chromium.launch(); | ||
const isConnected = browser.isConnected(); | ||
console.log(isConnected); // true | ||
|
||
browser.close(); | ||
} | ||
``` | ||
|
||
</CodeGroup> |
Oops, something went wrong.