Skip to content

Commit e3e4bf9

Browse files
committed
Move lifecycle explanations
1 parent a4c2804 commit e3e4bf9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,8 @@ The following browser options are no longer supported: `slowMo`, `devtools`, `en
174174

175175
## Scenario options
176176

177-
In the new update, 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.
177+
In the new version, 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.
178178

179-
This change helps identify the test as a browser test and allows 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.
180179

181180
<CodeGroup labels={["After"]} lineNumbers={[true]}>
182181

@@ -199,7 +198,11 @@ export const options = {
199198

200199
</CodeGroup>
201200

201+
Previously, users were required to handle the creation and closing of the browser instance using methods like `chromium.launch()` and `chromium.connect()` for creation, and the `browser.close()` method for releasing resources before ending the iteration. This repetitive code has been eliminated.
202+
203+
Now, all that is needed is to specify the browser type within the [scenario options](#scenario-options). A browser instance will be automatically created and closed for each iteration by the browser module, streamlining the process.
202204

205+
This change helps identify the test as a browser test and allows 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.
203206

204207

205208
## Opening a new page
@@ -232,10 +235,6 @@ Closing of the page is critical for the calculation of accurate Web Vital metric
232235

233236
As [mentioned earlier](#scenario-options), in the new API, there's a shift in how the browser's lifecycle is managed.
234237

235-
Previously, users were required to handle the creation and closing of the browser instance using methods like `chromium.launch()` and `chromium.connect()` for creation, and the `browser.close()` method for releasing resources before ending the iteration.
236-
237-
This repetitive code has been eliminated. Now, all that is needed is to specify the browser type within the [scenario options](#scenario-options). A browser instance will be automatically created and closed for each iteration, streamlining the process.
238-
239238
Since the browser lifecycle is automatically managed by the browser module, the closing of the browser has been simplified. The explicit `browser.close()` call has been removed. Simply close the page using the [page.close()](/javascript-api/k6-experimental/browser/page/close/) method as in the example below.
240239

241240
<CodeGroup labels={["Before"]} lineNumbers={[true]}>

0 commit comments

Comments
 (0)