Skip to content

Commit

Permalink
Add canonicalUrl to point to grafana.com/docs/k6 pages (#1429)
Browse files Browse the repository at this point in the history
* Set `canonicalUrl` for non-markdown pages

* Update canonicalUrl for non-markdown pages

* prepare `canonicalURLs` for `translated-guides/en`

* Update canonicalUrl for translated-guides section

* Update canonicalUrl for xk6-disruptor

* prepare `canonicalURLs` option on `javascript api` folders

* prepare `canonicalURLs` option on `Examples` and `Extensions` folders

* prepare `canonicalURLs` option on `jslib` and `xk6-disruptor` folders

* Update canonicalUrls for examples section

* Update canonicalUrls for extensions section

* Update canonicalUrls for xk6-disruptor section

* Update canonicalUrls for root js api pages

* Update canonicalUrl for js-api 1

* Update canonicalUrl for js-api 2

* Update canonicalUrl for jslib section

* Fix  jack's script findings

---------

Co-authored-by: Pepe Cano <[email protected]>
  • Loading branch information
heitortsergent and ppcano authored Dec 6, 2023
1 parent ce67136 commit 5c78be1
Show file tree
Hide file tree
Showing 568 changed files with 591 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Init context"
excerpt: 'The init context (aka "init code") is code in the global context that has access to a few functions not accessible during main script execution.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/init-context/
---

Before the k6 starts the test logic, code in the _init context_ prepares the script.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ head_title: 'JavaScript API: open'
title: 'open( filePath, [mode] )'
description: 'Opens a file and reads all the contents into memory.'
excerpt: 'Opens a file and reads all the contents into memory.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/init-context/open/
---

Opens a file, reading all its contents into memory for use in the script.
Expand Down
1 change: 1 addition & 0 deletions src/data/markdown/docs/02 javascript api/02 k6.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'k6'
excerpt: 'The k6 module contains k6-specific functionality.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/
---

The k6 module contains k6-specific functionality.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'check( val, sets, [tags] )'
description: 'Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure.'
excerpt: 'Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/check/
---

Run checks on a value. A check is a test condition that can give a truthy or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'fail( [err] )'
description: 'Throws an error, failing and aborting the current VU script iteration immediately.'
excerpt: 'Throws an error, failing and aborting the current VU script iteration immediately.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/fail/
---

Immediately throw an error, aborting the current iteration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'group( name, fn )'
description: 'Runs code inside a group. Used to organize results in a test.'
excerpt: 'Runs code inside a group. Used to organize results in a test.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/group/
---

Run code inside a group. Groups are used to organize results in a test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'randomSeed( int )'
description: 'Set seed to get a reproducible pseudo-random number using `Math.random`.'
excerpt: 'Set seed to get a reproducible pseudo-random number using `Math.random`.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/randomseed/
---

Set seed to get a reproducible pseudo-random number using `Math.random`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'sleep( t )'
description: 'Suspends VU execution for the specified duration.'
excerpt: 'Suspends VU execution for the specified duration.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/sleep/
---

Suspend VU execution for the specified duration.
Expand Down
1 change: 1 addition & 0 deletions src/data/markdown/docs/02 javascript api/03 k6-crypto.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "k6/crypto"
excerpt: "The k6/crypto module provides common hashing functionality available in the GoLang crypto."
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'createHash( algorithm )'
description: 'Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
excerpt: 'Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/createhash/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'createHMAC( algorithm, secret )'
description: 'Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
excerpt: 'Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/createhmac/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'hmac( algorithm, secret, data, outputEncoding )'
description: 'Use HMAC to sign input data.'
excerpt: 'Use HMAC to sign input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/hmac/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'md4( input, outputEncoding )'
description: 'Use MD4 to hash input data.'
excerpt: 'Use MD4 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/md4/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'md5( input, outputEncoding )'
description: 'Use MD5 to hash input data.'
excerpt: 'Use MD5 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/md5/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'randomBytes( int )'
description: 'randomBytes.'
excerpt: 'randomBytes.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/randombytes/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'ripemd160( input, outputEncoding )'
description: 'Use RIPEMD-160 to hash input data.'
excerpt: 'Use RIPEMD-160 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/ripemd160/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'sha1( input, outputEncoding )'
description: 'Use SHA-1 to hash input data.'
excerpt: 'Use SHA-1 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha1/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'sha256( input, outputEncoding )'
description: 'Use SHA-256 to hash input data.'
excerpt: 'Use SHA-256 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha256/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'sha384( input, outputEncoding )'
description: 'Use SHA-384 to hash input data.'
excerpt: 'Use SHA-384 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha384/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'sha512( input, outputEncoding )'
description: 'Use SHA-512 to hash input data.'
excerpt: 'Use SHA-512 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'sha512_256( input, outputEncoding )'
description: 'Use SHA-512/256 to hash input data.'
excerpt: 'Use SHA-512/256 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512_256/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'sha512_224( input, outputEncoding )'
description: 'Use SHA-512/224 to hash input data.'
excerpt: 'Use SHA-512/224 to hash input data.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512_224/
---

<CryptoBlockquote />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'Hasher'
description: 'Object returned by crypto.createHash(). It allows adding more data to be hashed and to extract digests along the way.'
excerpt: 'Object returned by crypto.createHash(). It allows adding more data to be hashed and to extract digests along the way.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/hasher/
---

<CryptoBlockquote />
Expand Down
1 change: 1 addition & 0 deletions src/data/markdown/docs/02 javascript api/04 k6-data.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "k6/data"
excerpt: "k6 data API"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-data/
---

The data module provides helpers to work with data.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: SharedArray
excerpt: 'SharedArray is an array-like object that shares the underlying memory between VUs.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-data/sharedarray/
---

`SharedArray` is an array-like object that shares the underlying memory between VUs.
Expand Down
1 change: 1 addition & 0 deletions src/data/markdown/docs/02 javascript api/05 k6-encoding.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "k6/encoding"
excerpt: 'The encoding module provides base64 encoding/decoding as defined by RFC4648.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/
---
The encoding module provides [base64](https://en.wikipedia.org/wiki/Base64)
encoding/decoding as defined by [RFC4648](https://tools.ietf.org/html/rfc4648).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'b64decode( input, [encoding], [format] )'
description: 'Base64 decode a string.'
excerpt: 'Base64 decode a string.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
---

Decode the passed base64 encoded `input` string into the unencoded original input in either binary or string formats.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 'b64encode( input, [encoding] )'
description: 'Encode data in base64.'
excerpt: 'Encode data in base64.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64encode/
---

| Parameter | Type | Description |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "k6/execution"
excerpt: "Get information about the current test's execution state."
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-execution/
---

`k6/execution` provides the capability to get information about the current test execution state inside the test script. You can read in your script the execution state during the test execution and change your script logic based on the current state.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "k6/experimental"
excerpt: "k6 experimental APIs"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/
---

<ExperimentalBlockquote />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'browser'
excerpt: 'An overview of the browser-level APIs from browser module.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/
---

<ExperimentalBlockquote />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "BrowserContext"
excerpt: "Browser module: BrowserContext Class"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/
---

`BrowserContext`s provide a way to operate multiple independent sessions, with separate pages, cache, and cookies. A default `BrowserContext` is created when a browser is launched.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'addCookies()'
excerpt: 'Clears context cookies.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/addcookies/
---

Adds a list of [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) into the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/cookie). All pages within this [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/cookie) will have these [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) set.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'clearCookies()'
excerpt: 'Clears context cookies.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/clearcookies/
---

Clears the `BrowserContext`'s cookies.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'clearPermissions()'
excerpt: 'Clears all permission overrides for the BrowserContext.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/clearpermissions/
---

<Blockquote mod="attention">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'close()'
excerpt: 'Close the BrowserContext and all its pages.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/close/
---

Close the `BrowserContext` and all its [page](/javascript-api/k6-experimental/browser/page/)s. The `BrowserContext` is unusable after this call and a new one must be created. This is typically called to cleanup before ending the test.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Cookie"
excerpt: "Browser module: Cookie Class"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/cookie/
---

Cookie class represents a cookie in the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'cookies([urls])'
excerpt: 'Retrieves context cookies.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'grantPermissions(permissions[, options])'
excerpt: 'Grants specified permissions to the BrowserContext.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/grantpermissions/
---

Grants specified permissions to the `BrowserContext`. Only grants corresponding permissions to the given origin if specified.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'newPage()'
excerpt: 'Creates a new page inside this BrowserContext.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/newpage/
---

Uses the `BrowserContext` to create a new [Page](/javascript-api/k6-experimental/browser/page/) and returns it.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'pages()'
excerpt: 'Returns a list of pages inside this BrowserContext.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/pages/
---

<Blockquote mod="attention">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'setDefaultNavigationTimeout(timeout)'
excerpt: 'Sets the default navigation timeout in milliseconds.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout/
---

Sets the default maximum navigation timeout for [Page.goto()](https://playwright.dev/docs/api/class-page#page-goto).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'setDefaultTimeout(timeout)'
excerpt: 'Sets the default timeout in milliseconds.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout/
---

Sets the default maximum timeout for all methods accepting a `timeout` option in milliseconds.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'setGeolocation(geolocation)'
excerpt: "Sets the BrowserContext's geolocation."
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/setgeolocation/
---

<Blockquote mod="attention">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'setOffline(offline)'
excerpt: "Toggles the BrowserContext's connectivity on/off."
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/setoffline/
---

Toggles the `BrowserContext`'s connectivity on/off.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'waitForEvent(event[, optionsOrPredicate])'
excerpt: 'Waits for event to fire and passes its value into the predicate function.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/browsercontext/waitforevent/
---

<Blockquote mod="attention">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "ConsoleMessage"
excerpt: "Browser module: ConsoleMessage Class"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/consolemessage/
---

<BrowserDocsWIP/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "ElementHandle"
excerpt: "Browser module: ElementHandle Class"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/elementhandle/
---

<BrowserDocsWIP/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Frame"
excerpt: "Browser module: Frame Class"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/frame/
---

<BrowserDocsWIP/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "JSHandle"
excerpt: "Browser module: JSHandle Class"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/jshandle/
---

<BrowserDocsWIP/>
Expand Down
Loading

0 comments on commit 5c78be1

Please sign in to comment.