Skip to content

Commit 8d6f0f4

Browse files
committed
Add before after env vars
1 parent 43ad07f commit 8d6f0f4

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/data/markdown/translated-guides/en/03 Using k6 browser/04 Migrating to k6 v0-46.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ import { browser } from 'k6/experimental/browser';
119119

120120
## Browser options
121121

122-
In the updated version, the need to manually start a browser and set its configuration has been removed, and this part can simply be omitted from test scripts.
122+
In the updated version, the need to manually start a browser and set its configuration has been removed, and this part can simply be omitted from test scripts. Users can still change some browser settings by using environment variables. For more information, refer to the [browser module options](/javascript-api/k6-experimental/browser/#browser-module-options) documentation.
123123

124-
Users can still change some browser settings by using environment variables. For more information, refer to the [browser module options](/javascript-api/k6-experimental/browser/#browser-module-options) documentation.
124+
### Before:
125125

126-
127-
<CodeGroup labels={["Before"]} lineNumbers={[true]}>
126+
<CodeGroup lineNumbers={[true]}>
128127

129128
<!-- eslint-skip -->
130129

@@ -139,6 +138,31 @@ export default async function () {
139138

140139
</CodeGroup>
141140

141+
### After:
142+
143+
<CodeGroup labels={["Bash", "Docker", "Windows: CMD", "Windows: PowerShell"]} lineNumbers={[false]}>
144+
145+
```bash
146+
$ K6_BROWSER_HEADLESS=false K6_BROWSER_TIMEOUT='60s' k6 run script.js
147+
```
148+
149+
```bash
150+
# When using the `k6:master-with-browser` Docker image, you need to add `--cap-add=SYS_ADMIN`
151+
# to grant further system permissions on the host for the Docker container.
152+
docker run --rm -i --cap-add=SYS_ADMIN -e K6_BROWSER_HEADLESS=false -e K6_BROWSER_TIMEOUT='60s' grafana/k6:master-with-browser run - <script.js
153+
```
154+
155+
```bash
156+
C:\k6> set "K6_BROWSER_HEADLESS=false" && set "K6_BROWSER_TIMEOUT='60s' " && k6 run script.js
157+
```
158+
159+
```bash
160+
PS C:\k6> $env:K6_BROWSER_HEADLESS="false" ; $env:K6_BROWSER_TIMEOUT='60s' ; k6 run script.js
161+
```
162+
163+
</CodeGroup>
164+
165+
142166
<Blockquote mod="note" title="">
143167

144168
The following browser options are no longer supported: `slowMo`, `devtools`, `env`, and `proxy` as they were not proving much value to our users. In the meantime, we're working on providing a much flexible version of `slowMo` (slow motion) option.

0 commit comments

Comments
 (0)