Skip to content

Commit f4d2f5c

Browse files
Remove whitespace
1 parent 376d2af commit f4d2f5c

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Users no longer need to use the `K6_BROWSER_ENABLED` flag when running browser t
1616

1717
</Blockquote>
1818

19-
2019
## Before and after comparison
2120

2221
Let's start with an overview of the primary differences between the previous and new versions of the k6 browser API. Subsequent sections will delve into each difference in detail.
@@ -77,7 +76,6 @@ export default async function () {
7776

7877
</CodeGroup>
7978

80-
8179
## Key changes
8280

8381
The updated version introduces notable structural changes in its operation and API. Let's take a look at them.
@@ -88,9 +86,6 @@ The updated version introduces notable structural changes in its operation and A
8886
* [Simplified resource management](#simplified-resource-management). The browser module now handles the startup and shutdown of browser processes automatically. `chromium.launch()`, `chromium.connect()`, and `browser.close()` methods are no longer necessary, as these methods have been removed.
8987
* [Single browser context per iteration](#browser-context-limit). Users can now only run a single [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) at a time in the same iteration.
9088

91-
92-
93-
9489
## Import path
9590

9691
Changes have been made to how the [browser module](/javascript-api/k6-experimental/browser/) is imported. With the browser type (specifically `chromium`) now set in [scenario options](#scenario-options), users should directly import the [browser](/javascript-api/k6-experimental/browser/#browser-module-api) object from the [browser module](/javascript-api/k6-experimental/browser/). Previously, users relied on `chromium.launch()` for accessing a running browser. Now, a simple import of the [browser](/javascript-api/k6-experimental/browser/#browser-module-api) is sufficient.
@@ -111,10 +106,6 @@ import { browser } from 'k6/experimental/browser';
111106

112107
</CodeGroup>
113108

114-
115-
116-
117-
118109
## Browser options
119110

120111
In k6 v0.46.0, the need to manually start a browser via `chromium.launch()` or `chromium.connect()` and set its configuration through these methods has been removed, so 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.
@@ -160,21 +151,16 @@ PS C:\k6> $env:K6_BROWSER_HEADLESS="false" ; $env:K6_BROWSER_TIMEOUT='60s' ; k6
160151

161152
</CodeGroup>
162153

163-
164154
<Blockquote mod="note" title="">
165155

166156
The following browser options are no longer supported: `devtools`, `env`, and `proxy` since they weren't providing much value. Although `slowMo` has been temporarily removed, we're working on reintroducing it.
167157

168158
</Blockquote>
169159

170-
171-
172-
173160
## Scenario options
174161

175162
In k6 v0.46.0, users must set the [executor](/using-k6/scenarios/executors/) and browser type as options in a [k6 scenario](/using-k6/scenarios/) definition. Specifically, the `browser.type` option should be set to `chromium`, as Chromium is the only browser supported.
176163

177-
178164
<CodeGroup labels={["After"]} lineNumbers={[true]}>
179165

180166
<!-- eslint-skip -->
@@ -202,7 +188,6 @@ Now, all that is needed is to specify the browser type within the [scenario opti
202188

203189
This change allows to identify the test as a browser test and provides automatic control of the browser's lifecycle. Users no longer need to start or stop the browser manually through the browser API. If the `browser.type` option is set in the scenario options, a browser instance will automatically start at the beginning and close at the end of each test iteration.
204190

205-
206191
## Opening a new page
207192

208193
Users can open a new page by using the imported [browser](/javascript-api/k6-experimental/browser/#browser-module-api) object's [browser.newPage()](/javascript-api/k6-experimental/browser/newpage) method. Users can still use the [Page](/javascript-api/k6-experimental/browser/page/) object as before.
@@ -226,9 +211,6 @@ Closing of the page is critical for the calculation of accurate Web Vital metric
226211

227212
</Blockquote>
228213

229-
230-
231-
232214
## Simplified resource management
233215

234216
As [mentioned earlier](#scenario-options), in the new API, there's a shift in how the browser's lifecycle is managed.
@@ -256,9 +238,6 @@ page.close();
256238

257239
</CodeGroup>
258240

259-
260-
261-
262241
## Browser context limit
263242

264243
The new browser implementation limits the usage to a single active [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) per iteration. This change enhances the prediction of resource requirements for a test run and promotes the use of [scenarios](/using-k6/scenarios/) to separate independent browser sessions.
@@ -302,7 +281,6 @@ export default async function() {
302281

303282
</CodeGroup>
304283

305-
306284
These updates make the usage of our API more straightforward for users, aiding in more consistent and automatic resource management.
307285

308286
For all the details, make sure to review the complete changelog for [k6 version 0.46](https://github.com/grafana/k6/releases/tag/v0.46.0). For more information watch [k6 Office Hours #98](https://www.youtube.com/watch?v=fK6Hpvt0pY0), where we discuss the latest changes in k6 browser, and, as always, ask in [the community forum](https://community.grafana.com/c/grafana-k6/k6-browser/79) if you need our help!

0 commit comments

Comments
 (0)