From 083aae1ceaab72736c1559ae4e4dbb3e995256e4 Mon Sep 17 00:00:00 2001 From: Heitor Tashiro Sergent Date: Fri, 29 Dec 2023 13:17:46 -0600 Subject: [PATCH 01/11] chore: update prettier parser to markdown --- docs/sources/.prettierrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/.prettierrc b/docs/sources/.prettierrc index 8dc922102b..cd85d92684 100644 --- a/docs/sources/.prettierrc +++ b/docs/sources/.prettierrc @@ -7,7 +7,7 @@ { "files": ["**/*.md"], "options": { - "parser": "babel" + "parser": "markdown" } } ] From 581adab56a9bc4a4d4d41d48aa5648f8aec0c335 Mon Sep 17 00:00:00 2001 From: Heitor Tashiro Sergent Date: Fri, 29 Dec 2023 13:32:09 -0600 Subject: [PATCH 02/11] chore: run prettier on next folder --- .../next/examples/api-crud-operations.md | 6 +- .../examples/correlation-and-dynamic-data.md | 2 +- docs/sources/next/examples/data-uploads.md | 6 +- .../next/examples/distribute-workloads.md | 4 +- .../examples/get-started-with-k6/_index.md | 4 +- .../get-started-with-k6/analyze-results.md | 90 ++--- .../reuse-and-re-run-tests.md | 338 +++++++++--------- .../test-for-functional-behavior.md | 4 +- .../test-for-performance.md | 2 +- .../next/examples/http-authentication.md | 9 +- docs/sources/next/examples/parse-html.md | 4 +- docs/sources/next/examples/soap.md | 10 +- .../next/examples/tracking-data-per.md | 2 +- docs/sources/next/extensions/_index.md | 6 +- .../build-k6-binary-using-docker.md | 6 +- .../extensions/build-k6-binary-using-go.md | 2 +- docs/sources/next/extensions/create/_index.md | 2 +- .../create/javascript-extensions.md | 14 +- .../extensions/create/output-extensions.md | 2 +- .../explanations/extension-graduation.md | 4 +- .../explanations/extensions-registry.md | 2 +- .../next/get-started/results-output.md | 2 +- .../javascript-api/init-context/_index.md | 6 +- .../next/javascript-api/jslib/_index.md | 8 +- .../jslib/aws/EventBridgeClient/_index.md | 4 +- .../next/javascript-api/jslib/httpx/_index.md | 36 +- .../javascript-api/jslib/httpx/addheaders.md | 2 +- .../jslib/httpx/asyncrequest.md | 16 +- .../next/javascript-api/jslib/httpx/batch.md | 4 +- .../next/javascript-api/jslib/httpx/delete.md | 14 +- .../next/javascript-api/jslib/httpx/get.md | 14 +- .../next/javascript-api/jslib/httpx/head.md | 14 +- .../javascript-api/jslib/httpx/options.md | 14 +- .../next/javascript-api/jslib/httpx/patch.md | 14 +- .../next/javascript-api/jslib/httpx/post.md | 14 +- .../next/javascript-api/jslib/httpx/put.md | 14 +- .../javascript-api/jslib/httpx/request.md | 16 +- .../next/javascript-api/jslib/httpx/trace.md | 14 +- .../javascript-api/jslib/k6chaijs/_index.md | 8 +- .../next/javascript-api/jslib/utils/_index.md | 26 +- .../javascript-api/jslib/utils/findbetween.md | 10 +- .../next/javascript-api/k6-crypto/_index.md | 12 +- .../javascript-api/k6-crypto/createhash.md | 4 +- .../javascript-api/k6-crypto/createhmac.md | 4 +- .../next/javascript-api/k6-data/_index.md | 8 +- .../javascript-api/k6-data/sharedarray.md | 2 +- .../next/javascript-api/k6-encoding/_index.md | 6 +- .../next/javascript-api/k6-execution.md | 22 +- .../k6-experimental/browser/_index.md | 16 +- .../browser/browsercontext/_index.md | 18 +- .../browser/browsercontext/addcookies.md | 2 +- .../browser/browsercontext/cookies.md | 10 +- .../browser/browsercontext/newpage.md | 4 +- .../browser/browsercontext/pages.md | 2 +- .../browser/browsercontext/setgeolocation.md | 2 +- .../browser/browsercontext/waitforevent.md | 43 +-- .../k6-experimental/browser/closecontext.md | 5 +- .../k6-experimental/browser/context.md | 6 +- .../k6-experimental/browser/isconnected.md | 6 +- .../k6-experimental/browser/locator/_index.md | 4 +- .../k6-experimental/browser/locator/check.md | 20 +- .../k6-experimental/browser/locator/click.md | 28 +- .../browser/locator/dblclick.md | 26 +- .../k6-experimental/browser/locator/fill.md | 12 +- .../k6-experimental/browser/locator/focus.md | 6 +- .../browser/locator/getattribute.md | 8 +- .../k6-experimental/browser/locator/hover.md | 22 +- .../browser/locator/innerhtml.md | 6 +- .../browser/locator/innertext.md | 6 +- .../browser/locator/inputvalue.md | 6 +- .../browser/locator/ischecked.md | 6 +- .../browser/locator/isdisabled.md | 6 +- .../browser/locator/iseditable.md | 6 +- .../browser/locator/isenabled.md | 6 +- .../browser/locator/ishidden.md | 6 +- .../browser/locator/isvisible.md | 6 +- .../k6-experimental/browser/locator/press.md | 12 +- .../browser/locator/selectoption.md | 14 +- .../k6-experimental/browser/locator/tap.md | 22 +- .../browser/locator/textcontent.md | 6 +- .../k6-experimental/browser/locator/type.md | 12 +- .../browser/locator/uncheck.md | 20 +- .../browser/locator/waitfor.md | 10 +- .../k6-experimental/browser/newcontext.md | 64 ++-- .../k6-experimental/browser/newpage.md | 66 ++-- .../k6-experimental/browser/page/_index.md | 130 +++---- .../k6-experimental/browser/page/check.md | 24 +- .../k6-experimental/browser/page/click.md | 32 +- .../k6-experimental/browser/page/context.md | 4 +- .../k6-experimental/browser/page/dblclick.md | 30 +- .../browser/page/dispatchevent.md | 16 +- .../k6-experimental/browser/page/dollar.md | 6 +- .../browser/page/doubledollar.md | 6 +- .../browser/page/evaluatehandle.md | 4 +- .../k6-experimental/browser/page/fill.md | 18 +- .../k6-experimental/browser/page/focus.md | 12 +- .../k6-experimental/browser/page/frames.md | 4 +- .../browser/page/getattribute.md | 14 +- .../k6-experimental/browser/page/goto.md | 20 +- .../k6-experimental/browser/page/hover.md | 26 +- .../k6-experimental/browser/page/innerhtml.md | 12 +- .../k6-experimental/browser/page/innertext.md | 12 +- .../browser/page/inputvalue.md | 12 +- .../k6-experimental/browser/page/ischecked.md | 12 +- .../k6-experimental/browser/page/isclosed.md | 2 +- .../browser/page/isdisabled.md | 12 +- .../browser/page/iseditable.md | 12 +- .../k6-experimental/browser/page/isenabled.md | 12 +- .../k6-experimental/browser/page/ishidden.md | 12 +- .../k6-experimental/browser/page/isvisible.md | 12 +- .../k6-experimental/browser/page/keyboard.md | 4 +- .../k6-experimental/browser/page/locator.md | 4 +- .../k6-experimental/browser/page/mainframe.md | 4 +- .../k6-experimental/browser/page/mouse.md | 4 +- .../k6-experimental/browser/page/on.md | 9 +- .../k6-experimental/browser/page/opener.md | 4 +- .../k6-experimental/browser/page/press.md | 18 +- .../k6-experimental/browser/page/reload.md | 16 +- .../browser/page/selectoption.md | 18 +- .../browser/page/setcontent.md | 10 +- .../k6-experimental/browser/page/tap.md | 26 +- .../browser/page/textcontent.md | 12 +- .../browser/page/throttlecpu.md | 2 +- .../browser/page/throttlenetwork.md | 4 +- .../browser/page/touchscreen.md | 4 +- .../k6-experimental/browser/page/type.md | 18 +- .../k6-experimental/browser/page/uncheck.md | 24 +- .../browser/page/waitforfunction.md | 16 +- .../browser/page/waitforloadstate.md | 14 +- .../browser/page/waitfornavigation.md | 16 +- .../browser/page/waitforselector.md | 18 +- .../browser/page/waitfortimeout.md | 2 +- .../k6-experimental/browser/page/workers.md | 4 +- .../k6-experimental/browser/request/_index.md | 2 +- .../k6-experimental/browser/response.md | 34 +- .../k6-experimental/fs/file/_index.md | 10 +- .../k6-experimental/grpc/_index.md | 26 +- .../k6-experimental/grpc/client/_index.md | 14 +- .../grpc/client/client-invoke.md | 6 +- .../k6-experimental/grpc/response.md | 12 +- .../k6-experimental/grpc/stream/_index.md | 6 +- .../k6-experimental/grpc/stream/stream-on.md | 8 +- .../k6-experimental/redis/_index.md | 6 +- .../k6-experimental/redis/redis-options.md | 62 ++-- .../k6-experimental/tracing/_index.md | 4 +- .../k6-experimental/tracing/client.md | 8 +- .../k6-experimental/tracing/instrumenthttp.md | 4 +- .../k6-experimental/webcrypto/_index.md | 13 +- .../webcrypto/crypto/_index.md | 16 +- .../webcrypto/subtlecrypto/_index.md | 9 +- .../webcrypto/subtlecrypto/decrypt.md | 13 +- .../webcrypto/subtlecrypto/encrypt.md | 15 +- .../webcrypto/subtlecrypto/exportkey.md | 11 +- .../webcrypto/subtlecrypto/generatekey.md | 8 +- .../webcrypto/subtlecrypto/importkey.md | 17 +- .../webcrypto/subtlecrypto/sign.md | 8 +- .../webcrypto/subtlecrypto/verify.md | 10 +- .../k6-experimental/websockets/_index.md | 16 +- .../k6-experimental/websockets/params.md | 12 +- .../websockets/websocket/_index.md | 8 +- .../websocket/websocket-addeventlistener.md | 14 +- .../next/javascript-api/k6-html/_index.md | 12 +- .../next/javascript-api/k6-html/element.md | 70 ++-- .../next/javascript-api/k6-html/parsehtml.md | 4 +- .../k6-html/selection/_index.md | 72 ++-- .../k6-html/selection/selection-children.md | 4 +- .../k6-html/selection/selection-closest.md | 4 +- .../k6-html/selection/selection-contents.md | 4 +- .../k6-html/selection/selection-eq.md | 4 +- .../k6-html/selection/selection-filter.md | 12 +- .../k6-html/selection/selection-find.md | 4 +- .../k6-html/selection/selection-first.md | 4 +- .../k6-html/selection/selection-has.md | 4 +- .../k6-html/selection/selection-is.md | 12 +- .../k6-html/selection/selection-last.md | 4 +- .../k6-html/selection/selection-next.md | 4 +- .../k6-html/selection/selection-nextall.md | 4 +- .../k6-html/selection/selection-nextuntil.md | 10 +- .../k6-html/selection/selection-not.md | 4 +- .../k6-html/selection/selection-parent.md | 4 +- .../k6-html/selection/selection-parents.md | 4 +- .../selection/selection-parentsuntil.md | 10 +- .../k6-html/selection/selection-prev.md | 4 +- .../k6-html/selection/selection-prevall.md | 4 +- .../k6-html/selection/selection-prevuntil.md | 10 +- .../k6-html/selection/selection-slice.md | 12 +- .../k6-html/selection/selection-toarray.md | 4 +- .../next/javascript-api/k6-http/_index.md | 36 +- .../javascript-api/k6-http/asyncrequest.md | 18 +- .../next/javascript-api/k6-http/batch.md | 14 +- .../next/javascript-api/k6-http/cookiejar.md | 4 +- .../k6-http/cookiejar/_index.md | 10 +- .../next/javascript-api/k6-http/del.md | 12 +- .../k6-http/expected-statuses.md | 4 +- .../next/javascript-api/k6-http/file.md | 4 +- .../next/javascript-api/k6-http/get.md | 12 +- .../next/javascript-api/k6-http/head.md | 12 +- .../next/javascript-api/k6-http/options.md | 14 +- .../next/javascript-api/k6-http/params.md | 26 +- .../next/javascript-api/k6-http/patch.md | 14 +- .../next/javascript-api/k6-http/post.md | 14 +- .../next/javascript-api/k6-http/put.md | 14 +- .../next/javascript-api/k6-http/request.md | 16 +- .../javascript-api/k6-http/response/_index.md | 76 ++-- .../response/response-clicklink---params.md | 8 +- .../k6-http/response/response-html.md | 4 +- .../response/response-submitform---params.md | 12 +- .../k6-http/set-response-callback.md | 4 +- .../next/javascript-api/k6-metrics/_index.md | 4 +- .../k6-metrics/counter/_index.md | 6 +- .../counter/counter-add-value---tags.md | 6 +- .../javascript-api/k6-metrics/gauge/_index.md | 4 +- .../gauge/gauge-add-value---tags.md | 6 +- .../javascript-api/k6-metrics/rate/_index.md | 4 +- .../k6-metrics/rate/rate-add-value---tags.md | 6 +- .../javascript-api/k6-metrics/trend/_index.md | 4 +- .../trend/trend-add-value---tags.md | 6 +- .../next/javascript-api/k6-net-grpc/_index.md | 22 +- .../k6-net-grpc/client/_index.md | 14 +- .../k6-net-grpc/client/client-invoke.md | 6 +- .../javascript-api/k6-net-grpc/response.md | 12 +- .../next/javascript-api/k6-ws/_index.md | 12 +- .../next/javascript-api/k6-ws/connect.md | 12 +- .../next/javascript-api/k6-ws/params.md | 12 +- .../javascript-api/k6-ws/socket/_index.md | 4 +- .../javascript-api/k6-ws/socket/socket-on.md | 14 +- docs/sources/next/javascript-api/k6/_index.md | 4 +- docs/sources/next/javascript-api/k6/group.md | 2 +- .../javascript-api/xk6-disruptor/_index.md | 4 +- .../xk6-disruptor/faults/grpc.md | 2 +- .../xk6-disruptor/faults/http.md | 2 +- docs/sources/next/misc/archive.md | 13 +- docs/sources/next/misc/fine-tuning-os.md | 4 +- docs/sources/next/misc/integrations.md | 2 +- .../next/results-output/end-of-test/_index.md | 4 +- .../next/results-output/grafana-dashboards.md | 8 +- .../real-time/amazon-cloudwatch.md | 2 +- .../next/results-output/real-time/datadog.md | 2 +- .../results-output/real-time/dynatrace.md | 2 +- .../results-output/real-time/elasticsearch.md | 2 +- .../real-time/grafana-cloud-prometheus.md | 2 +- .../next/results-output/real-time/netdata.md | 2 +- .../next/results-output/real-time/newrelic.md | 4 +- .../real-time/prometheus-remote-write.md | 12 +- .../next/results-output/real-time/statsd.md | 2 +- .../sources/next/shared/browser-module-wip.md | 2 +- docs/sources/next/shared/crypto-module.md | 2 +- .../next/shared/experimental-module.md | 2 +- docs/sources/next/shared/grpc-module.md | 2 +- docs/sources/next/shared/index.md | 2 +- docs/sources/next/shared/ws-module.md | 2 +- .../automated-performance-testing.md | 6 +- .../_index.md | 10 +- .../examples/_index.md | 2 +- .../inject-grpc-faults-into-service.md | 10 +- .../examples/inject-http-faults-into-pod.md | 14 +- .../first-steps.md | 23 +- .../requirements.md | 2 +- .../running-distributed-tests.md | 24 +- .../testing-guides/running-large-tests.md | 4 +- .../testing-guides/test-types/load-testing.md | 2 +- .../test-types/stress-testing.md | 2 +- docs/sources/next/using-k6-browser/_index.md | 2 +- docs/sources/next/using-k6-browser/metrics.md | 33 +- .../using-k6-browser/migrating-to-k6-v0-46.md | 6 +- .../hybrid-approach-to-performance.md | 82 +++-- .../selecting-elements.md | 2 +- .../using-k6-browser/running-browser-tests.md | 22 +- docs/sources/next/using-k6/checks.md | 5 +- .../using-k6/execution-context-variables.md | 4 +- docs/sources/next/using-k6/http-requests.md | 16 +- .../next/using-k6/k6-options/_index.md | 4 +- .../next/using-k6/k6-options/how-to.md | 16 +- .../using-k6/metrics/create-custom-metrics.md | 6 +- .../next/using-k6/metrics/reference.md | 20 +- docs/sources/next/using-k6/modules.md | 4 +- .../sources/next/using-k6/protocols/_index.md | 4 +- .../next/using-k6/protocols/ssl-tls/_index.md | 2 +- .../ssl-tls/ssl-tls-version-and-ciphers.md | 2 +- .../sources/next/using-k6/scenarios/_index.md | 12 +- .../using-k6/scenarios/advanced-examples.md | 2 +- .../using-k6/scenarios/concepts/_index.md | 6 +- .../using-k6/scenarios/executors/_index.md | 18 +- .../scenarios/executors/ramping-vus.md | 2 +- docs/sources/next/using-k6/tags-and-groups.md | 32 +- docs/sources/next/using-k6/test-lifecycle.md | 2 +- docs/sources/next/using-k6/thresholds.md | 18 +- 287 files changed, 1889 insertions(+), 1815 deletions(-) diff --git a/docs/sources/next/examples/api-crud-operations.md b/docs/sources/next/examples/api-crud-operations.md index e580bca992..0633988d98 100644 --- a/docs/sources/next/examples/api-crud-operations.md +++ b/docs/sources/next/examples/api-crud-operations.md @@ -154,7 +154,11 @@ export default (authToken) => { ```javascript import { describe, expect } from 'https://jslib.k6.io/k6chaijs/4.3.4.3/index.js'; import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js'; -import { randomIntBetween, randomItem, randomString } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; +import { + randomIntBetween, + randomItem, + randomString, +} from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; export const options = { // for the example, let's run only 1 VU with 1 iteration diff --git a/docs/sources/next/examples/correlation-and-dynamic-data.md b/docs/sources/next/examples/correlation-and-dynamic-data.md index 4ec449c2de..30ca08ec01 100644 --- a/docs/sources/next/examples/correlation-and-dynamic-data.md +++ b/docs/sources/next/examples/correlation-and-dynamic-data.md @@ -110,7 +110,7 @@ export default function () { **Relevant k6 APIs**: - [Selection.find(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-find) (the [jQuery Selector API](http://api.jquery.com/category/selectors/) -docs are also a good resource on what possible selector queries can be made) + docs are also a good resource on what possible selector queries can be made) - [Selection.attr(name)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-attr) ### Generic extraction of values/tokens diff --git a/docs/sources/next/examples/data-uploads.md b/docs/sources/next/examples/data-uploads.md index 81be230cf1..f4354347df 100644 --- a/docs/sources/next/examples/data-uploads.md +++ b/docs/sources/next/examples/data-uploads.md @@ -118,7 +118,11 @@ const txt = open('/path/to/text.txt'); export default function () { const fd = new FormData(); fd.append('someTextField', 'someValue'); - fd.append('aBinaryFile', { data: new Uint8Array(img1).buffer, filename: 'logo.png', content_type: 'image/png' }); + fd.append('aBinaryFile', { + data: new Uint8Array(img1).buffer, + filename: 'logo.png', + content_type: 'image/png', + }); fd.append('anotherTextField', 'anotherValue'); fd.append('images', http.file(img1, 'image1.png', 'image/png')); fd.append('images', http.file(img2, 'image2.jpg', 'image/jpeg')); diff --git a/docs/sources/next/examples/distribute-workloads.md b/docs/sources/next/examples/distribute-workloads.md index 868873334d..2dcf1a189d 100644 --- a/docs/sources/next/examples/distribute-workloads.md +++ b/docs/sources/next/examples/distribute-workloads.md @@ -19,7 +19,7 @@ To inspect the results for a certain behavior, you can [create a custom metric]( These techniques can create very complex configurations. However, more complexity creates more ambiguity in result interpretation - {{% /admonition %}} +{{% /admonition %}} ## Split logic across scenarios @@ -27,7 +27,7 @@ However, more complexity creates more ambiguity in result interpretation In this context, _workload_ refers to the traffic pattern simulated by a scenario. - {{% /admonition %}} +{{% /admonition %}} One way to distribute traffic is to use scenarios to schedule different workloads for different functions. diff --git a/docs/sources/next/examples/get-started-with-k6/_index.md b/docs/sources/next/examples/get-started-with-k6/_index.md index 8f18ddf199..3e8f7c81a3 100644 --- a/docs/sources/next/examples/get-started-with-k6/_index.md +++ b/docs/sources/next/examples/get-started-with-k6/_index.md @@ -38,8 +38,8 @@ The tutorial requires the following: ## Tutorials -| In this tutorial | Learn how to | -| ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | +| In this tutorial | Learn how to | +| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | [Test for functional behavior](https://grafana.com/docs/k6//examples/get-started-with-k6/test-for-functional-behavior) | Use k6 to script requests and evaluate that performance is correct | | [Test for performance](https://grafana.com/docs/k6//examples/get-started-with-k6/test-for-performance) | Use k6 to increase load and find faults | | [Analyze results](https://grafana.com/docs/k6//examples/get-started-with-k6/analyze-results) | Filter results and make custom metrics | diff --git a/docs/sources/next/examples/get-started-with-k6/analyze-results.md b/docs/sources/next/examples/get-started-with-k6/analyze-results.md index 6c259f6c69..e5bf0ea95f 100644 --- a/docs/sources/next/examples/get-started-with-k6/analyze-results.md +++ b/docs/sources/next/examples/get-started-with-k6/analyze-results.md @@ -75,6 +75,7 @@ jq '. | select(.type == "Point" and .data.tags.status == "200")' results.json Or calculate the aggregated value of any metric with any particular tags. {{< code >}} + ```average jq '. | select(.type == "Point" and .metric == "http_req_duration") | .data.value' results.json | jq -s 'add/length' ``` @@ -86,6 +87,7 @@ jq '. | select(.type == "Point" and .metric == "http_req_duration") | .data.valu ```max jq '. | select(.type == "Point" and .metric == "http_req_duration") | .data.value' results.json | jq -s max ``` + {{< /code >}} ## Apply custom tags @@ -132,7 +134,7 @@ export default function () { } ``` - {{< /code >}} +{{< /code >}} Run the test: @@ -193,8 +195,8 @@ export default function () { sleep(1); } ``` -{{< /code >}} +{{< /code >}} ### Add Group functions @@ -212,22 +214,22 @@ import { group, sleep } from 'k6'; const baseUrl = 'https://test.k6.io'; export default function () { -// visit some endpoints in one group -group('Contacts flow', function () { - http.get(`${baseUrl}/contacts.php`); - sleep(1); - // return to the home page - http.get(`${baseUrl}/`); - sleep(1); -}); + // visit some endpoints in one group + group('Contacts flow', function () { + http.get(`${baseUrl}/contacts.php`); + sleep(1); + // return to the home page + http.get(`${baseUrl}/`); + sleep(1); + }); -// Coinflip players in another group -group('Coinflip game', function () { - http.get(`${baseUrl}/flip_coin.php?bet=heads`); - sleep(1); - http.get(`${baseUrl}/flip_coin.php?bet=tails`); - sleep(1); -}); + // Coinflip players in another group + group('Coinflip game', function () { + http.get(`${baseUrl}/flip_coin.php?bet=heads`); + sleep(1); + http.get(`${baseUrl}/flip_coin.php?bet=tails`); + sleep(1); + }); } ``` @@ -279,35 +281,35 @@ const contactsLatency = new Trend('contacts_duration'); const coinflipLatency = new Trend('coinflip_duration'); export default function () { -// Put visits to contact page in one group -let res; -group('Contacts flow', function () { - // save response as variable - res = http.get(`${baseUrl}/contacts.php`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - - res = http.get(`${baseUrl}/`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); -}); + // Put visits to contact page in one group + let res; + group('Contacts flow', function () { + // save response as variable + res = http.get(`${baseUrl}/contacts.php`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + + res = http.get(`${baseUrl}/`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + }); -// Coinflip players in another group + // Coinflip players in another group -group('Coinflip game', function () { - // save response as variable - let res = http.get(`${baseUrl}/flip_coin.php?bet=heads`); - // add duration property to metric - coinflipLatency.add(res.timings.duration); - sleep(1); + group('Coinflip game', function () { + // save response as variable + let res = http.get(`${baseUrl}/flip_coin.php?bet=heads`); + // add duration property to metric + coinflipLatency.add(res.timings.duration); + sleep(1); - res = http.get(`${baseUrl}/flip_coin.php?bet=tails`); - // add duration property to metric - coinflipLatency.add(res.timings.duration); - sleep(1); -}); + res = http.get(`${baseUrl}/flip_coin.php?bet=tails`); + // add duration property to metric + coinflipLatency.add(res.timings.duration); + sleep(1); + }); } ``` @@ -329,6 +331,7 @@ contacts_duration..............: avg=125.76985 min=116.973 med=120.6735 max=200 You can also query custom metric results from the JSON results. For example, to get the aggregated results as. {{< code >}} + ```avg jq '. | select(.type == "Point" and .metric == "coinflip_duration") | .data.value' results.json | jq -s 'add/length' ``` @@ -340,6 +343,7 @@ jq '. | select(.type == "Point" and .metric == "coinflip_duration") | .data.valu ```max jq '. | select(.type == "Point" and .metric == "coinflip_duration") | .data.value' results.json | jq -s max ``` + {{< /code >}} ## Next steps diff --git a/docs/sources/next/examples/get-started-with-k6/reuse-and-re-run-tests.md b/docs/sources/next/examples/get-started-with-k6/reuse-and-re-run-tests.md index 048c43a22f..64e3859b21 100644 --- a/docs/sources/next/examples/get-started-with-k6/reuse-and-re-run-tests.md +++ b/docs/sources/next/examples/get-started-with-k6/reuse-and-re-run-tests.md @@ -136,121 +136,125 @@ As is, this script won't work, since it has undeclared functions and variables. 1. Finally, pass `baseUrl` as a parameter of the `contacts` function. - {{< code >}} - ```javascript - import http from 'k6/http'; - import { Trend } from 'k6/metrics'; - import { group, sleep } from 'k6'; - - const contactsLatency = new Trend('contact_duration'); - - export function contacts(baseUrl) { - group('Contacts flow', function () { - // save response as variable - let res = http.get(`${baseUrl}/contacts.php`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - - res = http.get(`${baseUrl}/`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - }); - } - ``` - {{< /code >}} +{{< code >}} + +```javascript +import http from 'k6/http'; +import { Trend } from 'k6/metrics'; +import { group, sleep } from 'k6'; + +const contactsLatency = new Trend('contact_duration'); + +export function contacts(baseUrl) { + group('Contacts flow', function () { + // save response as variable + let res = http.get(`${baseUrl}/contacts.php`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + + res = http.get(`${baseUrl}/`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + }); +} +``` + +{{< /code >}} 1. Repeat the process with the `coinflip` group in a file called `coinflip.js`. Use the tabs to see the final three files should (`options` moved to the bottom of `main.js` for better readability). - {{< code >}} - ```main - import { contacts } from './contacts.js'; - import { coinflip } from './coinflip.js'; - - const baseUrl = 'https://test.k6.io'; - - export default function () { - // Put visits to contact page in one group - contacts(baseUrl); - // Coinflip players in another group - coinflip(baseUrl); - } - - //define configuration - export const options = { - scenarios: { - //arbitrary name of scenario: - breaking: { - executor: 'ramping-vus', - stages: [ - { duration: '10s', target: 20 }, - { duration: '50s', target: 20 }, - { duration: '50s', target: 40 }, - { duration: '50s', target: 60 }, - { duration: '50s', target: 80 }, - { duration: '50s', target: 100 }, - { duration: '50s', target: 120 }, - { duration: '50s', target: 140 }, - //.... - ], - }, - }, - //define thresholds - thresholds: { - http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], // availability threshold for error rate - http_req_duration: ['p(99)<1000'], // Latency threshold for percentile +{{< code >}} + +```main +import { contacts } from './contacts.js'; +import { coinflip } from './coinflip.js'; + +const baseUrl = 'https://test.k6.io'; + +export default function () { + // Put visits to contact page in one group + contacts(baseUrl); + // Coinflip players in another group + coinflip(baseUrl); +} + +//define configuration +export const options = { + scenarios: { + //arbitrary name of scenario: + breaking: { + executor: 'ramping-vus', + stages: [ + { duration: '10s', target: 20 }, + { duration: '50s', target: 20 }, + { duration: '50s', target: 40 }, + { duration: '50s', target: 60 }, + { duration: '50s', target: 80 }, + { duration: '50s', target: 100 }, + { duration: '50s', target: 120 }, + { duration: '50s', target: 140 }, + //.... + ], }, - }; - ``` - - ```contacts - import http from 'k6/http'; - import { Trend } from 'k6/metrics'; - import { group, sleep } from 'k6'; - - const contactsLatency = new Trend('contact_duration'); - - export function contacts(baseUrl) { - group('Contacts flow', function () { - // save response as variable - let res = http.get(`${baseUrl}/contacts.php`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - - res = http.get(`${baseUrl}/`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - }); - } - ``` - - ```coinflip - import http from 'k6/http'; - import { Trend } from 'k6/metrics'; - import { group, sleep } from 'k6'; - - const coinflipLatency = new Trend('coinflip_duration'); - - export function coinflip(baseUrl) { - group('Coinflip game', function () { - // save response as variable - let res = http.get(`${baseUrl}/flip_coin.php?bet=heads`); - // add duration property to metric - coinflipLatency.add(res.timings.duration); - sleep(1); - // mutate for new request - res = http.get(`${baseUrl}/flip_coin.php?bet=tails`); - // add duration property to metric - coinflipLatency.add(res.timings.duration); - sleep(1); - }); - } - ``` - {{< /code >}} + }, + //define thresholds + thresholds: { + http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], // availability threshold for error rate + http_req_duration: ['p(99)<1000'], // Latency threshold for percentile + }, +}; +``` + +```contacts +import http from 'k6/http'; +import { Trend } from 'k6/metrics'; +import { group, sleep } from 'k6'; + +const contactsLatency = new Trend('contact_duration'); + +export function contacts(baseUrl) { + group('Contacts flow', function () { + // save response as variable + let res = http.get(`${baseUrl}/contacts.php`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + + res = http.get(`${baseUrl}/`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + }); +} +``` + +```coinflip +import http from 'k6/http'; +import { Trend } from 'k6/metrics'; +import { group, sleep } from 'k6'; + +const coinflipLatency = new Trend('coinflip_duration'); + +export function coinflip(baseUrl) { + group('Coinflip game', function () { + // save response as variable + let res = http.get(`${baseUrl}/flip_coin.php?bet=heads`); + // add duration property to metric + coinflipLatency.add(res.timings.duration); + sleep(1); + // mutate for new request + res = http.get(`${baseUrl}/flip_coin.php?bet=tails`); + // add duration property to metric + coinflipLatency.add(res.timings.duration); + sleep(1); + }); +} +``` + +{{< /code >}} Run the test: @@ -268,6 +272,7 @@ Now that the iteration code is totally modularized, you might modularize your `o The following example creates a module `config.js` to export the threshold and workload settings. {{< code >}} + ```main import { coinflip } from './coinflip.js'; import { contacts } from './contacts.js'; @@ -307,6 +312,7 @@ export const breakingWorkload = { ], }; ``` + {{< /code >}} Notice the length of this final script and compare it with the script at the beginning of this page. @@ -327,65 +333,69 @@ Change `main.js` and `config.js` so that it: To do this, follow these steps: 1. Add the workload settings for configuring the smoke test to `config.js`: - - {{< code >}} - - ```javascript - export const smokeWorkload = { - executor: 'shared-iterations', - iterations: 5, - vus: 1, - }; - - export const thresholdsSettings = { - http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], - http_req_duration: ['p(99)<1000'], - }; - - export const breakingWorkload = { - executor: 'ramping-vus', - stages: [ - { duration: '10s', target: 20 }, - { duration: '50s', target: 20 }, - { duration: '50s', target: 40 }, - { duration: '50s', target: 60 }, - { duration: '50s', target: 80 }, - { duration: '50s', target: 100 }, - { duration: '50s', target: 120 }, - { duration: '50s', target: 140 }, - //.... - ], - }; - ``` - {{< /code >}} + +{{< code >}} + +```javascript +export const smokeWorkload = { + executor: 'shared-iterations', + iterations: 5, + vus: 1, +}; + +export const thresholdsSettings = { + http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], + http_req_duration: ['p(99)<1000'], +}; + +export const breakingWorkload = { + executor: 'ramping-vus', + stages: [ + { duration: '10s', target: 20 }, + { duration: '50s', target: 20 }, + { duration: '50s', target: 40 }, + { duration: '50s', target: 60 }, + { duration: '50s', target: 80 }, + { duration: '50s', target: 100 }, + { duration: '50s', target: 120 }, + { duration: '50s', target: 140 }, + //.... + ], +}; +``` + +{{< /code >}} 2. Edit `main.js` to choose the workload settings depending on the `WORKLOAD` environment variable. For example: - {{< code >}} - ```javascript - import { coinflip } from './coinflip.js'; - import { contacts } from './contacts.js'; - import { thresholdsSettings, breakingWorkload, smokeWorkload } from './config.js'; +{{< code >}} + +```javascript +import { coinflip } from './coinflip.js'; +import { contacts } from './contacts.js'; +import { thresholdsSettings, breakingWorkload, smokeWorkload } from './config.js'; + +export const options = { + scenarios: { + my_scenario: __ENV.WORKLOAD === 'breaking' ? breakingWorkload : smokeWorkload, + }, + thresholds: thresholdsSettings, +}; + +const baseUrl = 'https://test.k6.io'; + +export default function () { + contacts(baseUrl); + coinflip(baseUrl); +} +``` + +{{< /code >}} - export const options = { - scenarios: { - my_scenario: __ENV.WORKLOAD === 'breaking' ? breakingWorkload : smokeWorkload, - }, - thresholds: thresholdsSettings, - }; - - const baseUrl = 'https://test.k6.io'; - - export default function () { - contacts(baseUrl); - coinflip(baseUrl); - } - ``` - {{< /code >}} - 3. Run the script with and without the `-e` flag. - - What happens when you run `k6 run main.js`? - - What about `k6 run main.js -e WORKLOAD=breaking`? + +- What happens when you run `k6 run main.js`? +- What about `k6 run main.js -e WORKLOAD=breaking`? This was a simple example to showcase how you can modularize a test. As your test suite grows and more people are involved in performance testing, your modularization strategy becomes essential to building and maintaining an efficient testing suite. diff --git a/docs/sources/next/examples/get-started-with-k6/test-for-functional-behavior.md b/docs/sources/next/examples/get-started-with-k6/test-for-functional-behavior.md index d3ac1aa300..953091b589 100644 --- a/docs/sources/next/examples/get-started-with-k6/test-for-functional-behavior.md +++ b/docs/sources/next/examples/get-started-with-k6/test-for-functional-behavior.md @@ -123,7 +123,7 @@ export default function () { } ``` - {{< /code >}} +{{< /code >}} 1. Run the script again. @@ -145,7 +145,7 @@ Under larger loads, this check will fail in some iterations. Rather, k6 tracks the success rate and presents it in your [end of test](https://grafana.com/docs/k6//results-output/end-of-test) summary. - {{% /admonition %}} +{{% /admonition %}} ## Next steps diff --git a/docs/sources/next/examples/get-started-with-k6/test-for-performance.md b/docs/sources/next/examples/get-started-with-k6/test-for-performance.md index 5e48cbba79..e65a26719c 100644 --- a/docs/sources/next/examples/get-started-with-k6/test-for-performance.md +++ b/docs/sources/next/examples/get-started-with-k6/test-for-performance.md @@ -111,7 +111,7 @@ Scenarios schedule load according to the number of VUs, number of iterations, VU ### Run a smoke test -Start small. Run a [smoke test](https://grafana.com/docs/k6//testing-guides/test-types/smoke-testing "a small test to confirm the script works properly") to check that your script can handle a minimal load. +Start small. Run a [smoke test](https://grafana.com/docs/k6//testing-guides/test-types/smoke-testing 'a small test to confirm the script works properly') to check that your script can handle a minimal load. To do so, use the [`--iterations`](https://grafana.com/docs/k6//using-k6/k6-options/reference#iterations) flag with an argument of 10 or fewer. diff --git a/docs/sources/next/examples/http-authentication.md b/docs/sources/next/examples/http-authentication.md index dba178a35f..cb409bc857 100644 --- a/docs/sources/next/examples/http-authentication.md +++ b/docs/sources/next/examples/http-authentication.md @@ -74,9 +74,12 @@ export default function () { // Passing username and password as part of URL plus the auth option will // authenticate using HTTP Digest authentication. const credentials = `${username}:${password}`; - const res = http.get(`https://${credentials}@httpbin.test.k6.io/digest-auth/auth/${username}/${password}`, { - auth: 'digest', - }); + const res = http.get( + `https://${credentials}@httpbin.test.k6.io/digest-auth/auth/${username}/${password}`, + { + auth: 'digest', + } + ); // Verify response (checking the echoed data from the httpbin.test.k6.io digest auth // test API endpoint) diff --git a/docs/sources/next/examples/parse-html.md b/docs/sources/next/examples/parse-html.md index dc8d5039b3..ca19fac3c5 100644 --- a/docs/sources/next/examples/parse-html.md +++ b/docs/sources/next/examples/parse-html.md @@ -8,8 +8,8 @@ weight: 06 Examples parsing HTML content. Use the `k6/html` module for HTML parsing. -| Name | Type | Description | -| ---------------------------------------------------------------------------- | -------- | ----------------------------------------------------- | +| Name | Type | Description | +| ------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | Class | A jQuery-like API for accessing HTML DOM elements. | | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | Class | An HTML DOM element as returned by the Selection API. | | [parseHTML(src)](https://grafana.com/docs/k6//javascript-api/k6-html/parsehtml) | function | Parse an HTML string and populate a Selection object. | diff --git a/docs/sources/next/examples/soap.md b/docs/sources/next/examples/soap.md index 20c29e2187..598b33c1e2 100644 --- a/docs/sources/next/examples/soap.md +++ b/docs/sources/next/examples/soap.md @@ -28,9 +28,13 @@ const soapReqBody = ` export default function () { // When making a SOAP POST request we must not forget to set the content type to text/xml - const res = http.post('http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx', soapReqBody, { - headers: { 'Content-Type': 'text/xml' }, - }); + const res = http.post( + 'http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx', + soapReqBody, + { + headers: { 'Content-Type': 'text/xml' }, + } + ); // Make sure the response is correct check(res, { diff --git a/docs/sources/next/examples/tracking-data-per.md b/docs/sources/next/examples/tracking-data-per.md index 51fdc1c05e..0e459d0c8a 100644 --- a/docs/sources/next/examples/tracking-data-per.md +++ b/docs/sources/next/examples/tracking-data-per.md @@ -33,7 +33,7 @@ export const options = { vus: 10, thresholds: { // We can setup thresholds on these custom metrics, "count" means bytes in this case. - endpoint_data_sent: ['count < 2048'], + 'endpoint_data_sent': ['count < 2048'], // The above threshold would look at all data points added to the custom metric. // If we want to only consider data points for a particular URL/endpoint we can filter by URL. diff --git a/docs/sources/next/extensions/_index.md b/docs/sources/next/extensions/_index.md index 4c5ed572b9..794d727e31 100644 --- a/docs/sources/next/extensions/_index.md +++ b/docs/sources/next/extensions/_index.md @@ -35,12 +35,12 @@ Currently, k6 supports two ways to extend its native functionality: - **Output extensions** send metrics to a custom file format or service. Add custom processing and dispatching. - ## xk6 makes custom binaries [xk6](https://github.com/grafana/xk6/) is command-line tool and framework written in Go. With xk6, you build custom k6 binaries that bundle one or more extensions written in Go. You have two options for creating k6 binaries: using [Go and xk6](https://grafana.com/docs/k6/latest/extensions/build-k6-binary-using-go/) or [Docker](https://grafana.com/docs/k6/latest/extensions/build-k6-binary-using-docker/): {{< code >}} + ```go-and-xk6 xk6 build \ --with github.com/grafana/xk6-sql@v0.0.1 \ @@ -52,6 +52,7 @@ docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \ --with github.com/grafana/xk6-sql@v0.0.1 \ --with github.com/grafana/xk6-output-prometheus-remote ``` + {{< /code >}}
@@ -61,7 +62,7 @@ docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \ The extensions ecosystem provides endless possibilities to expand the functionality for your k6 testing. Some reasons you might want to extend k6 include the following: - **To add support for a new network protocol** - + For example, [xk6-amqp](https://github.com/grafana/xk6-amqp) gives access to resources using the Advanced Message Queueing Protocol (AMQP). With xk6-amqp, your scripts can create message queues and seed messages for tests that include systems like RabbitMQ or ActiveMQ (among others). - **To incorporate a client library for test dependency** @@ -76,5 +77,4 @@ The extensions ecosystem provides endless possibilities to expand the functional Perhaps your company uses OpenTelemetry to trace service requests through layers of microservices. Using [xk6-distributed-tracing](https://github.com/grafana/xk6-distributed-tracing), you can update the http client to link your test requests as the origin for your traces—no need to add JavaScript code to supply the required trace headers. - Next, [Explore the available extensions](https://grafana.com/docs/k6//extensions/explore) to see how you can expand your use of k6 right now. diff --git a/docs/sources/next/extensions/build-k6-binary-using-docker.md b/docs/sources/next/extensions/build-k6-binary-using-docker.md index a31d000134..f57365033f 100644 --- a/docs/sources/next/extensions/build-k6-binary-using-docker.md +++ b/docs/sources/next/extensions/build-k6-binary-using-docker.md @@ -13,6 +13,7 @@ Using the [xk6 Docker image](https://hub.docker.com/r/grafana/xk6/) can simplify For example, to build a custom k6 binary with the latest versions of k6 and the [`xk6-kafka`](https://github.com/mostafa/xk6-kafka) and [`xk6-output-influxdb`](https://github.com/grafana/xk6-output-influxdb) extensions, run one of the commands below, depending on your operating system: {{< code >}} + ```linux docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \ --with github.com/mostafa/xk6-kafka \ @@ -39,6 +40,7 @@ docker run --rm -e GOOS=windows -v "%cd%:/xk6" ^ --with github.com/mostafa/xk6-kafka ^ --with github.com/grafana/xk6-output-influxdb ``` + {{< /code >}} This creates a `k6` (or `k6.exe`) binary in the current working directory. @@ -46,6 +48,7 @@ This creates a `k6` (or `k6.exe`) binary in the current working directory. To build the binary with concrete versions, see the example below (k6 `v0.45.1`, xk6-kafka `v0.19.1`, and xk6-output-influxdb `v0.4.1`): {{< code >}} + ```linux docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build v0.45.1 \ --with github.com/mostafa/xk6-kafka@v0.19.1 \ @@ -72,6 +75,7 @@ docker run --rm -e GOOS=windows -v "%cd%:/xk6" ^ --with github.com/mostafa/xk6-kafka@v0.19.1 ^ --with github.com/grafana/xk6-output-influxdb@v0.4.1 ``` + {{< /code >}} ## Breaking down the command @@ -116,7 +120,7 @@ Flags: The use of `--replace` should be considered an advanced feature to be avoided unless required. - {{% /admonition %}} +{{% /admonition %}} Referring back to our executed command, note that: diff --git a/docs/sources/next/extensions/build-k6-binary-using-go.md b/docs/sources/next/extensions/build-k6-binary-using-go.md index 0018f88780..a983bba173 100644 --- a/docs/sources/next/extensions/build-k6-binary-using-go.md +++ b/docs/sources/next/extensions/build-k6-binary-using-go.md @@ -13,7 +13,7 @@ you need to build a binary using Go. Not interested in setting up a Go environment? You can [use Docker instead](https://grafana.com/docs/k6/latest/extensions/build-k6-binary-using-docker/). - {{% /admonition %}} +{{% /admonition %}} ## Before you start diff --git a/docs/sources/next/extensions/create/_index.md b/docs/sources/next/extensions/create/_index.md index d4dcc20601..20c2fd52f6 100644 --- a/docs/sources/next/extensions/create/_index.md +++ b/docs/sources/next/extensions/create/_index.md @@ -29,7 +29,7 @@ there's some background knowledge you should have: If you maintain a public xk6 repository and wish to have your extension listed in our [registry](https://grafana.com/docs/k6//extensions/explore), be sure to review the [requirements](https://grafana.com/docs/k6//extensions/explanations/extensions-registry#registry-requirements). - {{% /admonition %}} +{{% /admonition %}} ## Avoid unneeded work diff --git a/docs/sources/next/extensions/create/javascript-extensions.md b/docs/sources/next/extensions/create/javascript-extensions.md index a23493d8c8..3f59d35e3b 100644 --- a/docs/sources/next/extensions/create/javascript-extensions.md +++ b/docs/sources/next/extensions/create/javascript-extensions.md @@ -66,12 +66,12 @@ func (c *Compare) IsGreater(a, b int) bool { 1. Register the module to use these from k6 test scripts. - {{% admonition type="note" %}} +{{% admonition type="note" %}} k6 extensions must have the `k6/x/` prefix, and the short name must be unique among all extensions built in the same k6 binary. - {{% /admonition %}} +{{% /admonition %}} ```go import "go.k6.io/k6/js/modules" @@ -116,7 +116,7 @@ func (c *Compare) IsGreater(a, b int) bool { } ``` - {{< /code >}} +{{< /code >}} ## Compile your extended k6 @@ -131,7 +131,7 @@ $ xk6 build --with xk6-compare=. When building from source code, `xk6-compare` is the Go module name passed to `go mod init`. Usually, this would be a URL similar to `github.com/grafana/xk6-compare`. - {{% /admonition %}} +{{% /admonition %}} ## Use your extension @@ -150,7 +150,7 @@ export default function () { } ``` - {{< /code >}} +{{< /code >}} 1. Run the test with `./k6 run test.js`. @@ -180,7 +180,7 @@ interface to serve as a factory of `Compare` instances for each VU. The significance depends on the size of your module. - {{% /admonition %}} +{{% /admonition %}} Here's what that would look like: @@ -263,7 +263,7 @@ func (mi *ModuleInstance) Exports() modules.Exports { Notice that we implemented the Module API and now `modules.Register` the _root module_ rather than our _Compare_ object! - {{% /admonition %}} +{{% /admonition %}} ## Accessing runtime state diff --git a/docs/sources/next/extensions/create/output-extensions.md b/docs/sources/next/extensions/create/output-extensions.md index 67a582f476..dbe3582ec6 100644 --- a/docs/sources/next/extensions/create/output-extensions.md +++ b/docs/sources/next/extensions/create/output-extensions.md @@ -207,7 +207,7 @@ export default function () { } ``` - {{< /code >}} +{{< /code >}} 1. Now, run the test. diff --git a/docs/sources/next/extensions/explanations/extension-graduation.md b/docs/sources/next/extensions/explanations/extension-graduation.md index 49a0c4d344..d84b9a4b54 100644 --- a/docs/sources/next/extensions/explanations/extension-graduation.md +++ b/docs/sources/next/extensions/explanations/extension-graduation.md @@ -25,7 +25,7 @@ These extensions might be provided by Grafana or by the community, and _may_ be Only Grafana-controlled extensions may progress beyond the _extension_ phase to become _experimental_ or _core modules_. - {{% /admonition %}} +{{% /admonition %}} ### Experimental Module @@ -44,7 +44,7 @@ The key will be to achieve a balance between usability and stability. Not all experimental modules will progress to become a core module! The k6 team reserves the right to discontinue and remove any experimental module if is no longer deemed desirable. - {{% /admonition %}} +{{% /admonition %}} ### Core Module diff --git a/docs/sources/next/extensions/explanations/extensions-registry.md b/docs/sources/next/extensions/explanations/extensions-registry.md index 538b0da507..2158eca059 100644 --- a/docs/sources/next/extensions/explanations/extensions-registry.md +++ b/docs/sources/next/extensions/explanations/extensions-registry.md @@ -74,7 +74,7 @@ Applying our conventions, we'd recommend naming this repository as `xk6-output-a Our goal is to quickly understand the intent of the extension. - {{% /admonition %}} +{{% /admonition %}} ## Extension Tiers diff --git a/docs/sources/next/get-started/results-output.md b/docs/sources/next/get-started/results-output.md index c2b3da1aeb..803f7f4877 100644 --- a/docs/sources/next/get-started/results-output.md +++ b/docs/sources/next/get-started/results-output.md @@ -99,7 +99,7 @@ The available built-in outputs include: - [Netdata](https://grafana.com/docs/k6//results-output/real-time/netdata) - [New Relic](https://grafana.com/docs/k6//results-output/real-time/newrelic) - [Prometheus](https://grafana.com/docs/k6//results-output/real-time/prometheus-remote-write) -- [TimescaleDB](https://grafana.com/docs/k6//results-output/real-time/timescaledb) +- [TimescaleDB](https://grafana.com/docs/k6//results-output/real-time/timescaledb) - [StatsD](https://grafana.com/docs/k6//results-output/real-time/statsd) diff --git a/docs/sources/next/javascript-api/init-context/_index.md b/docs/sources/next/javascript-api/init-context/_index.md index 34a753881d..3b205073b7 100644 --- a/docs/sources/next/javascript-api/init-context/_index.md +++ b/docs/sources/next/javascript-api/init-context/_index.md @@ -1,5 +1,5 @@ --- -title: "Init context" +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.' weight: 01 --- @@ -10,6 +10,6 @@ Before the k6 starts the test logic, code in the _init context_ prepares the scr A few functions are available only in init context. For details about the runtime, refer to the [Test lifecycle](https://grafana.com/docs/k6//using-k6/test-lifecycle). -| Function | Description | -| ------------------------------------------------------------- | ---------------------------------------------------- | +| Function | Description | +| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | | [open( filePath, [mode] )](https://grafana.com/docs/k6//javascript-api/init-context/open) | Opens a file and reads all the contents into memory. | diff --git a/docs/sources/next/javascript-api/jslib/_index.md b/docs/sources/next/javascript-api/jslib/_index.md index 7fdedbe390..d15fbc3d6b 100644 --- a/docs/sources/next/javascript-api/jslib/_index.md +++ b/docs/sources/next/javascript-api/jslib/_index.md @@ -1,6 +1,6 @@ --- -title: "jslib" -excerpt: "External JavaScript libraries for k6" +title: 'jslib' +excerpt: 'External JavaScript libraries for k6' weight: 15 --- @@ -8,8 +8,8 @@ weight: 15 The [jslib.k6.io](https://jslib.k6.io/) is a collection of external JavaScript libraries that can be [directly imported](https://grafana.com/docs/k6//using-k6/modules#remote-http-s-modules) in k6 scripts. -| Library | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| Library | Description | +| ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | [aws](https://grafana.com/docs/k6//javascript-api/jslib/aws) | Library allowing to interact with Amazon AWS services | | [httpx](https://grafana.com/docs/k6//javascript-api/jslib/httpx) | Wrapper around [k6/http](https://k6.io/docs/javascript-api/#k6-http) to simplify session handling | | [k6chaijs](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs) | BDD assertion style | diff --git a/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/_index.md b/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/_index.md index 9bddff291a..4baf7b9f8f 100644 --- a/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/_index.md +++ b/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/_index.md @@ -16,8 +16,8 @@ Both the dedicated `event-bridge.js` jslib bundle and the all-encompassing `aws. ### Methods -| Function | Description | -| :------------------------------------------------------------------------------------------------------------------- | :---------------------------------------- | +| Function | Description | +| :---------------------------------------------------------------------------------------------------------------- | :---------------------------------------- | | [putEvents(input)](https://grafana.com/docs/k6//javascript-api/jslib/aws/eventbridgeclient/putevents) | Send custom events to Amazon EventBridge. | ### Throws diff --git a/docs/sources/next/javascript-api/jslib/httpx/_index.md b/docs/sources/next/javascript-api/jslib/httpx/_index.md index 155ce8329e..08de073c20 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/_index.md +++ b/docs/sources/next/javascript-api/jslib/httpx/_index.md @@ -27,27 +27,27 @@ This library is stable enough to be useful, but pay attention to the new version This documentation is for the only last version only. If you discover that some of the following doesn't work, you might be using an older version. - {{% /admonition %}} +{{% /admonition %}} ### Methods -| Function | Description | -| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | -| [asyncRequest(method, url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/asyncrequest) | Generic method for making arbitrary, asynchronous HTTP requests. | -| [request(method, url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/request) | Generic method for making arbitrary HTTP requests. | -| [get(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/get) | Makes GET request | -| [post(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/post) | Makes POST request | -| [put(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/put) | Makes PUT request | -| [patch(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/patch) | Makes PATCH request | -| [delete(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/delete) | Makes DELETE request | -| [batch(requests)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/batch) | Batches multiple HTTP requests together to issue them in parallel. | -| [setBaseUrl(url)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/setbaseurl) | Sets the base URL for the session | -| [addHeader(key, value)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addheader) | Adds a header to the session | -| [addHeaders(object)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addheaders) | Adds multiple headers to the session | -| [clearHeader(name)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/clearheader) | Removes header from the session | -| [addTag(key, value)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addtag) | Adds a tag to the session | -| [addTags(object)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addtags) | Adds multiple tags to the session | -| [clearTag(name)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/cleartag) | Removes tag from the session | +| Function | Description | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | +| [asyncRequest(method, url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/asyncrequest) | Generic method for making arbitrary, asynchronous HTTP requests. | +| [request(method, url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/request) | Generic method for making arbitrary HTTP requests. | +| [get(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/get) | Makes GET request | +| [post(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/post) | Makes POST request | +| [put(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/put) | Makes PUT request | +| [patch(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/patch) | Makes PATCH request | +| [delete(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/delete) | Makes DELETE request | +| [batch(requests)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/batch) | Batches multiple HTTP requests together to issue them in parallel. | +| [setBaseUrl(url)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/setbaseurl) | Sets the base URL for the session | +| [addHeader(key, value)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addheader) | Adds a header to the session | +| [addHeaders(object)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addheaders) | Adds multiple headers to the session | +| [clearHeader(name)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/clearheader) | Removes header from the session | +| [addTag(key, value)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addtag) | Adds a tag to the session | +| [addTags(object)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addtags) | Adds multiple tags to the session | +| [clearTag(name)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/cleartag) | Removes tag from the session | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/addheaders.md b/docs/sources/next/javascript-api/jslib/httpx/addheaders.md index 3cd332bf6b..2c2cde85d8 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/addheaders.md +++ b/docs/sources/next/javascript-api/jslib/httpx/addheaders.md @@ -21,7 +21,7 @@ import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js'; const session = new Httpx(); session.addHeaders({ - Authorization: 'token1', + 'Authorization': 'token1', 'User-Agent': 'My custom user agent', 'Content-Type': 'application/x-www-form-urlencoded', }); diff --git a/docs/sources/next/javascript-api/jslib/httpx/asyncrequest.md b/docs/sources/next/javascript-api/jslib/httpx/asyncrequest.md index b17f882af8..02aca8486d 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/asyncrequest.md +++ b/docs/sources/next/javascript-api/jslib/httpx/asyncrequest.md @@ -11,17 +11,17 @@ weight: 08 Generic method for making arbitrary asynchronous HTTP requests. Note, this method returns a Promise. You must use the `await` keyword to resolve it. -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| method | string | HTTP method. Must be uppercase (GET, POST, PUT, PATCH, OPTIONS, HEAD, etc) | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| method | string | HTTP method. Must be uppercase (GET, POST, PUT, PATCH, OPTIONS, HEAD, etc) | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| --------------------- | ------------------------------------------------------------------------------------------------- | | Promise with Response | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/batch.md b/docs/sources/next/javascript-api/jslib/httpx/batch.md index cfb8915c00..7dd42f72d7 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/batch.md +++ b/docs/sources/next/javascript-api/jslib/httpx/batch.md @@ -17,8 +17,8 @@ Batch multiple HTTP requests together, to issue them in parallel over multiple T ### Returns -| Type | Description | -| ----- | ------------------------------------------------------------------------------------------------- | +| Type | Description | +| ----- | ----------------------------------------------------------------------------------------------------------------- | | array | An array containing [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) objects. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/delete.md b/docs/sources/next/javascript-api/jslib/httpx/delete.md index 6520d674bd..96f8479d61 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/delete.md +++ b/docs/sources/next/javascript-api/jslib/httpx/delete.md @@ -9,16 +9,16 @@ weight: 14 `session.delete(url, body, params)` makes a DELETE request. Only the first parameter is required. Body is discouraged. -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/get.md b/docs/sources/next/javascript-api/jslib/httpx/get.md index 7f1c638111..7bd5fa76a2 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/get.md +++ b/docs/sources/next/javascript-api/jslib/httpx/get.md @@ -9,16 +9,16 @@ weight: 10 `session.get(url, body, params)` makes a GET request. Only the URL parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/head.md b/docs/sources/next/javascript-api/jslib/httpx/head.md index 0fab749aee..2997a97578 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/head.md +++ b/docs/sources/next/javascript-api/jslib/httpx/head.md @@ -9,16 +9,16 @@ weight: 16 `session.head(url, body, params)` makes a HEAD request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/options.md b/docs/sources/next/javascript-api/jslib/httpx/options.md index 9bc8058c08..8a0555e0a2 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/options.md +++ b/docs/sources/next/javascript-api/jslib/httpx/options.md @@ -9,16 +9,16 @@ weight: 15 `session.options(url, body, params)` makes an OPTIONS request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit the body, set to `null`. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit the body, set to `null`. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/patch.md b/docs/sources/next/javascript-api/jslib/httpx/patch.md index 216b08a32d..6cabfc4a89 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/patch.md +++ b/docs/sources/next/javascript-api/jslib/httpx/patch.md @@ -10,16 +10,16 @@ weight: 13 `session.patch(url, body, params)` makes a PATCH request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null` . | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null` . | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/post.md b/docs/sources/next/javascript-api/jslib/httpx/post.md index 8010f9ebab..e7e838fccb 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/post.md +++ b/docs/sources/next/javascript-api/jslib/httpx/post.md @@ -8,16 +8,16 @@ weight: 11 # post(url, [body], [params]) -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null` . | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null` . | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/put.md b/docs/sources/next/javascript-api/jslib/httpx/put.md index 6d719cf844..bda59a976e 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/put.md +++ b/docs/sources/next/javascript-api/jslib/httpx/put.md @@ -10,16 +10,16 @@ weight: 12 `session.put(url, body, params)` makes a PUT request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null`. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null`. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/request.md b/docs/sources/next/javascript-api/jslib/httpx/request.md index 0b8deafb2d..dfdf30730a 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/request.md +++ b/docs/sources/next/javascript-api/jslib/httpx/request.md @@ -12,17 +12,17 @@ Generic method for making arbitrary HTTP requests. Consider using specific methods for making common requests [get](https://grafana.com/docs/k6//javascript-api/jslib/httpx/get), [post](https://grafana.com/docs/k6//javascript-api/jslib/httpx/post), [put](https://grafana.com/docs/k6//javascript-api/jslib/httpx/put), [patch](https://grafana.com/docs/k6//javascript-api/jslib/httpx/patch). -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| method | string | HTTP method. Must be uppercase (GET, POST, PUT, PATCH, OPTIONS, HEAD, etc) | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null`. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| method | string | HTTP method. Must be uppercase (GET, POST, PUT, PATCH, OPTIONS, HEAD, etc) | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null`. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/httpx/trace.md b/docs/sources/next/javascript-api/jslib/httpx/trace.md index 9f5adc2711..bea377d816 100644 --- a/docs/sources/next/javascript-api/jslib/httpx/trace.md +++ b/docs/sources/next/javascript-api/jslib/httpx/trace.md @@ -9,16 +9,16 @@ weight: 17 `session.trace(url, body, params)` makes a TRACE request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/next/javascript-api/jslib/k6chaijs/_index.md b/docs/sources/next/javascript-api/jslib/k6chaijs/_index.md index 53c625b104..11fac09276 100644 --- a/docs/sources/next/javascript-api/jslib/k6chaijs/_index.md +++ b/docs/sources/next/javascript-api/jslib/k6chaijs/_index.md @@ -14,7 +14,7 @@ With this library, you get the following: - BDD style of assertions for more expressive language - chainable assertions - more powerful assertions functions such as: `deep`, `nested`, `ordered`, etc. -- automatic assertion messages +- automatic assertion messages - [exception handling](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/error-handling) for better test stability ## Installation @@ -67,9 +67,9 @@ If you are familiar with k6, the result is the same as using [check](https://gra ## API -| API | Description | -| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [config](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/config) | Options to change `k6chaijs` behaviour. | +| API | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [config](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/config) | Options to change `k6chaijs` behaviour. | | [describe](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/describe) | A wrapper of [group](https://grafana.com/docs/k6//javascript-api/k6/group) that catches exceptions to allow continuing the test execution. It returns a boolean to indicate the success of all its `k6chaijs` assertions. | | [expect](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/expect) | A wrapper of [check](https://grafana.com/docs/k6//javascript-api/k6/check) that provides BDD style of assertions. | diff --git a/docs/sources/next/javascript-api/jslib/utils/_index.md b/docs/sources/next/javascript-api/jslib/utils/_index.md index 58f4136d0c..bfeccbcfcb 100644 --- a/docs/sources/next/javascript-api/jslib/utils/_index.md +++ b/docs/sources/next/javascript-api/jslib/utils/_index.md @@ -1,6 +1,6 @@ --- -title: "utils" -excerpt: "A collection of small utility functions useful during load testing with k6. " +title: 'utils' +excerpt: 'A collection of small utility functions useful during load testing with k6. ' weight: 04 --- @@ -11,17 +11,17 @@ The `utils` module contains number of small utility functions useful in every da > ⭐️ Source code available on [GitHub](https://github.com/k6io/k6-jslib-utils). > Please request features and report bugs through [GitHub issues](https://github.com/k6io/k6-jslib-utils/issues). -| Function | Description | -| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [randomIntBetween(min, max)](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomintbetween) | Random integer in a given range | -| [randomItem(array)](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomitem) | Random item from a given array | -| [randomString(length, [charset])](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomstring) | Random string of a given length, optionally selected from a custom character set | -| [uuidv4()](https://grafana.com/docs/k6//javascript-api/jslib/utils/uuidv4) | Random UUID v4 in a string representation | -| [findBetween(content, left, right, [repeat])](https://grafana.com/docs/k6//javascript-api/jslib/utils/findbetween) | Extract a string between two surrounding strings | -| [normalDistributionStages(maxVUs, durationSeconds, [numberOfStages])](https://grafana.com/docs/k6//javascript-api/jslib/utils/normaldistributionstages) | Creates [stages](https://grafana.com/docs/k6//using-k6/k6-options#stages) which will produce a normal distribution (bell-curve) of VUs for a test | -| getCurrentStageIndex | Get the index of the running stage as defined in the `stages` array options. It can be used only with the executors that support the `stages` option as [ramping-vus](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-vus) or [ramping-arrival-rate](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-arrival-rate). | -| tagWithCurrentStageIndex | Tag all the generated metrics in the iteration with the index of the current running stage. | -| tagWithCurrentStageProfile | Tag all the generated metrics in the iteration with the computed profile for the current running stage. | +| Function | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [randomIntBetween(min, max)](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomintbetween) | Random integer in a given range | +| [randomItem(array)](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomitem) | Random item from a given array | +| [randomString(length, [charset])](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomstring) | Random string of a given length, optionally selected from a custom character set | +| [uuidv4()](https://grafana.com/docs/k6//javascript-api/jslib/utils/uuidv4) | Random UUID v4 in a string representation | +| [findBetween(content, left, right, [repeat])](https://grafana.com/docs/k6//javascript-api/jslib/utils/findbetween) | Extract a string between two surrounding strings | +| [normalDistributionStages(maxVUs, durationSeconds, [numberOfStages])](https://grafana.com/docs/k6//javascript-api/jslib/utils/normaldistributionstages) | Creates [stages](https://grafana.com/docs/k6//using-k6/k6-options#stages) which will produce a normal distribution (bell-curve) of VUs for a test | +| getCurrentStageIndex | Get the index of the running stage as defined in the `stages` array options. It can be used only with the executors that support the `stages` option as [ramping-vus](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-vus) or [ramping-arrival-rate](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-arrival-rate). | +| tagWithCurrentStageIndex | Tag all the generated metrics in the iteration with the index of the current running stage. | +| tagWithCurrentStageProfile | Tag all the generated metrics in the iteration with the computed profile for the current running stage. | ## Simple example diff --git a/docs/sources/next/javascript-api/jslib/utils/findbetween.md b/docs/sources/next/javascript-api/jslib/utils/findbetween.md index 60ef68b80a..d19d37b92f 100644 --- a/docs/sources/next/javascript-api/jslib/utils/findbetween.md +++ b/docs/sources/next/javascript-api/jslib/utils/findbetween.md @@ -8,12 +8,12 @@ weight: 45 Function that returns a string from between two other strings. -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------- | +| Parameter | Type | Description | +| ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | content | string | The string to search through (e.g. [Response.body](https://grafana.com/docs/k6//javascript-api/k6-http/response)) | -| left | string | The string immediately before the value to be extracted | -| right | string | The string immediately after the value to be extracted | -| repeat (optional) | boolean | If `true`, the result will be a string array containing all occurrences | +| left | string | The string immediately before the value to be extracted | +| right | string | The string immediately after the value to be extracted | +| repeat (optional) | boolean | If `true`, the result will be a string array containing all occurrences | ### Returns diff --git a/docs/sources/next/javascript-api/k6-crypto/_index.md b/docs/sources/next/javascript-api/k6-crypto/_index.md index a74bf922df..7e2ae07094 100644 --- a/docs/sources/next/javascript-api/k6-crypto/_index.md +++ b/docs/sources/next/javascript-api/k6-crypto/_index.md @@ -1,6 +1,6 @@ --- -title: "k6/crypto" -excerpt: "The k6/crypto module provides common hashing functionality available in the GoLang crypto." +title: 'k6/crypto' +excerpt: 'The k6/crypto module provides common hashing functionality available in the GoLang crypto.' weight: 03 --- @@ -10,8 +10,8 @@ weight: 03 The k6/crypto `module` provides common hashing functionality available in the GoLang [crypto](https://golang.org/pkg/crypto/) package. -| Function | Description | -| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| Function | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | [createHash(algorithm)](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhash) | Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way. | | [createHMAC(algorithm, secret)](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhmac) | Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way. | | [hmac(algorithm, secret, data, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/hmac) | Use HMAC to sign an input string. | @@ -26,6 +26,6 @@ The k6/crypto `module` provides common hashing functionality available in the Go | [sha512_224(input, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/sha512_224) | Use SHA-512/224 to hash an input string. | | [sha512_256(input, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/sha512_256) | Use SHA-512/256 to hash an input string. | -| Class | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Class | Description | +| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [Hasher](https://grafana.com/docs/k6//javascript-api/k6-crypto/hasher) | Object returned by [crypto.createHash()](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhash). It allows adding more data to be hashed and to extract digests along the way. | diff --git a/docs/sources/next/javascript-api/k6-crypto/createhash.md b/docs/sources/next/javascript-api/k6-crypto/createhash.md index 157adb4309..1435a7a728 100644 --- a/docs/sources/next/javascript-api/k6-crypto/createhash.md +++ b/docs/sources/next/javascript-api/k6-crypto/createhash.md @@ -17,8 +17,8 @@ Creates a hashing object that can then be fed with data repeatedly, and from whi ### Returns -| Type | Description | -| ------ | ---------------------------------------------------------------------------- | +| Type | Description | +| ------ | -------------------------------------------------------------------------------------------- | | object | A [Hasher](https://grafana.com/docs/k6//javascript-api/k6-crypto/hasher) object. | ### Example diff --git a/docs/sources/next/javascript-api/k6-crypto/createhmac.md b/docs/sources/next/javascript-api/k6-crypto/createhmac.md index 793b25722a..dcbc4ee4e2 100644 --- a/docs/sources/next/javascript-api/k6-crypto/createhmac.md +++ b/docs/sources/next/javascript-api/k6-crypto/createhmac.md @@ -18,8 +18,8 @@ Creates a HMAC hashing object that can then be fed with data repeatedly, and fro ### Returns -| Type | Description | -| ------ | :--------------------------------------------------------------------------- | +| Type | Description | +| ------ | :------------------------------------------------------------------------------------------- | | object | A [Hasher](https://grafana.com/docs/k6//javascript-api/k6-crypto/hasher) object. | ### Example diff --git a/docs/sources/next/javascript-api/k6-data/_index.md b/docs/sources/next/javascript-api/k6-data/_index.md index 3f399bb43b..e8c9c497b1 100644 --- a/docs/sources/next/javascript-api/k6-data/_index.md +++ b/docs/sources/next/javascript-api/k6-data/_index.md @@ -1,6 +1,6 @@ --- -title: "k6/data" -excerpt: "k6 data API" +title: 'k6/data' +excerpt: 'k6 data API' weight: 04 --- @@ -8,6 +8,6 @@ weight: 04 The data module provides helpers to work with data. -| Class/Method | Description | -| --------------------------------------------------------------------------- | ------------------------------------------------------------- | +| Class/Method | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------- | | [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | read-only array like structure that shares memory between VUs | diff --git a/docs/sources/next/javascript-api/k6-data/sharedarray.md b/docs/sources/next/javascript-api/k6-data/sharedarray.md index aa4a4b3d45..bf5414eecf 100644 --- a/docs/sources/next/javascript-api/k6-data/sharedarray.md +++ b/docs/sources/next/javascript-api/k6-data/sharedarray.md @@ -43,7 +43,7 @@ Attempting to instantiate a `SharedArray` outside of the [init context](https:// This limitation will eventually be removed, but for now, the implication is that you can use `SharedArray` to populate test data only at the very beginning of your test and not as a result of receiving data from a response (for example). - {{% /admonition %}} +{{% /admonition %}} ## Example diff --git a/docs/sources/next/javascript-api/k6-encoding/_index.md b/docs/sources/next/javascript-api/k6-encoding/_index.md index 7e9deeec58..3f0b5b38e8 100644 --- a/docs/sources/next/javascript-api/k6-encoding/_index.md +++ b/docs/sources/next/javascript-api/k6-encoding/_index.md @@ -1,5 +1,5 @@ --- -title: "k6/encoding" +title: 'k6/encoding' excerpt: 'The encoding module provides base64 encoding/decoding as defined by RFC4648.' weight: 05 --- @@ -9,7 +9,7 @@ weight: 05 The encoding module provides [base64](https://en.wikipedia.org/wiki/Base64) encoding/decoding as defined by [RFC4648](https://tools.ietf.org/html/rfc4648). -| Function | Description | -| -------------------------------------------------------------------------------- | ----------------------- | +| Function | Description | +| ------------------------------------------------------------------------------------------------------------------------ | ----------------------- | | [b64decode(input, [encoding], [format])](https://grafana.com/docs/k6//javascript-api/k6-encoding/b64decode/) | Base64 decode a string. | | [b64encode(input, [encoding])](https://grafana.com/docs/k6//javascript-api/k6-encoding/b64encode/) | Base64 encode a string. | diff --git a/docs/sources/next/javascript-api/k6-execution.md b/docs/sources/next/javascript-api/k6-execution.md index b1910c312b..c7b1cd083e 100644 --- a/docs/sources/next/javascript-api/k6-execution.md +++ b/docs/sources/next/javascript-api/k6-execution.md @@ -60,7 +60,7 @@ Meta information and execution details about the current running [scenario](http | Property | Type | Description | | ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | name | string | The assigned name of the running scenario. | -| executor | string | The name of the running [Executor](https://grafana.com/docs/k6//using-k6/scenarios#executors) type. | +| executor | string | The name of the running [Executor](https://grafana.com/docs/k6//using-k6/scenarios#executors) type. | | startTime | integer | The Unix timestamp in milliseconds when the scenario started. | | progress | float | Percentage in a 0 to 1 interval of the scenario progress. | | iterationInInstance | integer | The unique and zero-based sequential number of the current iteration in the scenario, across the current instance. | @@ -70,23 +70,23 @@ Meta information and execution details about the current running [scenario](http Control the test execution. -| Property | Type | Description | -| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| abort([String]) | function | It aborts the test run with the exit code `108`, and an optional string parameter can provide an error message. Aborting the test will not prevent the `teardown()` execution. | +| Property | Type | Description | +| --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| abort([String]) | function | It aborts the test run with the exit code `108`, and an optional string parameter can provide an error message. Aborting the test will not prevent the `teardown()` execution. | | options | Object | It returns an object with all the test options as properties. The options' values are consolidated following the [order of precedence](https://grafana.com/docs/k6//using-k6/k6-options/how-to#order-of-precedence) and derived if shortcuts have been used. It returns `null` for properties where the relative option hasn't been defined. | ### vu Meta information and execution details about the current vu. -| Property | Type | Description | -| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| iterationInInstance | integer | The identifier of the iteration in the current instance for this VU. This is only unique for current VU and this instance (if multiple instances). This keeps being aggregated if a given VU is reused between multiple scenarios. | -| iterationInScenario | integer | The identifier of the iteration in the current scenario for this VU. This is only unique for current VU and scenario it is currently executing. | -| idInInstance | integer | The identifier of the VU across the instance. Not unique across multiple instances. | -| idInTest | integer | The globally unique (across the whole test run) identifier of the VU. | +| Property | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| iterationInInstance | integer | The identifier of the iteration in the current instance for this VU. This is only unique for current VU and this instance (if multiple instances). This keeps being aggregated if a given VU is reused between multiple scenarios. | +| iterationInScenario | integer | The identifier of the iteration in the current scenario for this VU. This is only unique for current VU and scenario it is currently executing. | +| idInInstance | integer | The identifier of the VU across the instance. Not unique across multiple instances. | +| idInTest | integer | The globally unique (across the whole test run) identifier of the VU. | | metrics.tags | object | The map that gives control over [VU's Tags](https://grafana.com/docs/k6//using-k6/tags-and-groups#tags). The Tags will be included in every metric emitted by the VU and the Tags' state is maintained across different iterations of the same Scenario while the VU exists. Check how to use it in the [example](#tags) below. | -| metrics.metadata | object | The map that gives control over VU's Metadata. The Metadata will be included in every metric emitted by the VU and the Metadata's state is maintained across different iterations of the same Scenario while the VU exists. Check how to use it in the [example](#metadata) below. | +| metrics.metadata | object | The map that gives control over VU's Metadata. The Metadata will be included in every metric emitted by the VU and the Metadata's state is maintained across different iterations of the same Scenario while the VU exists. Check how to use it in the [example](#metadata) below. | {{< collapse title="Setting vu.metrics.tags" >}} diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/_index.md b/docs/sources/next/javascript-api/k6-experimental/browser/_index.md index cdbecef59c..ecfde891df 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/_index.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/_index.md @@ -134,14 +134,14 @@ PS C:\k6> k6 run script.js You can customize the behavior of the browser module by providing browser options as environment variables. -| Environment Variable | Description | -| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| K6_BROWSER_ARGS | Extra command line arguments to include when launching browser process. See [this link](https://peter.sh/experiments/chromium-command-line-switches/) for a list of Chromium arguments. Note that arguments should not start with `--` (see the [example](#example)). | -| K6_BROWSER_DEBUG | All CDP messages and internal fine grained logs will be logged if set to `true`. | -| K6_BROWSER_EXECUTABLE_PATH | Override search for browser executable in favor of specified absolute path. | -| K6_BROWSER_HEADLESS | Show browser GUI or not. `true` by default. | -| K6_BROWSER_IGNORE_DEFAULT_ARGS | Ignore any of the [default arguments](#default-arguments) included when launching a browser process. | -| K6_BROWSER_TIMEOUT | Default timeout to use for various actions and navigation. `'30s'` if not set. | +| Environment Variable | Description | +| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| K6_BROWSER_ARGS | Extra command line arguments to include when launching browser process. See [this link](https://peter.sh/experiments/chromium-command-line-switches/) for a list of Chromium arguments. Note that arguments should not start with `--` (see the [example](#example)). | +| K6_BROWSER_DEBUG | All CDP messages and internal fine grained logs will be logged if set to `true`. | +| K6_BROWSER_EXECUTABLE_PATH | Override search for browser executable in favor of specified absolute path. | +| K6_BROWSER_HEADLESS | Show browser GUI or not. `true` by default. | +| K6_BROWSER_IGNORE_DEFAULT_ARGS | Ignore any of the [default arguments](#default-arguments) included when launching a browser process. | +| K6_BROWSER_TIMEOUT | Default timeout to use for various actions and navigation. `'30s'` if not set. | | K6_BROWSER_TRACES_METADATA | Sets additional _key-value_ metadata that is included as attributes in every span generated from browser module traces. Example: `K6_BROWSER_TRACES_METADATA=attr1=val1,attr2=val2`. This only applies if traces generation is enabled, refer to [Traces output](https://grafana.com/docs/k6//using-k6/k6-options/reference#traces-output) for more details. | The following command passes the [browser module options](#browser-module-options) as environment variables to launch a headful browser with custom arguments. diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/_index.md b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/_index.md index 20bbae2cb9..6ad8dd7b89 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/_index.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/_index.md @@ -13,18 +13,18 @@ The [browser module API](https://grafana.com/docs/k6//javascript-api If a [page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's `BrowserContext`. -| Method | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | +| Method | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [BrowserContext.addCookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/addcookies) | Adds [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) into the `BrowserContext`. | | [BrowserContext.clearCookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/clearcookies) | Clear the `BrowserContext`'s [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie). | -| [BrowserContext.clearPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/clearpermissions) | Clears all permission overrides for the `BrowserContext`. | +| [BrowserContext.clearPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/clearpermissions) | Clears all permission overrides for the `BrowserContext`. | | [BrowserContext.cookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookies) | Returns a list of [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) from the `BrowserContext`. | | [BrowserContext.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close) | Close the `BrowserContext` and all its [page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page)s. | -| [BrowserContext.grantPermissions(permissions[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) | Grants specified permissions to the `BrowserContext`. | +| [BrowserContext.grantPermissions(permissions[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) | Grants specified permissions to the `BrowserContext`. | | [BrowserContext.newPage()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/newpage) | Uses the `BrowserContext` to create a new [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) and returns it. | | [BrowserContext.pages()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/pages) | Returns a list of [page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page)s that belongs to the `BrowserContext`. | -| [BrowserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout) | Sets the default navigation timeout in milliseconds. | -| [BrowserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout) | Sets the default maximum timeout for all methods accepting a timeout option in milliseconds. | -| [BrowserContext.setGeolocation(geolocation)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setgeolocation) | Sets the `BrowserContext`'s geolocation. | -| [BrowserContext.setOffline(offline)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setoffline) | Toggles the `BrowserContext`'s connectivity on/off. | -| [BrowserContext.waitForEvent(event[, optionsOrPredicate])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/waitforevent) | Waits for the event to fire and passes its value into the predicate function. | +| [BrowserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout) | Sets the default navigation timeout in milliseconds. | +| [BrowserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout) | Sets the default maximum timeout for all methods accepting a timeout option in milliseconds. | +| [BrowserContext.setGeolocation(geolocation)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setgeolocation) | Sets the `BrowserContext`'s geolocation. | +| [BrowserContext.setOffline(offline)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setoffline) | Toggles the `BrowserContext`'s connectivity on/off. | +| [BrowserContext.waitForEvent(event[, optionsOrPredicate])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/waitforevent) | Waits for the event to fire and passes its value into the predicate function. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/addcookies.md b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/addcookies.md index 97396bbcd5..35354e799b 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/addcookies.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/addcookies.md @@ -11,7 +11,7 @@ Adds a list of [cookies](https://grafana.com/docs/k6//javascript-api If a [cookie](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie)'s `url` property is not provided, both `domain` and `path` properties must be specified. - {{% /admonition %}} +{{% /admonition %}} ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/cookies.md b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/cookies.md index f0fe715b3f..fc8df5759d 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/cookies.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/cookies.md @@ -7,21 +7,21 @@ excerpt: 'Retrieves context cookies.' Returns a list of [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) from the [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) filtered by the provided `urls`. If no `urls` are provided, all cookies are returned. -| Parameter | Type | Description | -| --------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Parameter | Type | Description | +| --------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | urls | array | A string array of URLs to filter the [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) in the [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext). | ### Returns -| Type | Description | -| ----- | ----------------------------------------------------------------------------------- | +| Type | Description | +| ----- | --------------------------------------------------------------------------------------------------------------------------- | | array | A list of [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie). | {{% admonition type="note" %}} [Cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) can be added with [BrowserContext.addCookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/addcookies/). - {{% /admonition %}} +{{% /admonition %}} ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/newpage.md b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/newpage.md index dac29e2412..03474414e5 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/newpage.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/newpage.md @@ -9,8 +9,8 @@ Uses the `BrowserContext` to create a new [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/) object. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/pages.md b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/pages.md index 6dcbcb6014..d453ae39ef 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/pages.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/pages.md @@ -10,7 +10,7 @@ excerpt: 'Returns a list of pages inside this BrowserContext.' This feature has **known issues**. For details, refer to [#444](https://github.com/grafana/xk6-browser/issues/444). - {{% /admonition %}} +{{% /admonition %}} Returns all open [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/)s in the `BrowserContext`. diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/setgeolocation.md b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/setgeolocation.md index d112cab4e4..cf63302591 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/setgeolocation.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/setgeolocation.md @@ -10,7 +10,7 @@ excerpt: "Sets the BrowserContext's geolocation." This feature has **known issues**. For details, refer to [#435](https://github.com/grafana/xk6-browser/issues/435). - {{% /admonition %}} +{{% /admonition %}} Sets the context's geolocation. diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/waitforevent.md b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/waitforevent.md index 3723e5f02c..0884f55c71 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/waitforevent.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/browsercontext/waitforevent.md @@ -8,7 +8,7 @@ Waits for the event to fire and returns its value. If a predicate function has b | Parameter | Type | Default | Description | -|------------------------------|------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------| +| ---------------------------- | ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | event | string | `null` | Name of event to wait for. Currently the `'page'` event is the only one that is supported. | | optionsOrPredicate | function\|object | `null` | Optional. If it's a function, the `'page'` event data will be passed to it and it must return `true` to continue. | | optionsOrPredicate.predicate | function | `null` | Optional. Function that will be called when the `'page'` event is emitted. The event data will be passed to it and it must return `true` to continue. | @@ -18,8 +18,8 @@ Waits for the event to fire and returns its value. If a predicate function has b ### Returns -| Type | Description | -|--------------------|-------------------------------------------------------------------------------------------------------| +| Type | Description | +| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `Promise` | At the moment a [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) object is the only return value | ### Example @@ -35,36 +35,37 @@ export const options = { executor: 'shared-iterations', options: { browser: { - type: 'chromium', + type: 'chromium', }, }, }, }, -} +}; -export default async function() { - const context = browser.newContext() +export default async function () { + const context = browser.newContext(); // Call waitForEvent with a predicate which will return true once at least // one page has been created. - let counter = 0 - const promise = context.waitForEvent("page", { predicate: page => { - if (++counter >= 1) { - return true - } - return false - } }) - + let counter = 0; + const promise = context.waitForEvent('page', { + predicate: (page) => { + if (++counter >= 1) { + return true; + } + return false; + }, + }); + // Now we create a page. - const page = context.newPage() + const page = context.newPage(); // Wait for the predicate to pass. - await promise - console.log('predicate passed') - - page.close() -}; + await promise; + console.log('predicate passed'); + page.close(); +} ``` diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/closecontext.md b/docs/sources/next/javascript-api/k6-experimental/browser/closecontext.md index bb4b11af44..74e68ffdc6 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/closecontext.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/closecontext.md @@ -5,7 +5,6 @@ excerpt: 'Browser module: close context method' Closes the current [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext). If there is no active browser context, because none has been created yet or because it has been previously closed, this method throws an error. - ### Example ```javascript @@ -17,12 +16,12 @@ export const options = { executor: 'shared-iterations', options: { browser: { - type: 'chromium', + type: 'chromium', }, }, }, }, -} +}; export default async function () { const page1 = browser.newPage({ diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/context.md b/docs/sources/next/javascript-api/k6-experimental/browser/context.md index 9dbaeff5ae..61c207af0a 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/context.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/context.md @@ -11,12 +11,12 @@ Returns the current [BrowserContext](https://grafana.com/docs/k6//ja A 1-to-1 mapping between [Browser](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) and `BrowserContext` means you cannot run `BrowserContexts` concurrently. If you wish to create a new `BrowserContext` while one already exists, you will need to [close](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close) the current one, and create a new one with either [newContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/newcontext/) or [newPage](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/newpage). All resources associated to the closed `BrowserContext` will also be closed and cleaned up (such as [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/)s). - {{% /admonition %}} +{{% /admonition %}} ### Returns -| Type | Description | -| -------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | object \| null | The current [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) if one has been created, otherwise `null`. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/isconnected.md b/docs/sources/next/javascript-api/k6-experimental/browser/isconnected.md index 20200e7dba..9ed1f4a50d 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/isconnected.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/isconnected.md @@ -10,14 +10,14 @@ excerpt: 'Browser module: isConnected method' This feature has **known issues**. For details, refer to [#453](https://github.com/grafana/xk6-browser/issues/453). - {{% /admonition %}} +{{% /admonition %}} Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. ### Returns -| Type | Description | -| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | boolean | Returns `true` if the [browser module](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) is connected to the browser application. Otherwise, returns `false`. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/_index.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/_index.md index 121b7dd26f..52bade88bd 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/_index.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/_index.md @@ -16,8 +16,8 @@ The Locator API makes it easier to work with dynamically changing elements. Some Locator can be created with the [page.locator(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator) method. -| Method | Description | -| ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| Method | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | [locator.check([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/check) | Select the input checkbox. | | [locator.click([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/click) | Mouse click on the chosen element. | | [locator.dblclick([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/dblclick) | Mouse double click on the chosen element. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/check.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/check.md index f4185abfde..406d1b0349 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/check.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/check.md @@ -10,22 +10,22 @@ excerpt: 'Browser module: locator.check method' This feature has known issues. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471) and [#475](https://github.com/grafana/xk6-browser/issues/475). - {{% /admonition %}} +{{% /admonition %}} Use this method to select an `input` checkbox. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/click.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/click.md index fd56713602..4587545a9f 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/click.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/click.md @@ -9,26 +9,26 @@ excerpt: 'Browser module: locator.click method' This method has **known issues**. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471) and [#474](https://github.com/grafana/xk6-browser/issues/474). - {{% /admonition %}} +{{% /admonition %}} Mouse click on the chosen element. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | -| options.clickCount | number | `1` | The number of times the action is performed. | -| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | +| options.clickCount | number | `1` | The number of times the action is performed. | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/dblclick.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/dblclick.md index 743e955671..42118a034b 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/dblclick.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/dblclick.md @@ -10,25 +10,25 @@ excerpt: 'Browser module: locator.dblclick method' This feature has known issues. For details, refer to [#469](https://github.com/grafana/xk6-browser/issues/469) and [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Mouse double click on the chosen element. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | -| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/fill.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/fill.md index 9ca478f1d3..c4d4e17dd1 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/fill.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/fill.md @@ -9,12 +9,12 @@ Fill an `input`, `textarea` or `contenteditable` element with the provided value -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| value | string | `''` | Value to set for the `input`, `textarea` or `contenteditable` element. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| value | string | `''` | Value to set for the `input`, `textarea` or `contenteditable` element. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/focus.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/focus.md index ba969005cf..94ead4ecad 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/focus.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/focus.md @@ -9,9 +9,9 @@ Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/getattribute.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/getattribute.md index 766f8c059a..15638ce022 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/getattribute.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/getattribute.md @@ -9,10 +9,10 @@ Returns the element attribute value for the given attribute name. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | string | `''` | Attribute name to get the value for. | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | `''` | Attribute name to get the value for. | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/hover.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/hover.md index 7f156f7e0c..32ab601a5f 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/hover.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/hover.md @@ -10,23 +10,23 @@ excerpt: 'Browser module: locator.hover method' This feature has known issues. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Hovers over the element. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/innerhtml.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/innerhtml.md index f0796e7171..c3e52e15a2 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/innerhtml.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/innerhtml.md @@ -9,9 +9,9 @@ Returns the `element.innerHTML`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/innertext.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/innertext.md index f65c3aa7e8..d9920a04ff 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/innertext.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/innertext.md @@ -9,9 +9,9 @@ Returns the `element.innerText`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/inputvalue.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/inputvalue.md index 4dba89813e..50946548a3 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/inputvalue.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/inputvalue.md @@ -9,9 +9,9 @@ Returns `input.value` for the selected `input`, `textarea` or `select` element. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/ischecked.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/ischecked.md index d4de7e32df..d4b180ff95 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/ischecked.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/ischecked.md @@ -9,9 +9,9 @@ Checks to see if the `checkbox` `input` type is selected or not. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/isdisabled.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/isdisabled.md index dad78280b1..863a0fe8b4 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/isdisabled.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/isdisabled.md @@ -9,9 +9,9 @@ Checks if the element is `disabled`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/iseditable.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/iseditable.md index 6ca7b1a99c..91c67889fe 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/iseditable.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/iseditable.md @@ -9,9 +9,9 @@ Checks if the element is `editable`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/isenabled.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/isenabled.md index e11d9d3c56..414ce552ed 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/isenabled.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/isenabled.md @@ -9,9 +9,9 @@ Checks if the element is `enabled`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/ishidden.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/ishidden.md index 7227021ab3..35d9e398f6 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/ishidden.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/ishidden.md @@ -9,9 +9,9 @@ Checks if the element is `hidden`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/isvisible.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/isvisible.md index 440b123e20..5fc7b5e727 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/isvisible.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/isvisible.md @@ -9,9 +9,9 @@ Checks if the element is `visible`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/press.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/press.md index 421a40c4ac..5bb951d316 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/press.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/press.md @@ -9,12 +9,12 @@ Press a single key on the keyboard or a combination of keys. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). | -| options | object | `null` | | -| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). | +| options | object | `null` | | +| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/selectoption.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/selectoption.md index b958f97d42..700415ad40 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/selectoption.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/selectoption.md @@ -10,18 +10,18 @@ excerpt: 'Browser module: locator.selectOption method' This feature has **known issues**. For details, refer to [#470](https://github.com/grafana/xk6-browser/issues/470) and [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Select one or more options which match the values. -| Parameter | Type | Default | Description | -| ------------------- | ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| values | string or string[] or object | `''` | If the `select` has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. Object can be made up of keys with `value`, `label` or `index`. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| Parameter | Type | Default | Description | +| ------------------- | ---------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| values | string or string[] or object | `''` | If the `select` has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. Object can be made up of keys with `value`, `label` or `index`. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/tap.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/tap.md index 5f9cea7114..7d1e6816da 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/tap.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/tap.md @@ -10,23 +10,23 @@ excerpt: 'Browser module: locator.tap method' This feature has **known issues**. For details, refer to [#436](https://github.com/grafana/xk6-browser/issues/436) and [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Tap on the chosen element. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/textcontent.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/textcontent.md index aa711f8702..0f07b2fdc6 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/textcontent.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/textcontent.md @@ -9,9 +9,9 @@ Returns the `element.textContent`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/type.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/type.md index e5aaa4a5f5..fded8ae7b2 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/type.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/type.md @@ -9,12 +9,12 @@ Type in the text into the input field. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| text | string | `''` | A text to type into a focused element. | -| options | object | `null` | | -| options.delay | number | `0` | Milliseconds to wait between key presses. Defaults to `0`. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| text | string | `''` | A text to type into a focused element. | +| options | object | `null` | | +| options.delay | number | `0` | Milliseconds to wait between key presses. Defaults to `0`. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/uncheck.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/uncheck.md index dcd8b20e82..cd95861268 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/uncheck.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/uncheck.md @@ -10,22 +10,22 @@ excerpt: 'Browser module: locator.uncheck method' This feature has **known issues**. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Unselect the `input` checkbox. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/locator/waitfor.md b/docs/sources/next/javascript-api/k6-experimental/browser/locator/waitfor.md index 171f083034..15bd14d182 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/locator/waitfor.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/locator/waitfor.md @@ -10,16 +10,16 @@ excerpt: 'Browser module: locator.waitFor method' This feature has **known issues**. For details, refer to [#472](https://github.com/grafana/xk6-browser/issues/472). - {{% /admonition %}} +{{% /admonition %}} Wait for the element to be in a particular state e.g. `visible`. -| Parameter | Type | Default | Description | -| --------------- | ------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.state | string | `visible` | Can be `attached`, `detached`, `visible` or `hidden`. | +| Parameter | Type | Default | Description | +| --------------- | ------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.state | string | `visible` | Can be `attached`, `detached`, `visible` or `hidden`. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/newcontext.md b/docs/sources/next/javascript-api/k6-experimental/browser/newcontext.md index 70e3515d15..27ebecc8ff 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/newcontext.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/newcontext.md @@ -11,47 +11,47 @@ Creates and returns a new [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) and `BrowserContext` means you cannot run `BrowserContexts` concurrently. Due to this restriction, if one already exists, it must be [close](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close)d first before creating a new one. - {{% /admonition %}} +{{% /admonition %}} -| Parameter | Type | Default | Description | -| ------------------------------------------- | ------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| options | object | `null` | | -| options.bypassCSP | boolean | `false` | Whether to bypass a page's Content-Security-Policy. | -| options.colorScheme | string | `'light'` | Whether to display a page in dark or light mode by emulating the 'prefers-colors-scheme' media feature. It can be one of `'light'`, `'dark'`, `'no-preference'`. | -| options.deviceScaleFactor | number | `1` | Sets the resolution ratio in physical pixels to the resolution in CSS pixels i.e. if set higher than `1`, then images will look sharper on high pixel density screens. See an [example](#devicescalefactor-example) below. | -| options.extraHTTPHeaders | object | `null` | Contains additional HTTP headers to be sent with every request, where the keys are HTTP headers and values are HTTP header values. | -| options.geolocation | object | `null` | Sets the user's geographical location. | -| options.geolocation.latitude | number | `0` | Latitude should be between `-90` and `90`. | -| options.geolocation.longitude | number | `0` | Longitude should be between `-180` and `180`. | -| options.geolocation.accuracy | number | `0` | Accuracy should only be a non-negative number. Defaults to `0`. | -| options.hasTouch | boolean | `false` | Whether to simulate a device with touch events. | -| options.httpCredentials | object | `null` | Sets the credentials for HTTP authentication using Basic Auth. | -| options.httpCredentials.username | string | `''` | Username to pass to the web browser for Basic HTTP Authentication. | -| options.httpCredentials.password | string | `''` | Password to pass to the web browser for Basic HTTP Authentication. | -| options.ignoreHTTPSErrors | boolean | `false` | Whether to ignore HTTPS errors that may be caused by invalid certificates. | -| options.isMobile | boolean | `false` | Whether to simulate a mobile device. | -| options.javaScriptEnabled | boolean | `true` | Whether to activate JavaScript support for the context. | -| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. | -| options.offline | boolean | `false` | Whether to emulate an offline network. | -| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) for the options. | +| Parameter | Type | Default | Description | +| ------------------------------------------- | ------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.bypassCSP | boolean | `false` | Whether to bypass a page's Content-Security-Policy. | +| options.colorScheme | string | `'light'` | Whether to display a page in dark or light mode by emulating the 'prefers-colors-scheme' media feature. It can be one of `'light'`, `'dark'`, `'no-preference'`. | +| options.deviceScaleFactor | number | `1` | Sets the resolution ratio in physical pixels to the resolution in CSS pixels i.e. if set higher than `1`, then images will look sharper on high pixel density screens. See an [example](#devicescalefactor-example) below. | +| options.extraHTTPHeaders | object | `null` | Contains additional HTTP headers to be sent with every request, where the keys are HTTP headers and values are HTTP header values. | +| options.geolocation | object | `null` | Sets the user's geographical location. | +| options.geolocation.latitude | number | `0` | Latitude should be between `-90` and `90`. | +| options.geolocation.longitude | number | `0` | Longitude should be between `-180` and `180`. | +| options.geolocation.accuracy | number | `0` | Accuracy should only be a non-negative number. Defaults to `0`. | +| options.hasTouch | boolean | `false` | Whether to simulate a device with touch events. | +| options.httpCredentials | object | `null` | Sets the credentials for HTTP authentication using Basic Auth. | +| options.httpCredentials.username | string | `''` | Username to pass to the web browser for Basic HTTP Authentication. | +| options.httpCredentials.password | string | `''` | Password to pass to the web browser for Basic HTTP Authentication. | +| options.ignoreHTTPSErrors | boolean | `false` | Whether to ignore HTTPS errors that may be caused by invalid certificates. | +| options.isMobile | boolean | `false` | Whether to simulate a mobile device. | +| options.javaScriptEnabled | boolean | `true` | Whether to activate JavaScript support for the context. | +| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. | +| options.offline | boolean | `false` | Whether to emulate an offline network. | +| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) for the options. | | options.reducedMotion | string | `'no-preference'` | Minimizes the amount of motion by emulating the 'prefers-reduced-motion' media feature. It can be one of `'reduce'` and `'no-preference'`. See [page.emulateMedia()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatemedia) for the options. | -| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. | -| options.screen.width | number | `1280` | Page width in pixels. | -| options.screen.height | number | `720` | Page height in pixels. | -| options.timezoneID | string | system | Changes the context's timezone. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. | -| options.userAgent | string | browser | Specifies the user agent to use in the context. | -| options.viewport | object | `{'width': 1280, 'height': 720}` | Sets a viewport size for all pages in the context. `null` disables the default viewport. | -| options.viewport.width | number | `1280` | Page width in pixels. | -| options.viewport.height | number | `720` | Page height in pixels. | +| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. | +| options.screen.width | number | `1280` | Page width in pixels. | +| options.screen.height | number | `720` | Page height in pixels. | +| options.timezoneID | string | system | Changes the context's timezone. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. | +| options.userAgent | string | browser | Specifies the user agent to use in the context. | +| options.viewport | object | `{'width': 1280, 'height': 720}` | Sets a viewport size for all pages in the context. `null` disables the default viewport. | +| options.viewport.width | number | `1280` | Page width in pixels. | +| options.viewport.height | number | `720` | Page height in pixels. | ### Returns -| Type | Description | -| ------ | -------------------------------------------------------------------------------- | +| Type | Description | +| ------ | ------------------------------------------------------------------------------------------------------------------------ | | object | [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) object | ### deviceScaleFactor example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/newpage.md b/docs/sources/next/javascript-api/k6-experimental/browser/newpage.md index 6df1775965..4703247ec2 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/newpage.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/newpage.md @@ -11,53 +11,53 @@ Creates and returns a new [Page](https://grafana.com/docs/k6//javasc A 1-to-1 mapping between [Browser](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) and `BrowserContext` means you cannot run `BrowserContexts` concurrently. Due to this restriction, if one already exists, it must be [retrieved](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/context) and [close](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close)d first before creating a new one. - {{% /admonition %}} +{{% /admonition %}} {{% admonition type="caution" %}} Pages that have been opened ought to be closed using [`Page.close`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close/). Pages left open could potentially distort the results of Web Vital metrics. - {{% /admonition %}} +{{% /admonition %}} -| Parameter | Type | Default | Description | -| ------------------------------------------- | ------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| options | object | `null` | | -| options.bypassCSP | boolean | `false` | Whether to bypass a page's Content-Security-Policy. | -| options.colorScheme | string | `'light'` | Whether to display a page in dark or light mode by emulating the 'prefers-colors-scheme' media feature. It can be one of `'light'`, `'dark'`, `'no-preference'`. | -| options.deviceScaleFactor | number | `1` | Sets the resolution ratio in physical pixels to the resolution in CSS pixels i.e. if set higher than `1`, then images will look sharper on high pixel density screens. See an [example](#devicescalefactor-example) below. | -| options.extraHTTPHeaders | object | `null` | Contains additional HTTP headers to be sent with every request, where the keys are HTTP headers and values are HTTP header values. | -| options.geolocation | object | `null` | Sets the user's geographical location. | -| options.geolocation.latitude | number | `0` | Latitude should be between `-90` and `90`. | -| options.geolocation.longitude | number | `0` | Longitude should be between `-180` and `180`. | -| options.geolocation.accuracy | number | `0` | Accuracy should only be a non-negative number. Defaults to `0`. | -| options.hasTouch | boolean | `false` | Whether to simulate a device with touch events. | -| options.httpCredentials | object | `null` | Sets the credentials for HTTP authentication using Basic Auth. | -| options.httpCredentials.username | string | `''` | Username to pass to the web browser for Basic HTTP Authentication. | -| options.httpCredentials.password | string | `''` | Password to pass to the web browser for Basic HTTP Authentication. | -| options.ignoreHTTPSErrors | boolean | `false` | Whether to ignore HTTPS errors that may be caused by invalid certificates. | -| options.isMobile | boolean | `false` | Whether to simulate a mobile device. | -| options.javaScriptEnabled | boolean | `true` | Whether to activate JavaScript support for the context. | -| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. | -| options.offline | boolean | `false` | Whether to emulate an offline network. | -| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) for the options. | +| Parameter | Type | Default | Description | +| ------------------------------------------- | ------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.bypassCSP | boolean | `false` | Whether to bypass a page's Content-Security-Policy. | +| options.colorScheme | string | `'light'` | Whether to display a page in dark or light mode by emulating the 'prefers-colors-scheme' media feature. It can be one of `'light'`, `'dark'`, `'no-preference'`. | +| options.deviceScaleFactor | number | `1` | Sets the resolution ratio in physical pixels to the resolution in CSS pixels i.e. if set higher than `1`, then images will look sharper on high pixel density screens. See an [example](#devicescalefactor-example) below. | +| options.extraHTTPHeaders | object | `null` | Contains additional HTTP headers to be sent with every request, where the keys are HTTP headers and values are HTTP header values. | +| options.geolocation | object | `null` | Sets the user's geographical location. | +| options.geolocation.latitude | number | `0` | Latitude should be between `-90` and `90`. | +| options.geolocation.longitude | number | `0` | Longitude should be between `-180` and `180`. | +| options.geolocation.accuracy | number | `0` | Accuracy should only be a non-negative number. Defaults to `0`. | +| options.hasTouch | boolean | `false` | Whether to simulate a device with touch events. | +| options.httpCredentials | object | `null` | Sets the credentials for HTTP authentication using Basic Auth. | +| options.httpCredentials.username | string | `''` | Username to pass to the web browser for Basic HTTP Authentication. | +| options.httpCredentials.password | string | `''` | Password to pass to the web browser for Basic HTTP Authentication. | +| options.ignoreHTTPSErrors | boolean | `false` | Whether to ignore HTTPS errors that may be caused by invalid certificates. | +| options.isMobile | boolean | `false` | Whether to simulate a mobile device. | +| options.javaScriptEnabled | boolean | `true` | Whether to activate JavaScript support for the context. | +| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. | +| options.offline | boolean | `false` | Whether to emulate an offline network. | +| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) for the options. | | options.reducedMotion | string | `'no-preference'` | Minimizes the amount of motion by emulating the 'prefers-reduced-motion' media feature. It can be one of `'reduce'` and `'no-preference'`. See [page.emulateMedia()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatemedia) for the options. | -| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. | -| options.screen.width | number | `1280` | Page width in pixels. | -| options.screen.height | number | `720` | Page height in pixels. | -| options.timezoneID | string | system | Changes the context's timezone. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. | -| options.userAgent | string | browser | Specifies the user agent to use in the context. | -| options.viewport | object | `{'width': 1280, 'height': 720}` | Sets a viewport size for all pages in the context. `null` disables the default viewport. | -| options.viewport.width | number | `1280` | Page width in pixels. | -| options.viewport.height | number | `720` | Page height in pixels. | +| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. | +| options.screen.width | number | `1280` | Page width in pixels. | +| options.screen.height | number | `720` | Page height in pixels. | +| options.timezoneID | string | system | Changes the context's timezone. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. | +| options.userAgent | string | browser | Specifies the user agent to use in the context. | +| options.viewport | object | `{'width': 1280, 'height': 720}` | Sets a viewport size for all pages in the context. `null` disables the default viewport. | +| options.viewport.width | number | `1280` | Page width in pixels. | +| options.viewport.height | number | `720` | Page height in pixels. | ### Returns -| Type | Description | -| ------ | ------------------------------------------------------------ | +| Type | Description | +| ------ | ---------------------------------------------------------------------------------------------------- | | object | [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/) object | ### deviceScaleFactor example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/_index.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/_index.md index ded6fe7e5a..91d6a3b9b3 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/_index.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/_index.md @@ -1,6 +1,6 @@ --- -title: "Page" -excerpt: "Browser module: Page Class" +title: 'Page' +excerpt: 'Browser module: Page Class' weight: 10 --- @@ -8,66 +8,66 @@ weight: 10 Page provides methods to interact with a single tab in a running web browser. A single [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) can have many `pages`. -| Method | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [page.bringToFront()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/bringtofront) | Activates a browser tab. | -| [page.check(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/check/) | Select the input checkbox. | -| [page.click(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/click/) | Clicks on an element matching a `selector`. | -| [page.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close) | Closes a tab that the `page` is associated with. | -| [page.content()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/content) | Gets the HTML contents of the page. | -| [page.context()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/context) | Gets the [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) that the page belongs to. | -| [page.dblclick(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/dblclick/) | With the [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse), double click on an element matching the provided `selector`. | -| [page.dispatchEvent(selector, type, eventInit[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/dispatchevent/) | Dispatches HTML DOM event types e.g. `'click'` | -| [page.$(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/page-dollar) | Finds an element matching the specified `selector` within the page. | -| [page.$$(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/page-doubledollar) | Finds all elements matching the specified `selector` within the page. | -| [page.emulateMedia([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatemedia/) | Changes the CSS media type and the color scheme feature. | -| [page.emulateVisionDeficiency(type)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatevisiondeficiency) | Emulates your website with the specified vision deficiency `type`. | -| [page.evaluate(pageFunction[, arg])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/evaluate/) | Returns the value of the `pageFunction` invocation. | -| [page.evaluateHandle(pageFunction[, arg])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/evaluatehandle/) | Returns the value of the `pageFunction` invocation as a [JSHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/jshandle). | -| [page.fill(selector, value[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/fill/) | Fill an `input`, `textarea` or `contenteditable` element with the provided value. | -| [page.focus(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/focus/) | Fetches an element with `selector` and focuses on it. | -| [page.frames()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/frames) | Returns an array of frames on the page. | -| [page.getAttribute(selector, name[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/getattribute/) | Returns the element attribute value for the given attribute name. | -| [page.goto(url[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/goto/) | Navigates to the specified `url`. | -| [page.hover(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/hover/) | Hovers over an element matching `selector`. | -| [page.innerHTML(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/innerhtml/) | Returns the `element.innerHTML`. | -| [page.innerText(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/innertext/) | Returns the `element.innerText`. | -| [page.inputValue(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/inputvalue/) | Returns `input.value` for the selected `input`, `textarea` or `select` element. | -| [page.isChecked(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/ischecked/) | Checks to see if the `checkbox` `input` type is selected or not. | -| [page.isClosed()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isclosed) | Checks if the page has been closed. | -| [page.isDisabled(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isdisabled/) | Checks if the element is `disabled`. | -| [page.isEditable(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/iseditable/) | Checks if the element is `editable`. | -| [page.isEnabled(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isenabled/) | Checks if the element is `enabled`. | -| [page.isHidden(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/ishidden/) | Checks if the element is `hidden`. | -| [page.isVisible(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isvisible/) | Checks if the element is `visible`. | -| [page.keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/keyboard) | Returns the [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard) instance to interact with a virtual keyboard on the page. | -| [page.locator(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator) | Returns a [Locator](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator) for the given `selector`. | -| [page.mainFrame()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/mainframe) | Returns the page's main [Frame](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/frame). | -| [page.mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/mouse) | Returns the [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse) instance to interact with a virtual mouse on the page. | -| [page.on(event, handler)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/on) | Registers a handler to be called whenever the specified event occurs. | -| [page.opener()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/opener) | Returns the `page` that opened the current `page`. | -| [page.press(selector, key[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/press/) | Focuses the element, and then presses the given `key` on the [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard). | -| [page.reload([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/reload/) | Reloads the current page. | -| [page.screenshot([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/screenshot/) | Returns a buffer with the captured screenshot from the web browser. | -| [page.selectOption(selector, values[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/selectoption/) | Selects one or more options which match the values from a `` element. | +| [page.setContent(html[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setcontent/) | Sets the supplied HTML string to the current page. | +| [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout) | Changes the navigation timeout for [page.goto(url[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/goto/), [page.reload([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/reload/), [page.setContent(html[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setcontent/), and [page.waitForNavigation([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfornavigation/) | +| [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaulttimeout) | Changes the timeout for all the methods accepting a `timeout` option. | +| [page.setExtraHTTPHeaders(headers)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setextrahttpheaders) | Sets extra HTTP headers which will be sent with subsequent HTTP requests. | +| [page.setViewportSize(viewportSize)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setviewportsize) | Updates the `page`'s width and height. | +| [page.tap(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/tap/) | Taps the first element that matches the `selector`. | +| [page.textContent(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/textcontent/) | Returns the `element.textContent`. | +| [page.throttleCPU(cpuProfile)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/throttlecpu) | Throttles the CPU in Chrome/Chromium to slow it down by the specified `rate` in the `cpuProfile` object. | +| [page.throttleNetwork(networkProfile)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/throttlenetwork) | Throttles the network in Chrome/Chromium to slow it down by the specified fields in the `networkProfile` object. | +| [page.title()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/title) | Returns the `page`'s title. | +| [page.type(selector, text[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/type/) | Types the `text` in the first element found that matches the `selector`. | +| [page.touchScreen](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/touchscreen) | Returns the [Touchscreen](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/touchscreen) instance to interact with a virtual touchscreen on the page. | +| [page.uncheck(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/uncheck/) | Unselects an input `checkbox` element. | +| [page.url()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/url) | Returns the `page`'s URL. | +| [page.viewportSize()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/viewportsize) | Returns the `page`'s size (width and height). | +| [page.waitForFunction(pageFunction, arg[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforfunction/) | Returns when the `pageFunction` returns a truthy value. | +| [page.waitForLoadState(state[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforloadstate/) | Waits for the given load `state` to be reached. | +| [page.waitForNavigation([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfornavigation/) | Waits for the given navigation lifecycle event to occur and returns the main resource response. | +| [page.waitForSelector(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforselector/) | Returns when element specified by selector satisfies `state` option. | +| [page.waitForTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfortimeout) | Waits for the given `timeout` in milliseconds. | +| [page.workers()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/workers) | Returns an array of the dedicated [WebWorkers](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/worker) associated with the page. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/check.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/check.md index 14cf0dfbee..11139c99e5 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/check.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/check.md @@ -9,24 +9,24 @@ excerpt: 'Browser module: page.check(selector[, options]) method' Use locator-based [`locator.check([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/check/) instead. - {{% /admonition %}} +{{% /admonition %}} This method is used to select an input checkbox. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/click.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/click.md index 2792c83966..81902bb8bd 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/click.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/click.md @@ -9,28 +9,28 @@ excerpt: 'Browser module: page.click(selector[, options]) method' Use locator-based [`locator.click([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/click/) instead. - {{% /admonition %}} +{{% /admonition %}} This method clicks on an element matching a `selector`. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | -| options.clickCount | number | `1` | The number of times the action is performed. | -| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | +| options.clickCount | number | `1` | The number of times the action is performed. | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. Useful to wait until the element is ready for the action without performing it. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. Useful to wait until the element is ready for the action without performing it. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/context.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/context.md index 89f9077485..011e7c2708 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/context.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/context.md @@ -9,8 +9,8 @@ Gets the [BrowserContext](https://grafana.com/docs/k6//javascript-ap ### Returns -| Type | Description | -| ------------------------------------------------------------------------- | ---------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | | [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) | The `BrowserContext` that the page belongs to. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/dblclick.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/dblclick.md index d07219c0ce..6c702ba267 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/dblclick.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/dblclick.md @@ -9,27 +9,27 @@ excerpt: 'Browser module: page.dblclick(selector[, options]) method' Use locator-based [`locator.dblclick([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/dblclick/) instead. - {{% /admonition %}} +{{% /admonition %}} Mouse double clicks an element matching provided selector. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | -| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/dispatchevent.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/dispatchevent.md index d0a55d12b6..a026d1d839 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/dispatchevent.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/dispatchevent.md @@ -9,19 +9,19 @@ excerpt: 'Browser module: page.dispatchEvent(selector, type, eventInit[, options Use locator-based [`locator.dispatchEvent(type, eventInit[, options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/dispatchevent/) instead. - {{% /admonition %}} +{{% /admonition %}} Dispatches HTML DOM event types e.g. `'click'`. -| Parameter | Type | Defaults | Description | -| --------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| type | string | `''` | DOM event type e.g. `'click'`. | -| eventInit | object | `null` | Optional event specific properties. See [eventInit](#eventinit) for more details. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Defaults | Description | +| --------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| type | string | `''` | DOM event type e.g. `'click'`. | +| eventInit | object | `null` | Optional event specific properties. See [eventInit](#eventinit) for more details. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/dollar.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/dollar.md index 58456c8534..9a0eb9fe1a 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/dollar.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/dollar.md @@ -10,14 +10,14 @@ excerpt: 'Browser module: page.$(selector) method' Use locator-based [`page.locator(selector)`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator/) instead. - {{% /admonition %}} +{{% /admonition %}} The method finds an element matching the specified selector within the page. If no elements match the selector, the return value resolves to `null`. To wait for an element on the page, use [locator.waitFor([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/waitfor/). ### Returns -| Type | Description | -| ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | null \| [ElementHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/elementhandle/) | Returns `ElementHandle` when a matching element is found. Else, it returns `null`. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/doubledollar.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/doubledollar.md index a7c31361cb..c28dc77956 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/doubledollar.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/doubledollar.md @@ -10,14 +10,14 @@ excerpt: 'Browser module: page.$$(selector) method' Use locator-based [`page.locator(selector)`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator/) instead. - {{% /admonition %}} +{{% /admonition %}} The method finds all elements matching the specified selector within the page. If no elements match the selector, the return value resolves to `[]`. ### Returns -| Type | Description | -| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | | null \| [ElementHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/elementhandle/)[] | Returns an array of `ElementHandle` when multiple elements are found. Else, it returns `null`. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/evaluatehandle.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/evaluatehandle.md index c6ade0106b..fb7b2215a8 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/evaluatehandle.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/evaluatehandle.md @@ -20,8 +20,8 @@ The only difference between `page.evaluate()` and `page.evaluateHandle()` is tha ### Returns -| Type | Description | -| ------------------------------------------------------------- | ------------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------- | | [JSHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/jshandle/) | The `JSHandle` instance associated with the page. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/fill.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/fill.md index 0687c53351..2d87bd4f06 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/fill.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/fill.md @@ -9,20 +9,20 @@ excerpt: 'Browser module: page.fill(selector, value[, options]) method' Use locator-based [`locator.fill(value[, options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/fill/) instead. - {{% /admonition %}} +{{% /admonition %}} Fill an `input`, `textarea` or `contenteditable` element with the provided value. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| value | string | `''` | Value to fill out for the `input`, `textarea` or `contenteditable` element. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| value | string | `''` | Value to fill out for the `input`, `textarea` or `contenteditable` element. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/focus.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/focus.md index bdfb7152c2..e392cacad7 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/focus.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/focus.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.focus(selector[, options]) method' Use locator-based [`locator.focus([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/focus/) instead. - {{% /admonition %}} +{{% /admonition %}} This method fetches an element with `selector` and focuses it. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/frames.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/frames.md index c2e68eb0c3..d9164da0ed 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/frames.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/frames.md @@ -9,8 +9,8 @@ Returns an array of [Frames](https://grafana.com/docs/k6//javascript ### Returns -| Type | Description | -| ---------------------------------------------------------- | ---------------------------------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------------------- | ---------------------------------------------- | | [Frames](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/frame/)[] | An array of `Frames` associated with the page. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/getattribute.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/getattribute.md index 522efbc70c..50ff501020 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/getattribute.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/getattribute.md @@ -9,18 +9,18 @@ excerpt: 'Browser module: page.getAttribute(selector, name[, options]) method' Use locator-based [`locator.getAttribute()`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/getattribute/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns the element attribute value for the given attribute name. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| name | string | `''` | Attribute name to get the value for. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| name | string | `''` | Attribute name to get the value for. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/goto.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/goto.md index a3178489ac..301203c1e6 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/goto.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/goto.md @@ -11,23 +11,23 @@ Navigating to `about:blank` or navigation to the same URL with a different hash, -| Parameter | Type | Default | Description | -| ----------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| url | string | `''` | URL to navigate page to. The url should include scheme, e.g. `https://`. | -| options | object | `null` | | -| options.referer | string | `''` | Referer header value. | +| Parameter | Type | Default | Description | +| ----------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | `''` | URL to navigate page to. The url should include scheme, e.g. `https://`. | +| options | object | `null` | | +| options.referer | string | `''` | Referer header value. | | options.timeout | number | `30000` | Maximum operation time in milliseconds. Pass `0` to disable the timeout. The default value can be changed via the [browserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout/), [browserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout/), [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout/) or [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaulttimeout/) methods. Setting the value to `0` will disable the timeout. | -| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | +| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | ### Events - {{% admonition type="caution" %}} +{{% admonition type="caution" %}} `networkidle` is DISCOURAGED. Don't use this method for testing especially with chatty websites where the event may never fire, rely on web assertions to assess readiness instead. - {{% /admonition %}} +{{% /admonition %}} Events can be either: @@ -37,8 +37,8 @@ Events can be either: ### Returns -| Type | Description | -| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | +| Type | Description | +| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | Promise/javascript-api/k6-experimental/browser/response/)> | The `Response` instance associated with the page. Else, it returns `null`. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/hover.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/hover.md index fcd8706dd8..e11c5c042a 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/hover.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/hover.md @@ -9,25 +9,25 @@ excerpt: 'Browser module: page.hover(selector[, options]) method' Use locator-based [`locator.hover([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/hover/) instead. - {{% /admonition %}} +{{% /admonition %}} This method hovers over an element matching `selector`. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/innerhtml.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/innerhtml.md index 87ec5d8474..6775c3c7d9 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/innerhtml.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/innerhtml.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.innerHTML(selector[, options]) method' Use locator-based [`locator.innerHTML([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/innerhtml/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns the `element.innerHTML`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/innertext.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/innertext.md index 8888e05540..0594ad0c3f 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/innertext.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/innertext.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.innerText(selector[, options]) method' Use locator-based [`locator.innerText([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/innertext/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns the `element.innerText`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/inputvalue.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/inputvalue.md index 9e9495fba9..48a03ffb48 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/inputvalue.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/inputvalue.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.inputValue(selector[, options]) method' Use locator-based [`locator.inputValue([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/inputvalue/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns `input.value` for the selected `input`, `textarea` or `select` element. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/ischecked.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/ischecked.md index 234d4a6059..54e63c3a98 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/ischecked.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/ischecked.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isChecked(selector[, options]) method' Use locator-based [`locator.isChecked([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/ischecked/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks to see if the `checkbox` `input` type is selected or not. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/isclosed.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/isclosed.md index bf23018606..e5c5a5883f 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/isclosed.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/isclosed.md @@ -9,7 +9,7 @@ excerpt: 'Browser module: page.isClosed() method' This method has **known issues**. For details, refer to [#878](https://github.com/grafana/xk6-browser/issues/878). - {{% /admonition %}} +{{% /admonition %}} Checks if the page has been closed. diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/isdisabled.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/isdisabled.md index 7c985d17c1..06eee65ca3 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/isdisabled.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/isdisabled.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isDisabled(selector[, options]) method' Use locator-based [`locator.isDisabled([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/isdisabled/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `disabled`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/iseditable.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/iseditable.md index 0a0c85de9b..6a66d7bf6b 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/iseditable.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/iseditable.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isEditable(selector[, options]) method' Use locator-based [`locator.isEditable([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/iseditable/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `editable`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/isenabled.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/isenabled.md index ffa864db62..cb54978aa3 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/isenabled.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/isenabled.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isEnabled(selector[, options]) method' Use locator-based [`locator.isEnabled([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/isenabled/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `enabled`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/ishidden.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/ishidden.md index 4006705274..e4870d16f0 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/ishidden.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/ishidden.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isHidden(selector[, options) method' Use locator-based [`locator.isHidden([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/ishidden/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `hidden`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/isvisible.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/isvisible.md index 9e5217e6fb..5925f00f57 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/isvisible.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/isvisible.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isVisible(selector[, options]) method' Use locator-based [`locator.isVisible([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/isvisible/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `visible`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/keyboard.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/keyboard.md index e4f99bf69e..5cd98eec9e 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/keyboard.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/keyboard.md @@ -9,8 +9,8 @@ Returns the [Keyboard](https://grafana.com/docs/k6//javascript-api/k ### Returns -| Type | Description | -| ------------------------------------------------------------- | ------------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------- | | [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard/) | The `Keyboard` instance associated with the page. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/locator.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/locator.md index 5ab63d2cdf..48c458037a 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/locator.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/locator.md @@ -13,8 +13,8 @@ The method returns an element [Locator](https://grafana.com/docs/k6/ ### Returns -| Type | Description | -| ----------------------------------------------------------- | ----------------------------------------------- | +| Type | Description | +| --------------------------------------------------------------------------------------------------- | ----------------------------------------------- | | [Locator](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/) | The element `Locator` associated with the page. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/mainframe.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/mainframe.md index 1d4239d735..5724a35ebb 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/mainframe.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/mainframe.md @@ -9,8 +9,8 @@ The page's main frame. Page is made up of frames in a hierarchical. At the top i ### Returns -| Type | Description | -| ------------------------------------------------------- | ---------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------- | ---------------------- | | [Frame](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/frame/) | The page's main frame. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/mouse.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/mouse.md index c0ad7c53c0..a80ce8c058 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/mouse.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/mouse.md @@ -9,8 +9,8 @@ Returns the [Mouse](https://grafana.com/docs/k6//javascript-api/k6-e ### Returns -| Type | Description | -| ------------------------------------------------------- | ---------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------- | ---------------------------------------------- | | [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse/) | The `Mouse` instance associated with the page. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/on.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/on.md index 7c86503b9a..89b59ae199 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/on.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/on.md @@ -16,12 +16,12 @@ Registers a handler to be called whenever the specified event occurs. When using the `page.on` method, the page has to be explicitly [closed](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close/) for the iteration to be able to finish. - {{% /admonition %}} +{{% /admonition %}} ### Events -| Event | Description | -| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Event | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `console` | Emitted every time the console API methods are called from within the page JavaScript context. The arguments passed into the handler are defined by the [`ConsoleMessage`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/consolemessage) class. | ### Example @@ -58,7 +58,8 @@ export default async function () { check(msg, { assertConsoleMessageType: (msg) => msg.type() == 'log', assertConsoleMessageText: (msg) => msg.text() == 'this is a console.log message 42', - assertConsoleMessageArgs0: (msg) => msg.args()[0].jsonValue() == 'this is a console.log message', + assertConsoleMessageArgs0: (msg) => + msg.args()[0].jsonValue() == 'this is a console.log message', assertConsoleMessageArgs1: (msg) => msg.args()[1].jsonValue() == 42, }); }); diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/opener.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/opener.md index 6b10b45e58..8dabea93bd 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/opener.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/opener.md @@ -9,8 +9,8 @@ Returns the page that opened the current page. The first page that is navigated ### Returns -| Type | Description | -| ------------------------------------------------------------- | --------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------- | --------------------------------------------- | | null or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/) | The `Page` instance. Else, it returns `null`. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/press.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/press.md index 03229c74d8..5639246862 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/press.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/press.md @@ -9,7 +9,7 @@ excerpt: 'Browser module: page.press(selector, key[, options]) method' Use locator-based [`locator.press()`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/press/) instead. - {{% /admonition %}} +{{% /admonition %}} Focuses the element, and then uses `keyboard.down(key)` and `keyboard.up(key)`. @@ -24,14 +24,14 @@ If `key` is a single character, it is case-sensitive, so the values `a` and `A` Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). | -| options | object | `null` | | -| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). | +| options | object | `null` | | +| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/reload.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/reload.md index 4f062f0427..9a11354350 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/reload.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/reload.md @@ -9,21 +9,21 @@ This reloads the current page and returns the main resource response. -| Parameter | Type | Default | Description | -| ----------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| ----------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum operation time in milliseconds. Pass `0` to disable the timeout. The default value can be changed via the [browserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout/), [browserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout/), [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout/) or [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaulttimeout/) methods. Setting the value to `0` will disable the timeout. | -| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | +| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | ### Events - {{% admonition type="caution" %}} +{{% admonition type="caution" %}} `networkidle` is DISCOURAGED. Don't use this method for testing especially with chatty websites where the event may never fire, rely on web assertions to assess readiness instead. - {{% /admonition %}} +{{% /admonition %}} Events can be either: @@ -33,8 +33,8 @@ Events can be either: ### Returns -| Type | Description | -| --------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | null or [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/response/) | The `Response` instance associated with the page. Else, it returns `null`. | ### Example diff --git a/docs/sources/next/javascript-api/k6-experimental/browser/page/selectoption.md b/docs/sources/next/javascript-api/k6-experimental/browser/page/selectoption.md index fe0f29f507..513150731d 100644 --- a/docs/sources/next/javascript-api/k6-experimental/browser/page/selectoption.md +++ b/docs/sources/next/javascript-api/k6-experimental/browser/page/selectoption.md @@ -9,20 +9,20 @@ excerpt: 'Browser module: page.selectOption(selector, values[, options]) method' Use locator-based [`locator.selectOption()`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/selectoption/) instead. - {{% /admonition %}} +{{% /admonition %}} Selects one or more options which match the values from a `` element. | -| [page.setContent(html[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setcontent/) | Sets the supplied HTML string to the current page. | -| [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout) | Changes the navigation timeout for [page.goto(url[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/goto/), [page.reload([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/reload/), [page.setContent(html[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setcontent/), and [page.waitForNavigation([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfornavigation/) | -| [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaulttimeout) | Changes the timeout for all the methods accepting a `timeout` option. | -| [page.setExtraHTTPHeaders(headers)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setextrahttpheaders) | Sets extra HTTP headers which will be sent with subsequent HTTP requests. | -| [page.setViewportSize(viewportSize)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setviewportsize) | Updates the `page`'s width and height. | -| [page.tap(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/tap/) | Taps the first element that matches the `selector`. | -| [page.textContent(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/textcontent/) | Returns the `element.textContent`. | -| [page.throttleCPU(cpuProfile)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/throttlecpu) | Throttles the CPU in Chrome/Chromium to slow it down by the specified `rate` in the `cpuProfile` object. | -| [page.throttleNetwork(networkProfile)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/throttlenetwork) | Throttles the network in Chrome/Chromium to slow it down by the specified fields in the `networkProfile` object. | -| [page.title()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/title) | Returns the `page`'s title. | -| [page.type(selector, text[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/type/) | Types the `text` in the first element found that matches the `selector`. | -| [page.touchScreen](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/touchscreen) | Returns the [Touchscreen](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/touchscreen) instance to interact with a virtual touchscreen on the page. | -| [page.uncheck(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/uncheck/) | Unselects an input `checkbox` element. | -| [page.url()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/url) | Returns the `page`'s URL. | -| [page.viewportSize()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/viewportsize) | Returns the `page`'s size (width and height). | -| [page.waitForFunction(pageFunction, arg[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforfunction/) | Returns when the `pageFunction` returns a truthy value. | -| [page.waitForLoadState(state[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforloadstate/) | Waits for the given load `state` to be reached. | -| [page.waitForNavigation([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfornavigation/) | Waits for the given navigation lifecycle event to occur and returns the main resource response. | -| [page.waitForSelector(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforselector/) | Returns when element specified by selector satisfies `state` option. | -| [page.waitForTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfortimeout) | Waits for the given `timeout` in milliseconds. | -| [page.workers()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/workers) | Returns an array of the dedicated [WebWorkers](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/worker) associated with the page. | +| Method | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [page.bringToFront()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/bringtofront) | Activates a browser tab. | +| [page.check(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/check/) | Select the input checkbox. | +| [page.click(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/click/) | Clicks on an element matching a `selector`. | +| [page.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close) | Closes a tab that the `page` is associated with. | +| [page.content()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/content) | Gets the HTML contents of the page. | +| [page.context()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/context) | Gets the [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) that the page belongs to. | +| [page.dblclick(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/dblclick/) | With the [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse), double click on an element matching the provided `selector`. | +| [page.dispatchEvent(selector, type, eventInit[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/dispatchevent/) | Dispatches HTML DOM event types e.g. `'click'` | +| [page.$(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/page-dollar) | Finds an element matching the specified `selector` within the page. | +| [page.$$(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/page-doubledollar) | Finds all elements matching the specified `selector` within the page. | +| [page.emulateMedia([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatemedia/) | Changes the CSS media type and the color scheme feature. | +| [page.emulateVisionDeficiency(type)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatevisiondeficiency) | Emulates your website with the specified vision deficiency `type`. | +| [page.evaluate(pageFunction[, arg])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/evaluate/) | Returns the value of the `pageFunction` invocation. | +| [page.evaluateHandle(pageFunction[, arg])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/evaluatehandle/) | Returns the value of the `pageFunction` invocation as a [JSHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/jshandle). | +| [page.fill(selector, value[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/fill/) | Fill an `input`, `textarea` or `contenteditable` element with the provided value. | +| [page.focus(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/focus/) | Fetches an element with `selector` and focuses on it. | +| [page.frames()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/frames) | Returns an array of frames on the page. | +| [page.getAttribute(selector, name[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/getattribute/) | Returns the element attribute value for the given attribute name. | +| [page.goto(url[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/goto/) | Navigates to the specified `url`. | +| [page.hover(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/hover/) | Hovers over an element matching `selector`. | +| [page.innerHTML(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/innerhtml/) | Returns the `element.innerHTML`. | +| [page.innerText(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/innertext/) | Returns the `element.innerText`. | +| [page.inputValue(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/inputvalue/) | Returns `input.value` for the selected `input`, `textarea` or `select` element. | +| [page.isChecked(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/ischecked/) | Checks to see if the `checkbox` `input` type is selected or not. | +| [page.isClosed()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isclosed) | Checks if the page has been closed. | +| [page.isDisabled(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isdisabled/) | Checks if the element is `disabled`. | +| [page.isEditable(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/iseditable/) | Checks if the element is `editable`. | +| [page.isEnabled(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isenabled/) | Checks if the element is `enabled`. | +| [page.isHidden(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/ishidden/) | Checks if the element is `hidden`. | +| [page.isVisible(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isvisible/) | Checks if the element is `visible`. | +| [page.keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/keyboard) | Returns the [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard) instance to interact with a virtual keyboard on the page. | +| [page.locator(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator) | Returns a [Locator](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator) for the given `selector`. | +| [page.mainFrame()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/mainframe) | Returns the page's main [Frame](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/frame). | +| [page.mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/mouse) | Returns the [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse) instance to interact with a virtual mouse on the page. | +| [page.on(event, handler)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/on) | Registers a handler to be called whenever the specified event occurs. | +| [page.opener()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/opener) | Returns the `page` that opened the current `page`. | +| [page.press(selector, key[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/press/) | Focuses the element, and then presses the given `key` on the [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard). | +| [page.reload([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/reload/) | Reloads the current page. | +| [page.screenshot([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/screenshot/) | Returns a buffer with the captured screenshot from the web browser. | +| [page.selectOption(selector, values[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/selectoption/) | Selects one or more options which match the values from a `` element. -| Parameter | Type | Default | Description | -| ------------------- | ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| values | string or string[] or object | `''` | If the `select` has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. Object can be made up of keys with `value`, `label` or `index`. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ---------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| values | string or string[] or object | `''` | If the `select` has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. Object can be made up of keys with `value`, `label` or `index`. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/setcontent.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/setcontent.md index a5399b9f9b..d6ad82149a 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/setcontent.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/setcontent.md @@ -11,12 +11,12 @@ Sets the supplied HTML string to the current page. -| Parameter | Type | Default | Description | -| ----------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| html | string | `''` | HTML markup to assign to the page. | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| ----------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| html | string | `''` | HTML markup to assign to the page. | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum operation time in milliseconds. Pass `0` to disable the timeout. The default value can be changed via the [browserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout/), [browserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout/), [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout/) or [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaulttimeout/) methods. Setting the value to `0` will disable the timeout. | -| options.waitUntil | string | `load` | When to consider operation to have succeeded. See Events for more details. | +| options.waitUntil | string | `load` | When to consider operation to have succeeded. See Events for more details. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/tap.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/tap.md index ffd23dffcd..a910d56aa6 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/tap.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/tap.md @@ -9,25 +9,25 @@ excerpt: 'Browser module: locator.tap(selector[, options]) method' Use locator-based [`locator.tap([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/tap/) instead. - {{% /admonition %}} +{{% /admonition %}} Tap the first element that matches the selector. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/textcontent.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/textcontent.md index 9f3591ba77..8b8c72c641 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/textcontent.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/textcontent.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: locator.textContent(selector[, options]) method' Use locator-based [`locator.textContent([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/textcontent/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns the `element.textContent`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/throttlecpu.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/throttlecpu.md index 1f5cfcada8..c1f519b9da 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/throttlecpu.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/throttlecpu.md @@ -8,7 +8,7 @@ excerpt: 'Browser module: page.throttleCPU(cpuProfile) method' Throttles the CPU in Chrome/Chromium to slow it down by the specified `rate` in `cpuProfile`. | Parameter | Type | Default | Description | -|-----------------|------------|---------|----------------------------------------------------------------------| +| --------------- | ---------- | ------- | -------------------------------------------------------------------- | | cpuProfile | CPUProfile | `null` | This is a mandatory parameter. | | cpuProfile.rate | number | `1` | rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc). | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/throttlenetwork.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/throttlenetwork.md index 00540202a0..e5ccaa38e5 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/throttlenetwork.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/throttlenetwork.md @@ -8,7 +8,7 @@ excerpt: 'Browser module: page.throttleNetwork(networkProfile) method' Throttles the network in Chrome/Chromium to slow it down by the specified fields in the `networkProfile` object. | Parameter | Type | Default | Description | -|-------------------------|----------------|---------|----------------------------------------------------------------------------------------| +| ----------------------- | -------------- | ------- | -------------------------------------------------------------------------------------- | | networkProfile | NetworkProfile | `null` | This is a mandatory parameter. | | networkProfile.latency | number | `0` | Minimum latency from request sent to response headers received (ms). | | networkProfile.download | number | `-1` | Maximal aggregated download throughput (bytes/sec). `-1` disables download throttling. | @@ -17,7 +17,7 @@ Throttles the network in Chrome/Chromium to slow it down by the specified fields To work with the most commonly tested network profiles, import `networkProfiles` from the browser module. There are three profiles available: | Name | Notes | -|-------------------|--------------------------------------------------------------------------------------------------------------------------------| +| ----------------- | ------------------------------------------------------------------------------------------------------------------------------ | | `'No Throttling'` | No throttling, which is the default before applying any network throttling. This can be used to remove the network throttling. | | `'Fast 3G'` | Emulates a typical fast 3G connection | | `'Slow 3G'` | Emulates a typical slow 3G connection | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/touchscreen.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/touchscreen.md index 11baeb395a..f48832408b 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/touchscreen.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/touchscreen.md @@ -9,8 +9,8 @@ Returns the [Touchscreen](https://grafana.com/docs/k6//javascript-ap ### Returns -| Type | Description | -| ------------------------------------------------------------------- | ---------------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | | [Touchscreen](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/touchscreen/) | The `Touchscreen` instance associated with the page. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/type.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/type.md index 5b56d4c6a8..7ee2ca2047 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/type.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/type.md @@ -9,20 +9,20 @@ excerpt: 'Browser module: page.type(selector, text[, options]) method' Use locator-based [`locator.type()`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/type/) instead. - {{% /admonition %}} +{{% /admonition %}} Type the `text` in the first element found that matches the selector. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| text | string | `''` | A text to type into a focused element. | -| options | object | `null` | | -| options.delay | number | `0` | Milliseconds to wait between key presses. Defaults to `0`. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| text | string | `''` | A text to type into a focused element. | +| options | object | `null` | | +| options.delay | number | `0` | Milliseconds to wait between key presses. Defaults to `0`. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/uncheck.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/uncheck.md index a5fcef586a..51f6022bc7 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/uncheck.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/uncheck.md @@ -9,24 +9,24 @@ excerpt: 'Browser module: page.uncheck(selector[, options]) method' Use locator-based [`locator.uncheck([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/uncheck/) instead. - {{% /admonition %}} +{{% /admonition %}} This method is used to unselect an input checkbox. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforfunction.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforfunction.md index c50b4b5003..1c0a4b90d9 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforfunction.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforfunction.md @@ -9,20 +9,20 @@ Returns when the `pageFunction` returns a truthy value. -| Parameter | Type | Default | Description | -| --------------- | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| pageFunction | function | | Function to be evaluated in the page context. | -| arg | string | `''` | Optional argument to pass to `pageFunction` | -| options | object | `null` | | -| options.polling | number or `raf` | `raf` | If `polling` is `'raf'`, then `pageFunction` is constantly executed in `requestAnimationFrame` callback. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. | +| Parameter | Type | Default | Description | +| --------------- | --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| pageFunction | function | | Function to be evaluated in the page context. | +| arg | string | `''` | Optional argument to pass to `pageFunction` | +| options | object | `null` | | +| options.polling | number or `raf` | `raf` | If `polling` is `'raf'`, then `pageFunction` is constantly executed in `requestAnimationFrame` callback. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | ### Returns -| Type | Description | -| ---------------------------------------------------------------------- | ------------------------------------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | | Promise<[JSHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/jshandle/)> | The `JSHandle` instance associated with the page. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforloadstate.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforloadstate.md index e4fcbc8ada..be819f39b7 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforloadstate.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforloadstate.md @@ -9,27 +9,27 @@ excerpt: 'Browser module: page.waitForLoadState(state[, options]) method' This method has **known issues**. For details, refer to [#880](https://github.com/grafana/xk6-browser/issues/880). - {{% /admonition %}} +{{% /admonition %}} This waits for the given load state to be reached. It will immediately unblock if that lifecycle event has already been received. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| state | string | `load` | Optional load state to wait for. See [Events](#events) for more details. | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| state | string | `load` | Optional load state to wait for. See [Events](#events) for more details. | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | ### Events - {{% admonition type="caution" %}} +{{% admonition type="caution" %}} `networkidle` is DISCOURAGED. Don't use this method for testing especially with chatty websites where the event may never fire, rely on web assertions to assess readiness instead. - {{% /admonition %}} +{{% /admonition %}} Events can be either: diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitfornavigation.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitfornavigation.md index 839bab4782..6b2b141322 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitfornavigation.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitfornavigation.md @@ -9,21 +9,21 @@ Waits for the given navigation lifecycle event to occur and returns the main res -| Parameter | Type | Default | Description | -| ----------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| ----------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | +| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | ### Events - {{% admonition type="caution" %}} +{{% admonition type="caution" %}} `networkidle` is DISCOURAGED. Don't use this method for testing especially with chatty websites where the event may never fire, rely on web assertions to assess readiness instead. - {{% /admonition %}} +{{% /admonition %}} Events can be either: @@ -33,8 +33,8 @@ Events can be either: ### Returns -| Type | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | +| Type | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | Promise/javascript-api/k6-experimental/browser/response/)> | The `Response` instance associated with the page. Else, it returns `null` | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforselector.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforselector.md index 58aff7888b..7e8a027a99 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforselector.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitforselector.md @@ -9,18 +9,18 @@ excerpt: 'Browser module: page.waitForSelector(selector[, options]) method' Use web assertions that assert visibility or a locator-based [`locator.waitFor([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/waitfor/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns when element specified by selector satisfies `state` option. -| Parameter | Type | Default | Description | -| --------------- | ------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.state | string | `visible` | Can be either `attached`, `detached`, `visible`, `hidden` See [Element states](#element-states) for more details. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.state | string | `visible` | Can be either `attached`, `detached`, `visible`, `hidden` See [Element states](#element-states) for more details. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | @@ -36,8 +36,8 @@ Element states can be either: ### Returns -| Type | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | | null \| [ElementHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard/) | `ElementHandle` when a matching element is found. Else, it returns `null`. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitfortimeout.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitfortimeout.md index 12cfb2fec1..23076c8f9f 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitfortimeout.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/waitfortimeout.md @@ -9,7 +9,7 @@ excerpt: 'Browser module: waitForTimeout(timeout) method' Never wait for timeout in production, use this only for debugging. Tests that wait for time are inherently flaky. Use [`Locator`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/) actions and web assertions that wait automatically. - {{% /admonition %}} +{{% /admonition %}} Waits for the given `timeout` in milliseconds. diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/workers.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/workers.md index 7bea640909..c1cad0bd70 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/workers.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/page/workers.md @@ -9,8 +9,8 @@ This method returns an array of the dedicated [WebWorkers](https://grafana.com/d ### Returns -| Type | Description | -| --------------------------------------------------------------- | ----------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | | [WebWorkers](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/worker/)[] | Array of `WebWorkers` associated with the page. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/request/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/request/_index.md index 41c5b07eb2..7776acdda7 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/request/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/request/_index.md @@ -26,6 +26,6 @@ weight: 11 | request.redirectedTo() | - | | request.resourceType() | - | | request.response() | - | -| [request.size()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/request/size) | Unlike Playwright, this method returns an object containing the sizes of request headers and body. | +| [request.size()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/request/size) | Unlike Playwright, this method returns an object containing the sizes of request headers and body. | | request.timing() | - | | request.url() | - | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/response.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/response.md index b2e7359817..fa673f4b5a 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/response.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/browser/response.md @@ -10,21 +10,21 @@ weight: 12 ## Supported APIs -| Method | Playwright Relevant Distinctions | Description | -| ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| response.allHeaders() | - | - | -| response.body() | - | - | -| response.frame() | - | - | -| response.headers() | - | - | -| response.headersArray() | - | - | -| response.headerValue(name) | - | - | -| response.headerValues(name) | - | - | -| response.json() | - | - | -| response.ok() | - | - | -| response.request() | - | - | -| response.securityDetails() | - | - | -| response.serverAddr() | - | - | -| response.status() | - | - | -| response.statusText() | - | - | +| Method | Playwright Relevant Distinctions | Description | +| ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| response.allHeaders() | - | - | +| response.body() | - | - | +| response.frame() | - | - | +| response.headers() | - | - | +| response.headersArray() | - | - | +| response.headerValue(name) | - | - | +| response.headerValues(name) | - | - | +| response.json() | - | - | +| response.ok() | - | - | +| response.request() | - | - | +| response.securityDetails() | - | - | +| response.serverAddr() | - | - | +| response.status() | - | - | +| response.statusText() | - | - | | response.size() | - | Similar to [`Request.size()`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/request/size), this returns the size of response headers and body sections. | -| response.url() | - | - | +| response.url() | - | - | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/fs/file/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/fs/file/_index.md index c92c485dda..1ec1ca6504 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/fs/file/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/fs/file/_index.md @@ -16,11 +16,11 @@ The `File` class represents a file with methods for reading, seeking, and obtain ## Methods -| Method | Description | -| :------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | -| [read](https://grafana.com/docs/k6//javascript-api/k6-experimental/fs/file/read) | Reads up to `buffer.byteLength` bytes from the file into the passed `buffer`. Returns a promise resolving to the number of bytes read. | -| [seek](https://grafana.com/docs/k6//javascript-api/k6-experimental/fs/file/seek) | Sets the file position indicator for the file to the passed `offset` bytes. Returns a promise resolving to the new offset. | -| [stat](https://grafana.com/docs/k6//javascript-api/k6-experimental/fs/file/stat) | Returns a promise resolving to a [FileInfo](https://grafana.com/docs/k6//javascript-api/k6-experimental/fs/fileinfo/) object with information about the file. | +| Method | Description | +| :------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [read](https://grafana.com/docs/k6//javascript-api/k6-experimental/fs/file/read) | Reads up to `buffer.byteLength` bytes from the file into the passed `buffer`. Returns a promise resolving to the number of bytes read. | +| [seek](https://grafana.com/docs/k6//javascript-api/k6-experimental/fs/file/seek) | Sets the file position indicator for the file to the passed `offset` bytes. Returns a promise resolving to the new offset. | +| [stat](https://grafana.com/docs/k6//javascript-api/k6-experimental/fs/file/stat) | Returns a promise resolving to a [FileInfo](https://grafana.com/docs/k6//javascript-api/k6-experimental/fs/fileinfo/) object with information about the file. | ## Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/_index.md index f6c2370bcd..b969365eac 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/_index.md @@ -13,20 +13,20 @@ The `k6/experimental/grpc` module is an extension of the [`k6/net/grpc`](https:/ The key-difference between the two modules is new `Stream` class, which provides client and server streaming support. Our long-term goal is to make this module part of k6 core, and long-term to replace the [`k6/net/grpc`](https://grafana.com/docs/k6//javascript-api/k6-net-grpc) module. -| Class/Method | Description | -| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| [Client](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client) | gRPC client used for making RPC calls to a gRPC Server. | -| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | -| [Client.connect(address [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-connect) | Connects to a given gRPC service. | -| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-invoke) | Makes a unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/response). | -| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-close) | Close the connection to the gRPC service. | -| [Params](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/params) | RPC Request specific options. | -| [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/response) | Returned by RPC requests. | +| Class/Method | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Client](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client) | gRPC client used for making RPC calls to a gRPC Server. | +| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | +| [Client.connect(address [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-connect) | Connects to a given gRPC service. | +| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-invoke) | Makes a unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/response). | +| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-close) | Close the connection to the gRPC service. | +| [Params](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/params) | RPC Request specific options. | +| [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/response) | Returned by RPC requests. | | [Constants](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/constants) | Define constants to distinguish between [gRPC Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/response) statuses. | -| [Stream](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream) | Creates a new GRPC stream. | -| [Stream.on(event, handler)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-on) | Adds a new listener to one of the possible stream event's. | -| [Stream.write(message)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-write) | Writes a message to the stream. | -| [Stream.end()](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-end) | Signals to server that client finished sending. | +| [Stream](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream) | Creates a new GRPC stream. | +| [Stream.on(event, handler)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-on) | Adds a new listener to one of the possible stream event's. | +| [Stream.write(message)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-write) | Writes a message to the stream. | +| [Stream.end()](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-end) | Signals to server that client finished sending. | ## Metrics diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/client/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/client/_index.md index bbd68385fa..def1c68d61 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/client/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/client/_index.md @@ -8,13 +8,13 @@ weight: 10 `Client` is a gRPC client that can interact with a gRPC server. -| Method | Description | -| ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | -| [Client.loadProtoset(protosetPath)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-loadprotoset) | Loads and parses the given protoset file to be made available for RPC requests. | -| [Client.connect(address [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-connect) | Opens a connection to the given gRPC server. | -| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-invoke) | Makes a unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/response). | -| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-close) | Close the connection to the gRPC service. | +| Method | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | +| [Client.loadProtoset(protosetPath)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-loadprotoset) | Loads and parses the given protoset file to be made available for RPC requests. | +| [Client.connect(address [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-connect) | Opens a connection to the given gRPC server. | +| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-invoke) | Makes a unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/response). | +| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/client/client-close) | Close the connection to the gRPC service. | ### Examples diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/client/client-invoke.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/client/client-invoke.md index 92bf6d22b7..e4747c8277 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/client/client-invoke.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/client/client-invoke.md @@ -17,12 +17,12 @@ error will be thrown. | ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | url | string | The gRPC method url to invoke, in the form `/package.Service/Method`, e.g. `/google.cloud.language.v1.LanguageService/AnalyzeSentiment`. The leading slash `/` is optional. | | request | object | The canonical request object, as-per the [Protobuf JSON Mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/params) object containing additional request parameters. | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/params) object containing additional request parameters. | ### Returns -| Type | Description | -| ---------- | ---------------------------------------------------------------------------------------------- | +| Type | Description | +| ---------- | -------------------------------------------------------------------------------------------------------------- | | `Response` | gRPC [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/response) object. | ### Examples diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/response.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/response.md index 5c8ea19d9a..a4c7401ed8 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/response.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/response.md @@ -7,13 +7,13 @@ weight: 30 # Response -| Name | Type | Description | -| ------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Name | Type | Description | +| ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Response.status` | number | The response gRPC status code. Use the gRPC [status constants](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/constants) to check equality. | -| `Response.message` | object | The successful protobuf message, serialized to JSON. Will be `null` if `status !== grpc.StatusOK`. | -| `Response.headers` | object | Key-value pairs representing all the metadata headers returned by the gRPC server. | -| `Response.trailers` | object | Key-value pairs representing all the metadata trailers returned by the gRPC server. | -| `Response.error` | object | If `status !== grpc.StatusOK` then the error protobuf message, serialized to JSON; otherwise `null`. | +| `Response.message` | object | The successful protobuf message, serialized to JSON. Will be `null` if `status !== grpc.StatusOK`. | +| `Response.headers` | object | Key-value pairs representing all the metadata headers returned by the gRPC server. | +| `Response.trailers` | object | Key-value pairs representing all the metadata trailers returned by the gRPC server. | +| `Response.error` | object | If `status !== grpc.StatusOK` then the error protobuf message, serialized to JSON; otherwise `null`. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/stream/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/stream/_index.md index e7404f8d96..e97b40e21f 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/stream/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/stream/_index.md @@ -9,9 +9,9 @@ weight: 30 Using a GRPC client creates a stream. An important note that the client should be already connected (client.connect called) to the server before creating a stream. -| Method | Description | -| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | -| [Stream(client, url, [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream) | Using a GRPC client creates a stream. | +| Method | Description | +| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | +| [Stream(client, url, [,params])](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream) | Using a GRPC client creates a stream. | | [Stream.write(message)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-write) | Writes a message to the stream. | | [Stream.on(event, handler)](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-on) | Set up handler functions for various events on the GRPC stream. | | [Stream.end()](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-end) | Signals to the server that the client has finished sending. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/stream/stream-on.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/stream/stream-on.md index 76701ea05b..e0d49b8aae 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/stream/stream-on.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/grpc/stream/stream-on.md @@ -15,11 +15,11 @@ Set up handler functions for various events on the GRPC stream. Possible events: -| Event name | Description | -| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| data | Emitted when the server sends data. | +| Event name | Description | +| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| data | Emitted when the server sends data. | | error | Emitted when an error occurs. In case of the error, an [`Error`](https://grafana.com/docs/k6//javascript-api/k6-experimental/grpc/stream/stream-error) object sends to the handler function. | -| end | Emitted when the server closes the incoming stream. | +| end | Emitted when the server closes the incoming stream. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/redis/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/redis/_index.md index b41df4f285..9d2b07a18d 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/redis/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/redis/_index.md @@ -18,9 +18,9 @@ With this module, you can: Though the API intends to be thorough and extensive, it does not expose the whole Redis API. Instead, the intent is to expose Redis for use cases most appropriate to k6. -| Class | Description | -| :-------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------- | -| [Client](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis/client) | Client that exposes allowed interactions with Redis. | +| Class | Description | +| :----------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Client](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis/client) | Client that exposes allowed interactions with Redis. | | [Options](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis/redis-options) | Options used to configure the behavior of the [Redis Client](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis/client). | ### Notes on usage diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/redis/redis-options.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/redis/redis-options.md index cc49f3f4d3..50f0da7c11 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/redis/redis-options.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/redis/redis-options.md @@ -12,36 +12,36 @@ You can configure the [Redis Client](https://grafana.com/docs/k6//ja The configuration for the overall Redis client, including authentication and connection settings. -| Option Name | Type | Description | -| ---------------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------- | -| socket | [SocketOptions](#socket-connection-options) | The configuration of the connection socket used to connect to the Redis server. | -| username | String (optional) | Username for client authentication. | -| password | String (optional) | Password for client authentication. | -| clientName | String (optional) | Name for the client connection. | -| database | Number (optional) | Database ID to select after connecting. | -| masterName | String (optional) | Master instance name for Sentinel. | -| sentinelUsername | String (optional) | Username for Sentinel authentication. | -| sentinelPassword | String (optional) | Password for Sentinel authentication. | -| cluster | [ClusterOptions](#redis-cluster-options) (optional) | The configuration for Redis Cluster connections. | +| Option Name | Type | Description | +| ---------------- | --------------------------------------------------- | ------------------------------------------------------------------------------- | +| socket | [SocketOptions](#socket-connection-options) | The configuration of the connection socket used to connect to the Redis server. | +| username | String (optional) | Username for client authentication. | +| password | String (optional) | Password for client authentication. | +| clientName | String (optional) | Name for the client connection. | +| database | Number (optional) | Database ID to select after connecting. | +| masterName | String (optional) | Master instance name for Sentinel. | +| sentinelUsername | String (optional) | Username for Sentinel authentication. | +| sentinelPassword | String (optional) | Password for Sentinel authentication. | +| cluster | [ClusterOptions](#redis-cluster-options) (optional) | The configuration for Redis Cluster connections. | ### Socket Connection Options Socket-level settings for connecting to a Redis server. -| Option Name | Type | Description | -| ------------------ | -------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| host | String | IP address or hostname of the Redis server. | -| port | Number (optional) | Port number of the Redis server. | -| tls | [TLSOptions](#tls-configuration-options) (optional) | The configuration for TLS/SSL. | -| dialTimeout | Number (optional, default is _5_ (seconds)) | Timeout for establishing a connection, in seconds. | -| readTimeout | Number (optional, default is _3_ (seconds)) | Timeout for socket reads, in seconds. A value of `-1` disables the timeout. | -| writeTimeout | Number (optional, default is `readTimeout`) | Timeout for socket writes, in seconds. A value of `-1` disables the timeout. | -| poolSize | Number (optional, default is _10_ (per CPU)) | Number of socket connections in the pool per CPU. | -| minIdleConns | Number (optional) | Minimum number of idle connections in the pool. | -| maxConnAge | Number (optional, default is _0_ (no maximum idle time)) | Maximum idle time before closing a connection. | -| poolTimeout | Number (optional, `readTimeout + 1`) | Timeout for acquiring a connection from the pool. | -| idleTimeout | Number (optional, `readTimeout + 1`) | Timeout for idle connections in the pool. | -| idleCheckFrequency | Number (optional, default is _1_ (minute)) | Frequency of idle connection checks, in minutes. A value of `-1` disables the checks. | +| Option Name | Type | Description | +| ------------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| host | String | IP address or hostname of the Redis server. | +| port | Number (optional) | Port number of the Redis server. | +| tls | [TLSOptions](#tls-configuration-options) (optional) | The configuration for TLS/SSL. | +| dialTimeout | Number (optional, default is _5_ (seconds)) | Timeout for establishing a connection, in seconds. | +| readTimeout | Number (optional, default is _3_ (seconds)) | Timeout for socket reads, in seconds. A value of `-1` disables the timeout. | +| writeTimeout | Number (optional, default is `readTimeout`) | Timeout for socket writes, in seconds. A value of `-1` disables the timeout. | +| poolSize | Number (optional, default is _10_ (per CPU)) | Number of socket connections in the pool per CPU. | +| minIdleConns | Number (optional) | Minimum number of idle connections in the pool. | +| maxConnAge | Number (optional, default is _0_ (no maximum idle time)) | Maximum idle time before closing a connection. | +| poolTimeout | Number (optional, `readTimeout + 1`) | Timeout for acquiring a connection from the pool. | +| idleTimeout | Number (optional, `readTimeout + 1`) | Timeout for idle connections in the pool. | +| idleCheckFrequency | Number (optional, default is _1_ (minute)) | Frequency of idle connection checks, in minutes. A value of `-1` disables the checks. | #### TLS Configuration Options @@ -57,10 +57,10 @@ Options for establishing a secure TLS connection. Options for behavior in a Redis Cluster setup. -| Option Name | Type | Description | -| -------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -| maxRedirects | Number (optional, default is _3_ retries) | Maximum number of command redirects. | -| readOnly | Boolean (optional) | Enables read-only mode for replicas. | -| routeByLatency | Boolean (optional) | Route read commands by latency. | -| routeRandomly | Boolean (optional) | Random routing for read commands. | +| Option Name | Type | Description | +| -------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------- | +| maxRedirects | Number (optional, default is _3_ retries) | Maximum number of command redirects. | +| readOnly | Boolean (optional) | Enables read-only mode for replicas. | +| routeByLatency | Boolean (optional) | Route read commands by latency. | +| routeRandomly | Boolean (optional) | Random routing for read commands. | | nodes | String[] or [SocketOptions](#socket-connection-options)[] | List of cluster nodes as URLs or [SocketOptions](#socket-connection-options). | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/_index.md index 8b9f1ae785..b785fa6779 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/_index.md @@ -19,8 +19,8 @@ A trace context generally consists of, at least, a `trace_id`, a `span_id`, and ## API -| Class/Function | Description | -| :------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------ | +| Class/Function | Description | +| :--------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------ | | [instrumentHTTP](https://grafana.com/docs/k6//javascript-api/k6-experimental/tracing/instrumenthttp) | instruments the k6 http module with tracing capabilities. | | [Client](https://grafana.com/docs/k6//javascript-api/k6-experimental/tracing/client) | configurable Client that exposes instrumented HTTP operations and allows selectively instrumenting requests with tracing. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/client.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/client.md index 94d361333d..91da5ed024 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/client.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/client.md @@ -64,8 +64,8 @@ export default () => { The `Client` class exposes the same API as the standard `http` module. Except for the `batch` method, which is absent from `Client`. The following table lists the `Client` methods which have an equivalent in the standard `http` module: -| Method | HTTP equivalent | Description | -| :--------------------------------------------------- | :--------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Method | HTTP equivalent | Description | +| :--------------------------------------------------- | :------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Client.del(url, [body], [params])` | [http.del](https://grafana.com/docs/k6//javascript-api/k6-http/del) | Performs an instrumented HTTP DELETE request. The method has the same prototype as the `http.del` function and should transparently act as a drop-in replacement for it. | | `Client.get(url, [params])` | [http.get](https://grafana.com/docs/k6//javascript-api/k6-http/get) | Performs an instrumented HTTP GET request. The method has the same prototype as the `http.get` function and should transparently act as a drop-in replacement for it. | | `Client.head(url, [params])` | [http.head](https://grafana.com/docs/k6//javascript-api/k6-http/head) | Performs an instrumented HTTP HEAD request. The method has the same prototype as the `http.head` function and should transparently act as a drop-in replacement for it. | @@ -80,6 +80,6 @@ The `Client` class exposes the same API as the standard `http` module. Except fo `Client` instances support being reconfigured using the following API: -| Method | Description | -| :-------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------- | +| Method | Description | +| :-------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Client.configure(options)` | Reconfigures the tracing client instance with the provided [`Options`](https://grafana.com/docs/k6//javascript-api/k6-experimental/tracing/options) | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/instrumenthttp.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/instrumenthttp.md index 75fc82a431..5cd23eaa0a 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/instrumenthttp.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/tracing/instrumenthttp.md @@ -15,8 +15,8 @@ From that point forward, all requests made by the HTTP module from that point fo ## Parameters -| Name | Type | Description | -| :-------- | :------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------- | +| Name | Type | Description | +| :-------- | :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `options` | [`Options`](https://grafana.com/docs/k6//javascript-api/k6-experimental/tracing/options) | Configures the tracing behavior with the provided [`Options`](https://grafana.com/docs/k6//javascript-api/k6-experimental/tracing/options) object. | ## Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/_index.md index a8c5702bfc..5ce88e97d2 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/_index.md @@ -17,10 +17,10 @@ The Web Crypto API is a JavaScript API for performing cryptographic operations s The module exports a top-level `crypto` object with the following properties and methods: -| Interface/Function | Description | -| :----------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [getRandomValues](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/crypto/getrandomvalues) | Fills the passed `TypedArray` with cryptographically sound random values. | -| [randomUUID](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/crypto/randomuuid) | Returns a randomly generated, 36 character long v4 UUID. | +| Interface/Function | Description | +| :-------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [getRandomValues](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/crypto/getrandomvalues) | Fills the passed `TypedArray` with cryptographically sound random values. | +| [randomUUID](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/crypto/randomuuid) | Returns a randomly generated, 36 character long v4 UUID. | | [subtle](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto) | The [SubtleCrypto](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto) interface provides access to common cryptographic primitives, such as hashing, signing, encryption, or decryption. | ## Example @@ -72,7 +72,10 @@ export default async function () { ciphertext ); - console.log('deciphered text == original plaintext: ', arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext)); + console.log( + 'deciphered text == original plaintext: ', + arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext) + ); } function arrayBufferToHex(buffer) { diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/crypto/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/crypto/_index.md index 2e0ea66454..59fcf662b1 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/crypto/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/crypto/_index.md @@ -11,15 +11,15 @@ weight: 01 ## Properties -| Name | Type | Description | -| :-------------- | :---------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------- | +| Name | Type | Description | +| :-------------- | :------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------- | | `Crypto.subtle` | [SubtleCrypto](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto) | The SubtleCrypto interface provides access to common cryptographic primitives, such as hashing, signing, encryption, or decryption. | ## Methods -| Name | Type | Description | -| :------------------------- | :---------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | -| `Crypto.getRandomValues()` | [ArrayBuffer] -(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) | Returns an array of cryptographically secure random values. | -| `Crypto.randomUUID()` | [ArrayBuffer] -(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) | Returns a randomly generated, 36 character long v4 UUID. | +| Name | Type | Description | +| :--------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | :---------- | +| `Crypto.getRandomValues()` | [ArrayBuffer] | +| (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) | Returns an array of cryptographically secure random values. | +| `Crypto.randomUUID()` | [ArrayBuffer] | +| (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) | Returns a randomly generated, 36 character long v4 UUID. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/_index.md index d417b41f2b..0b2ce0fea6 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/_index.md @@ -11,8 +11,8 @@ The `SubtleCrypto` interface provides a set of low-level cryptographic primitive ## Methods -| Method | Description | -| :--------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------- | +| Method | Description | +| :------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------- | | [encrypt](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto/encrypt) | Encrypts the given plaintext data using the specified algorithm and key. | | [decrypt](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto/decrypt) | Decrypts the given ciphertext data using the specified algorithm and key. | | [sign](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto/sign) | Signs the given data using the specified algorithm and key. | @@ -71,7 +71,10 @@ export default async function () { ciphertext ); - console.log('deciphered text == original plaintext: ', arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext)); + console.log( + 'deciphered text == original plaintext: ', + arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext) + ); } function arrayBufferToHex(buffer) { diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/decrypt.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/decrypt.md index 63008a427c..2a1979075b 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/decrypt.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/decrypt.md @@ -16,11 +16,11 @@ decrypt(algorithm, key, data) ## Parameters -| Name | Type | Description | -| :---------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Name | Type | Description | +| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `algorithm` | [AesCtrParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aesctrparams),[AesCbcParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aescbcparams), or [AesGcmParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aesgcmparams) object | Defines the algorithm to use and any extra-parameters. The values given for the extra parameters must match those used in the corresponding [encrypt] call. | -| `key` | [CryptoKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) | The [key](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) to use for decryption. | -| `data` | `ArrayBuffer`, `TypedArray`, or `DataView` | The encrypted data to be decrypted (also known as _ciphertext_). | +| `key` | [CryptoKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) | The [key](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) to use for decryption. | +| `data` | `ArrayBuffer`, `TypedArray`, or `DataView` | The encrypted data to be decrypted (also known as _ciphertext_). | ## Return Value @@ -82,7 +82,10 @@ export default async function () { ciphertext ); - console.log('deciphered text == original plaintext: ', arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext)); + console.log( + 'deciphered text == original plaintext: ', + arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext) + ); } function arrayBufferToHex(buffer) { diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/encrypt.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/encrypt.md index f8492290f8..f40998e2f8 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/encrypt.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/encrypt.md @@ -16,11 +16,11 @@ encrypt(algorithm, key, data) ## Parameters -| Name | Type | Description | -| :---------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------ | -| `algorithm` | [AesCtrParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aesctrparams),[AesCbcParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aescbcparams), or [AesGcmParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aesgcmparams) object | Defines the algorithm to use and any extra-parameters. | -| `key` | [CryptoKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) | The [key](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) to use for encryption. | -| `data` | `ArrayBuffer`, `TypedArray`, or `DataView` | The data to be encrypted (also known as "plaintext"). | +| Name | Type | Description | +| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------- | +| `algorithm` | [AesCtrParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aesctrparams),[AesCbcParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aescbcparams), or [AesGcmParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aesgcmparams) object | Defines the algorithm to use and any extra-parameters. | +| `key` | [CryptoKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) | The [key](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) to use for encryption. | +| `data` | `ArrayBuffer`, `TypedArray`, or `DataView` | The data to be encrypted (also known as "plaintext"). | ## Return Value @@ -82,7 +82,10 @@ export default async function () { ciphertext ); - console.log('deciphered text == original plaintext: ', arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext)); + console.log( + 'deciphered text == original plaintext: ', + arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext) + ); } function arrayBufferToHex(buffer) { diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/exportkey.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/exportkey.md index 8f7ebc1a99..a33b02be18 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/exportkey.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/exportkey.md @@ -18,9 +18,9 @@ exportKey(format, key) ## Parameters -| Name | Type | Description | -| :------- | :---------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------ | -| `format` | `string` | Defines the data format the key should be exported in. Currently supported formats: `raw`. | +| Name | Type | Description | +| :------- | :------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | +| `format` | `string` | Defines the data format the key should be exported in. Currently supported formats: `raw`. | | `key` | [CryptoKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) | The [key](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) to export. | ## Return Value @@ -63,7 +63,10 @@ export default async function () { /** * Reimport the key in raw format to verfiy its integrity. */ - const importedKey = await crypto.subtle.importKey('raw', exportedKey, 'AES-CBC', true, ['encrypt', 'decrypt']); + const importedKey = await crypto.subtle.importKey('raw', exportedKey, 'AES-CBC', true, [ + 'encrypt', + 'decrypt', + ]); console.log(JSON.stringify(importedKey)); } diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/generatekey.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/generatekey.md index 9f64487027..4030186a50 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/generatekey.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/generatekey.md @@ -16,11 +16,11 @@ generateKey(algorithm, extractable, keyUsages) ## Parameters -| Name | Type | Description | -| :------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Name | Type | Description | +| :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `algorithm` | `string`,[AesKeyGenParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aeskeygenparams) or [HmacKeyGenParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/hmackeygenparams) | The type of key to generate. Can be either a string with any of the currently supported algorithms: `AES-CBC`, `AES-GCM`, `AES-CTR`, and `HMAC` as value, or any of the [AesKeyGenParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/aeskeygenparams) or [HmacKeyGenParams](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/hmackeygenparams) objects. | -| `extractable` | `boolean` | Whether the key can be exported using [exportKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto/exportkey). | -| `keyUsages` | `Array` | An array of strings describing what operations can be performed with the key. Currently supported usages include `encrypt`, `decrypt`, `sign`, and `verify`. | +| `extractable` | `boolean` | Whether the key can be exported using [exportKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto/exportkey). | +| `keyUsages` | `Array` | An array of strings describing what operations can be performed with the key. Currently supported usages include `encrypt`, `decrypt`, `sign`, and `verify`. | ## Return Value diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/importkey.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/importkey.md index 877b38ce4f..b73c389838 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/importkey.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/importkey.md @@ -16,13 +16,13 @@ importKey(format, keyData, algorithm, extractable, keyUsages) ## Parameters -| Name | Type | Description | -| :------------ | :-------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `format` | `string` | Defines the data format of the key to import. Currently supported formats: `raw`. | -| `keyData` | `ArrayBuffer`, `TypedArray` or `DataView` | the data to import the key from. | -| `algorithm` | a `string` or object with a single `name` string property | The algorithm to use to import the key. Currently supported algorithms: `AES-CBC`, `AES-GCM`, `AES-CTR`, and `HMAC`. | +| Name | Type | Description | +| :------------ | :-------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `format` | `string` | Defines the data format of the key to import. Currently supported formats: `raw`. | +| `keyData` | `ArrayBuffer`, `TypedArray` or `DataView` | the data to import the key from. | +| `algorithm` | a `string` or object with a single `name` string property | The algorithm to use to import the key. Currently supported algorithms: `AES-CBC`, `AES-GCM`, `AES-CTR`, and `HMAC`. | | `extractable` | `boolean` | Indicates whether it will be possible to export the key using [exportKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/subtlecrypto/exportkey). | -| `keyUsages` | `Array` | An array of strings describing what operations can be performed with the key. Currently supported usages include `encrypt`, `decrypt`, `sign`, and `verify`. | +| `keyUsages` | `Array` | An array of strings describing what operations can be performed with the key. Currently supported usages include `encrypt`, `decrypt`, `sign`, and `verify`. | ## Return Value @@ -63,7 +63,10 @@ export default async function () { /** * Reimport the key in raw format to verfiy its integrity. */ - const importedKey = await crypto.subtle.importKey('raw', exportedKey, 'AES-CBC', true, ['encrypt', 'decrypt']); + const importedKey = await crypto.subtle.importKey('raw', exportedKey, 'AES-CBC', true, [ + 'encrypt', + 'decrypt', + ]); console.log(JSON.stringify(importedKey)); } diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/sign.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/sign.md index 1776e45160..439b766000 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/sign.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/sign.md @@ -16,11 +16,11 @@ sign(algorithm, key, data) ## Parameters -| Name | Type | Description | -| :---------- | :---------------------------------------------------------------------------------------- | :----------------------------------------------------------- | -| `algorithm` | `string` or object with a single `name` string property | The signature algorithm to use. Currently supported: `HMAC`. | +| Name | Type | Description | +| :---------- | :------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------- | +| `algorithm` | `string` or object with a single `name` string property | The signature algorithm to use. Currently supported: `HMAC`. | | `key` | [CryptoKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) | The key to use for signing. | -| `data` | `ArrayBuffer`, `TypedArray`, or `DataView` | The data to be signed. | +| `data` | `ArrayBuffer`, `TypedArray`, or `DataView` | The data to be signed. | ## Return Value diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/verify.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/verify.md index 4b6262fd0c..bd8c6c0aa8 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/verify.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/webcrypto/subtlecrypto/verify.md @@ -16,12 +16,12 @@ verify(algorithm, key, signature, data) ## Parameters -| Name | Type | Description | -| :---------- | :---------------------------------------------------------------------------------------- | :------------------------------------------------- | -| `algorithm` | `string` or object with a single `name` string property | The algorithm to use. Currently supported: `HMAC`. | +| Name | Type | Description | +| :---------- | :------------------------------------------------------------------------------------------------------- | :------------------------------------------------- | +| `algorithm` | `string` or object with a single `name` string property | The algorithm to use. Currently supported: `HMAC`. | | `key` | [CryptoKey](https://grafana.com/docs/k6//javascript-api/k6-experimental/webcrypto/cryptokey) | The key that will be used to verify the signature. | -| `signature` | `ArrayBuffer` | The signature to verify. | -| `data` | `ArrayBuffer` | The data whose signature is to be verified. | +| `signature` | `ArrayBuffer` | The signature to verify. | +| `data` | `ArrayBuffer` | The data whose signature is to be verified. | ## Return Value diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/_index.md index 0e69a4aa2a..a3237703a8 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/_index.md @@ -16,8 +16,8 @@ A global event loop lets a single VU have multiple concurrent connections, which The `WebSocket API` is not fully implemented, and we're working on it, but we believe it's usable for most users. So whether you're writing a new WebSocket test, or currently using the `k6/ws` module, we invite you to give it a try, and report any issues in the project's [issue tracker](https://github.com/grafana/xk6-websockets/). Our midterm goal is to make this module part of k6 core, and long-term to replace the [`k6/ws`](https://grafana.com/docs/k6//javascript-api/k6-ws) module. -| Class/Method | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- | +| Class/Method | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | [Params](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/params) | Used for setting various WebSocket connection parameters such as headers, cookie jar, compression, etc. | | [WebSocket(url, protocols, params)](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/websocket) | Constructs a new WebSocket connection. | | [WebSocket.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/websocket/websocket-close) | Close the WebSocket connection. | @@ -29,12 +29,12 @@ A WebSocket instance also has the following properties: -| Class/Property | Description | -| ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| WebSocket.readyState | The current state of the connection. Could be one of [the four states](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState). | -| WebSocket.url | The URL of the connection as resolved by the constructor. | -| WebSocket.bufferedAmount | The number of bytes of data that have been queued using calls to `send()` but not yet transmitted to the network. | -| WebSocket.binaryType | The [`binaryType`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/binaryType) is by default `"ArrayBuffer"`. Setting it throws an exception, as k6 does not support the Blob type. | +| Class/Property | Description | +| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| WebSocket.readyState | The current state of the connection. Could be one of [the four states](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState). | +| WebSocket.url | The URL of the connection as resolved by the constructor. | +| WebSocket.bufferedAmount | The number of bytes of data that have been queued using calls to `send()` but not yet transmitted to the network. | +| WebSocket.binaryType | The [`binaryType`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/binaryType) is by default `"ArrayBuffer"`. Setting it throws an exception, as k6 does not support the Blob type. | | [WebSocket.onmessage](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/websocket/websocket-onmessage) | A handler for `message` events. | | [WebSocket.onerror](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/websocket/websocket-onerror) | A handler for `error` events. | | [WebSocket.onopen](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/websocket/websocket-onopen) | A handler for `open` events. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/params.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/params.md index 24e3ffb22a..8e9a2d042a 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/params.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/params.md @@ -9,12 +9,12 @@ weight: 20 `Params` is an object used by the WebSocket constructor. The `Params` object contains request-specific options, such as headers that should be inserted into the connection initialization request. -| Name | Type | Description | -| -------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Params.compression` | string | Compression algorithm to be used by the WebSocket connection. The only supported algorithm currently is `deflate`. | -| `Params.jar` | [http.CookieJar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | The cookie jar that will be used when making the initial HTTP request to establish the WebSocket connection. If empty, the [default VU cookie jar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) will be used. | -| `Params.headers` | object | Custom HTTP headers in key-value pairs that will be added to the initial HTTP request to establish the WebSocket connection. Keys are header names and values are header values. | -| `Params.tags` | object | [Custom metric tags](https://grafana.com/docs/k6//using-k6/tags-and-groups#user-defined-tags) in key-value pairs where the keys are names of tags and the values are tag values. The WebSocket connection will [generate metrics samples](https://grafana.com/docs/k6//javascript-api/k6-ws/socket#websocket-built-in-metrics) with these tags attached, allowing users to filter the results data or set [thresholds on sub-metrics](https://grafana.com/docs/k6//using-k6/thresholds#thresholds-on-tags). | +| Name | Type | Description | +| -------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Params.compression` | string | Compression algorithm to be used by the WebSocket connection. The only supported algorithm currently is `deflate`. | +| `Params.jar` | [http.CookieJar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | The cookie jar that will be used when making the initial HTTP request to establish the WebSocket connection. If empty, the [default VU cookie jar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) will be used. | +| `Params.headers` | object | Custom HTTP headers in key-value pairs that will be added to the initial HTTP request to establish the WebSocket connection. Keys are header names and values are header values. | +| `Params.tags` | object | [Custom metric tags](https://grafana.com/docs/k6//using-k6/tags-and-groups#user-defined-tags) in key-value pairs where the keys are names of tags and the values are tag values. The WebSocket connection will [generate metrics samples](https://grafana.com/docs/k6//javascript-api/k6-ws/socket#websocket-built-in-metrics) with these tags attached, allowing users to filter the results data or set [thresholds on sub-metrics](https://grafana.com/docs/k6//using-k6/thresholds#thresholds-on-tags). | ### Example of custom metadata headers and tags diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/websocket/_index.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/websocket/_index.md index 879b143341..66c77925d3 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/websocket/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/websocket/_index.md @@ -16,10 +16,10 @@ The following events can close the connection: - [WebSocket.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/websocket/websocket-close). - k6 VU interruption based on test configuration or CLI commands. -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- | -| url | string | The URL to which to connect (e.g. "ws://localhost:10000"). | -| protocols | array | Not yet implemented, reserved for the future use. | +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | The URL to which to connect (e.g. "ws://localhost:10000"). | +| protocols | array | Not yet implemented, reserved for the future use. | | params | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/params) object containing additional request parameters. | ### Returns diff --git a/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/websocket/websocket-addeventlistener.md b/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/websocket/websocket-addeventlistener.md index 51ad70a7c7..8ba628b4bc 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/websocket/websocket-addeventlistener.md +++ b/docs/sources/v0.48.x/javascript-api/k6-experimental/websockets/websocket/websocket-addeventlistener.md @@ -13,14 +13,14 @@ Set up handler functions for various events on the WebSocket connection. You can | event | string | The event name to define a handler for. | | handler | function | The function to call when the event happens. | -| Event name | Description | -| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| open | Emitted when the connection is established. | -| message | Emitted when a message is received from the server. | -| ping | Emitted when a ping is received from the server. The client will automatically send back a `pong`. | -| pong | Emitted when a pong is received from the server. | +| Event name | Description | +| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| open | Emitted when the connection is established. | +| message | Emitted when a message is received from the server. | +| ping | Emitted when a ping is received from the server. The client will automatically send back a `pong`. | +| pong | Emitted when a pong is received from the server. | | close | Emitted when the connection is closed by the client [WebSocket.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/websockets/websocket/websocket-close) or when the server sends the `close` event with code status 1000 (normal closure). | -| error | Emitted when an error occurs. | +| error | Emitted when an error occurs. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/_index.md b/docs/sources/v0.48.x/javascript-api/k6-html/_index.md index e38aa296eb..68440dcdd5 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/_index.md @@ -1,5 +1,5 @@ --- -title: "k6/html" +title: 'k6/html' excerpt: 'The k6/html module contains functionality for HTML parsing.' weight: 08 --- @@ -8,11 +8,11 @@ weight: 08 The k6/html module contains functionality for HTML parsing. -| Function | Description | -| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| Function | Description | +| ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | [parseHTML(src)](https://grafana.com/docs/k6//javascript-api/k6-html/parsehtml) | Parse an HTML string and populate a [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) object. | -| Class | Description | -| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| Class | Description | +| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | An HTML DOM element as returned by the [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) API. | -| [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A jQuery-like API for accessing HTML DOM elements. | +| [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A jQuery-like API for accessing HTML DOM elements. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/element.md b/docs/sources/v0.48.x/javascript-api/k6-html/element.md index 3cfcd2c15d..cc72cfdfd1 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/element.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/element.md @@ -14,47 +14,47 @@ Use [Selection.get(index)](https://grafana.com/docs/k6//javascript-a The Element object provides a similar API to the [DOM Element API](https://developer.mozilla.org/en-US/Web/API/Element) to retrieve element information. -| Method | Description | -| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| nodeName | The name of the element. | -| nodeType | The type of the element. | -| nodeValue | The element value. | -| id | The id of the element. | -| innerHTML | Is a DOMString representing the markup of the element's content. | -| textContent | The element content. | -| ownerDocument | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| attributes | An array of attributes. | -| firstChild | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| lastChild | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| childElementCount | The number of children elements. | -| firstElementChild | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| lastElementChild | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| previousSibling | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| nextSibling | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| previousElementSibling | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| nextElementSibling | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| parentElement | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| parentNode | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| Method | Description | +| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| nodeName | The name of the element. | +| nodeType | The type of the element. | +| nodeValue | The element value. | +| id | The id of the element. | +| innerHTML | Is a DOMString representing the markup of the element's content. | +| textContent | The element content. | +| ownerDocument | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| attributes | An array of attributes. | +| firstChild | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| lastChild | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| childElementCount | The number of children elements. | +| firstElementChild | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| lastElementChild | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| previousSibling | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| nextSibling | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| previousElementSibling | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| nextElementSibling | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| parentElement | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | +| parentNode | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | | childNodes | Array of [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | | children | Array of [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | -| classList | An array of class names. | -| className | The class name string | -| lang | The value of the lang attribute. | -| toString | The element string representation. | -| hasAttribute | Boolean | -| getAttribute | getAttributeNode | -| hasAttributes | Boolean | -| hasChildNodes | Boolean | -| isSameNode | Boolean | -| isEqualNode | Boolean | +| classList | An array of class names. | +| className | The class name string | +| lang | The value of the lang attribute. | +| toString | The element string representation. | +| hasAttribute | Boolean | +| getAttribute | getAttributeNode | +| hasAttributes | Boolean | +| hasChildNodes | Boolean | +| isSameNode | Boolean | +| isEqualNode | Boolean | | getElementsByClassName | Return an array of [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element). | | getElementsByTagName | Return an array of [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element). | | querySelector | Returns the first [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) which matches the specified selector string relative to the element | | querySelectorAll | Returns all the [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) which matches the specified selector string relative to the element | -| contains | | -| matches | Returns a Boolean indicating whether or not the element would be selected by the specified selector string | -| namespaceURI | The namespace URI of the element. | -| isDefaultNamespace | Returns a Boolean indicating whether the element has the default namespace. | +| contains | | +| matches | Returns a Boolean indicating whether or not the element would be selected by the specified selector string | +| namespaceURI | The namespace URI of the element. | +| isDefaultNamespace | Returns a Boolean indicating whether the element has the default namespace. | Additionally, Element can provide more methods depending on the Element type. diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/parsehtml.md b/docs/sources/v0.48.x/javascript-api/k6-html/parsehtml.md index 978a050ee7..b8b03225f5 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/parsehtml.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/parsehtml.md @@ -15,8 +15,8 @@ Parse an HTML string and populate a [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/_index.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/_index.md index a2c048e1fa..e790d6ba73 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/_index.md @@ -17,42 +17,42 @@ Selections have a jQuery-compatible API, but with two caveats: (Note that the read-only nature of the DOM trees is purely to avoid a maintenance burden on code with seemingly no practical use - if a compelling use case is presented, modification can easily be implemented.) -| Method | Description | -| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| [Selection.attr(name)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-attr) | Get the value of an attribute for the first element in the Selection. | -| [Selection.children([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-children) | Get the children of each element in the set of matched elements, optionally filtered by a selector. | -| [Selection.closest(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-closest) | Get the first element that matches the selector by testing the element itself and traversing up through its ancestors | -| [Selection.contents()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-contents) | Get the children of each element in the set of matched elements, including text and comment nodes. | -| [Selection.data([key])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-data) | Return the value at the named data store for the first element in the set of matched elements. | -| [Selection.each(fn)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-each) | Iterate and execute a function for each matched element. | -| [Selection.eq(index)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-eq) | Reduce the set of matched elements to the one at the specified index. | -| [Selection.filter(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-filter) | Reduce the set of matched elements to those that match the selector or pass the function's test. | -| [Selection.find(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-find) | Find the selection descendants, filtered by a selector. | -| [Selection.first()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-first) | Reduce the set of matched elements to the first in the set. | -| [Selection.get(index)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-get) | Retrieve the [Element (k6/html)](https://grafana.com/docs/k6//javascript-api/k6-html/element) matched by the selector | -| [Selection.has(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-has) | Reduce the set of matched elements to those that have a descendant that matches the selector | -| [Selection.html()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-html) | Get the HTML contents of the first element in the set of matched elements | -| [Selection.is(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-is) | Check the current matched set of elements against a selector or element and return true if at least one of these elements matches the given arguments. | -| [Selection.last()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-last) | Reduce the set of matched elements to the final one in the set. | -| [Selection.map(fn)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-map) | Pass each selection in the current matched set through a function, producing a new Array containing the return values. | -| [Selection.nextAll([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-nextall) | Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. | -| [Selection.next([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-next) | Get the immediately following sibling of each element in the set of matched element | -| [Selection.nextUntil([selector], [filter])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-nextuntil) | Get all following siblings of each element up to but not including the element matched by the selector. | -| [Selection.not(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-not) | Remove elements from the set of matched elements | -| [Selection.parent([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-parent) | Get the parent of each element in the current set of matched elements, optionally filtered by a selector. | -| [Selection.parents([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-parents) | Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. | -| [Selection.parentsUntil([selector], [filter])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-parentsuntil) | Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector. | -| [Selection.prevAll([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-prevall) | Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. | -| [Selection.prev([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-prev) | Get the immediately preceding sibling of each element in the set of matched elements. | -| [Selection.prevUntil([selector], [filter])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-prevuntil) | Get all preceding siblings of each element up to but not including the element matched by the selector. | -| [Selection.serialize()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-serialize) | Encode a set of form elements as a string in standard URL-encoded notation for submission. | -| [Selection.serializeArray()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-serializearray) | Encode a set of form elements as an array of names and values. | -| [Selection.serializeObject()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-serializeobject) | Encode a set of form elements as an object. | -| [Selection.size()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-size) | Return the number of elements in the Selection. | -| [Selection.slice(start [, end])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-slice) | Reduce the set of matched elements to a subset specified by a range of indices. | -| [Selection.text()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-text) | Get the text content of the selection. | -| [Selection.toArray()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-toarray) | Retrieve all the elements contained in the Selection, as an array. | -| [Selection.val()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-val) | Get the current value of the first element in the set of matched elements. | +| Method | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [Selection.attr(name)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-attr) | Get the value of an attribute for the first element in the Selection. | +| [Selection.children([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-children) | Get the children of each element in the set of matched elements, optionally filtered by a selector. | +| [Selection.closest(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-closest) | Get the first element that matches the selector by testing the element itself and traversing up through its ancestors | +| [Selection.contents()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-contents) | Get the children of each element in the set of matched elements, including text and comment nodes. | +| [Selection.data([key])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-data) | Return the value at the named data store for the first element in the set of matched elements. | +| [Selection.each(fn)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-each) | Iterate and execute a function for each matched element. | +| [Selection.eq(index)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-eq) | Reduce the set of matched elements to the one at the specified index. | +| [Selection.filter(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-filter) | Reduce the set of matched elements to those that match the selector or pass the function's test. | +| [Selection.find(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-find) | Find the selection descendants, filtered by a selector. | +| [Selection.first()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-first) | Reduce the set of matched elements to the first in the set. | +| [Selection.get(index)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-get) | Retrieve the [Element (k6/html)](https://grafana.com/docs/k6//javascript-api/k6-html/element) matched by the selector | +| [Selection.has(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-has) | Reduce the set of matched elements to those that have a descendant that matches the selector | +| [Selection.html()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-html) | Get the HTML contents of the first element in the set of matched elements | +| [Selection.is(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-is) | Check the current matched set of elements against a selector or element and return true if at least one of these elements matches the given arguments. | +| [Selection.last()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-last) | Reduce the set of matched elements to the final one in the set. | +| [Selection.map(fn)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-map) | Pass each selection in the current matched set through a function, producing a new Array containing the return values. | +| [Selection.nextAll([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-nextall) | Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. | +| [Selection.next([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-next) | Get the immediately following sibling of each element in the set of matched element | +| [Selection.nextUntil([selector], [filter])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-nextuntil) | Get all following siblings of each element up to but not including the element matched by the selector. | +| [Selection.not(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-not) | Remove elements from the set of matched elements | +| [Selection.parent([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-parent) | Get the parent of each element in the current set of matched elements, optionally filtered by a selector. | +| [Selection.parents([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-parents) | Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. | +| [Selection.parentsUntil([selector], [filter])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-parentsuntil) | Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector. | +| [Selection.prevAll([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-prevall) | Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. | +| [Selection.prev([selector])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-prev) | Get the immediately preceding sibling of each element in the set of matched elements. | +| [Selection.prevUntil([selector], [filter])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-prevuntil) | Get all preceding siblings of each element up to but not including the element matched by the selector. | +| [Selection.serialize()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-serialize) | Encode a set of form elements as a string in standard URL-encoded notation for submission. | +| [Selection.serializeArray()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-serializearray) | Encode a set of form elements as an array of names and values. | +| [Selection.serializeObject()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-serializeobject) | Encode a set of form elements as an object. | +| [Selection.size()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-size) | Return the number of elements in the Selection. | +| [Selection.slice(start [, end])](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-slice) | Reduce the set of matched elements to a subset specified by a range of indices. | +| [Selection.text()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-text) | Get the text content of the selection. | +| [Selection.toArray()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-toarray) | Retrieve all the elements contained in the Selection, as an array. | +| [Selection.val()](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-val) | Get the current value of the first element in the set of matched elements. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-children.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-children.md index 3d9b1afb92..d36d8b9fbf 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-children.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-children.md @@ -14,8 +14,8 @@ Mimics [jquery.children](https://api.jquery.com/children/) ### Returns -| Type | Description | -| ---------------------------------------------- | ----------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | ----------------------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | The children Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-closest.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-closest.md index cde0199a4b..19a758fb04 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-closest.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-closest.md @@ -14,8 +14,8 @@ Mimics [jquery.closest](https://api.jquery.com/closest/) ### Returns -| Type | Description | -| ---------------------------------------------- | ----------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | ----------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-contents.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-contents.md index 8ae9614974..3c62ce2575 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-contents.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-contents.md @@ -10,8 +10,8 @@ Mimics [jquery.contents](https://api.jquery.com/contents/). ### Returns -| Type | Description | -| ---------------------------------------------- | ----------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | ----------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-eq.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-eq.md index f29198574f..2023988283 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-eq.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-eq.md @@ -14,8 +14,8 @@ Mimics [jquery.eq](https://api.jquery.com/eq/). ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-filter.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-filter.md index ad9c84ec05..0da40c2f83 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-filter.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-filter.md @@ -8,16 +8,16 @@ excerpt: 'Reduce the set of matched elements to those that match the selector or Reduce the set of matched elements to those that match the selector or pass the function's test. Mimics [jquery.filter](https://api.jquery.com/filter/) -| Parameter | Type | Description | -| --------- | ---------------------------------------------- | -------------------------------------------------------------------- | -| selector | function | A function used as a test for each element in the set. | -| selector | string | A string containing a selector expression to match elements against. | +| Parameter | Type | Description | +| --------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | +| selector | function | A function used as a test for each element in the set. | +| selector | string | A string containing a selector expression to match elements against. | | selector | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A selection to match elements against. | ### Returns -| Type | Description | -| ---------------------------------------------- | --------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | --------------------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | The filter selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-find.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-find.md index f6f18f1db8..ed9c3609d1 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-find.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-find.md @@ -14,8 +14,8 @@ Mimics [jquery.find](https://api.jquery.com/find/) ### Returns -| Type | Description | -| ---------------------------------------------- | ----------------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | ----------------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | Selection object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-first.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-first.md index 0eda888cb9..e6979c4bdb 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-first.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-first.md @@ -10,8 +10,8 @@ Mimics [jquery.first](https://api.jquery.com/first/). ### Returns -| Type | Description | -| ---------------------------------------------- | ----------------------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | ----------------------------------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | The first element of the Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-has.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-has.md index 6efc62ec25..e920037dbf 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-has.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-has.md @@ -14,8 +14,8 @@ Mimics [jquery.has](https://api.jquery.com/has/). ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-is.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-is.md index a2f55c1676..30b0b14728 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-is.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-is.md @@ -8,16 +8,16 @@ excerpt: 'Check the current matched set of elements against a selector or elemen Check the current matched set of elements against a selector or element and return true if at least one of these elements matches the given arguments. Mimics [jquery.is](https://api.jquery.com/is/) -| Parameter | Type | Description | -| --------- | ---------------------------------------------- | -------------------------------------------------------------------- | -| selector | function | A function used as a test for each element in the set | -| selector | string | A string containing a selector expression to match elements against. | +| Parameter | Type | Description | +| --------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | +| selector | function | A function used as a test for each element in the set | +| selector | string | A string containing a selector expression to match elements against. | | selector | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A selection. | ### Returns -| Type | Description | -| ---------------------------------------------- | --------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | --------------------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | The filter selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-last.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-last.md index 020d22f0d4..c2b3eafbff 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-last.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-last.md @@ -10,8 +10,8 @@ Mimics [jquery.last](https://api.jquery.com/last/). ### Returns -| Type | Description | -| ---------------------------------------------- | ----------------------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | ----------------------------------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | The final element of the Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-next.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-next.md index 64eddca992..5cc01517aa 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-next.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-next.md @@ -15,8 +15,8 @@ Mimics [jquery.next](https://api.jquery.com/next/). ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-nextall.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-nextall.md index 33233c6b00..dc4eff8fef 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-nextall.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-nextall.md @@ -14,8 +14,8 @@ Mimics [jquery.nextAll](https://api.jquery.com/nextAll/). ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-nextuntil.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-nextuntil.md index d1466df9d5..a083f55010 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-nextuntil.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-nextuntil.md @@ -8,15 +8,15 @@ excerpt: 'Get all following siblings of each element in the set of matched eleme Get all following siblings of each element up to but not including the element matched by the selector. Mimics [jquery.nextUntil](https://api.jquery.com/nextUntil/) -| Parameter | Type | Description | -| ------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------- | +| Parameter | Type | Description | +| ------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | selector (optional) | string \| [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) \| `null` | A selector expression or object to match elements against. | -| filter (optional) | string \| `null` | A selector expression to filter matched elements. | +| filter (optional) | string \| `null` | A selector expression to filter matched elements. | ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-not.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-not.md index 433ca886f5..9ddbea79f5 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-not.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-not.md @@ -15,8 +15,8 @@ Mimics [jquery.not](https://api.jquery.com/not/) ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parent.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parent.md index 562b1cc70d..68a5e6c072 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parent.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parent.md @@ -14,8 +14,8 @@ Mimics [jquery.parent](https://api.jquery.com/parent/). ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parents.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parents.md index 12241b8841..3fa1f46ec7 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parents.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parents.md @@ -14,8 +14,8 @@ Mimics [jquery.parents](https://api.jquery.com/parents/). ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parentsuntil.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parentsuntil.md index eedf8463e0..1fb8d59496 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parentsuntil.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-parentsuntil.md @@ -8,15 +8,15 @@ excerpt: 'Get the ancestors of each element in the current set of matched elemen Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector. Mimics [jquery.parentsUntil](https://api.jquery.com/parentsUntil/) -| Parameter | Type | Description | -| ------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------- | +| Parameter | Type | Description | +| ------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | selector (optional) | string \| [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) \| `null` | A selector expression or object to match elements against. | -| filter (optional) | string \| `null` | A selector expression to filter matched elements. | +| filter (optional) | string \| `null` | A selector expression to filter matched elements. | ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prev.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prev.md index 57c021f713..8ef594dd27 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prev.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prev.md @@ -14,8 +14,8 @@ Mimics [jquery.prev](https://api.jquery.com/prev/). ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prevall.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prevall.md index 990a3c003d..d71f3943e1 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prevall.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prevall.md @@ -14,8 +14,8 @@ Mimics [jquery.prevAll](https://api.jquery.com/prevAll/). ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prevuntil.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prevuntil.md index d0d4bda701..8537c165d3 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prevuntil.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-prevuntil.md @@ -8,15 +8,15 @@ excerpt: 'Get all preceding siblings of each element up to but not including the Get all preceding siblings of each element up to but not including the element matched by the selector. Mimics [jquery.prevUntil](https://api.jquery.com/prevUntil/). -| Parameter | Type | Description | -| ------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------- | +| Parameter | Type | Description | +| ------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | selector (optional) | string \| [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) \| `null` | A selector expression or object to match elements against. | -| filter (optional) | string \| `null` | A selector expression to filter matched elements. | +| filter (optional) | string \| `null` | A selector expression to filter matched elements. | ### Returns -| Type | Description | -| ---------------------------------------------- | ------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-slice.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-slice.md index d087f363fc..9b69a0ddaa 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-slice.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-slice.md @@ -8,16 +8,16 @@ excerpt: 'Reduce the set of matched elements to a subset specified by a range of Reduce the set of matched elements to a subset specified by a range of indices. Mimics [jquery.slice](https://api.jquery.com/slice/) -| Parameter | Type | Description | -| --------- | ---------------------------------------------- | -------------------------------------------------------------------------------------- | -| start | Number | An integer indicating the 0-based position at which the elements begin to be selected. | -| end | Number | An integer indicating the 0-based position at which the elements stop being selected. | +| Parameter | Type | Description | +| --------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| start | Number | An integer indicating the 0-based position at which the elements begin to be selected. | +| end | Number | An integer indicating the 0-based position at which the elements stop being selected. | | selector | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A selection. | ### Returns -| Type | Description | -| ---------------------------------------------- | ------------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | The new selection. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-toarray.md b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-toarray.md index af4e6318e9..014b8bdd0e 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-toarray.md +++ b/docs/sources/v0.48.x/javascript-api/k6-html/selection/selection-toarray.md @@ -10,8 +10,8 @@ Mimics [jquery.toArray](https://api.jquery.com/toArray/). ### Returns -| Type | Description | -| ------------------------------------------------------- | --------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------- | --------------------------- | | Array of [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | Array of Selection objects. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/_index.md b/docs/sources/v0.48.x/javascript-api/k6-http/_index.md index 3b9d73b143..8e8e7198bb 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/_index.md @@ -8,26 +8,26 @@ weight: 09 The k6/http module contains functionality for performing HTTP transactions. -| Function | Description | -| --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| [batch( requests )](https://grafana.com/docs/k6//javascript-api/k6-http/batch) | Issue multiple HTTP requests in parallel (like e.g. browsers tend to do). | -| [cookieJar()](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar-method) | Get active HTTP Cookie jar. | -| [del( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/del) | Issue an HTTP DELETE request. | -| [file( data, [filename], [contentType] )](https://grafana.com/docs/k6//javascript-api/k6-http/file) | Create a file object that is used for building multi-part requests. | -| [get( url, [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/get) | Issue an HTTP GET request. | -| [head( url, [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/head) | Issue an HTTP HEAD request. | -| [options( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/options) | Issue an HTTP OPTIONS request. | -| [patch( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/patch) | Issue an HTTP PATCH request. | -| [post( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/post) | Issue an HTTP POST request. | -| [put( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/put) | Issue an HTTP PUT request. | -| [request( method, url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/request) | Issue any type of HTTP request. | -| [asyncRequest( method, url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/asyncrequest) | Issue any type of HTTP request asynchronously. | -| [setResponseCallback(expectedStatuses)](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback) | Sets a response callback to mark responses as expected. | +| Function | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | +| [batch( requests )](https://grafana.com/docs/k6//javascript-api/k6-http/batch) | Issue multiple HTTP requests in parallel (like e.g. browsers tend to do). | +| [cookieJar()](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar-method) | Get active HTTP Cookie jar. | +| [del( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/del) | Issue an HTTP DELETE request. | +| [file( data, [filename], [contentType] )](https://grafana.com/docs/k6//javascript-api/k6-http/file) | Create a file object that is used for building multi-part requests. | +| [get( url, [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/get) | Issue an HTTP GET request. | +| [head( url, [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/head) | Issue an HTTP HEAD request. | +| [options( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/options) | Issue an HTTP OPTIONS request. | +| [patch( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/patch) | Issue an HTTP PATCH request. | +| [post( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/post) | Issue an HTTP POST request. | +| [put( url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/put) | Issue an HTTP PUT request. | +| [request( method, url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/request) | Issue any type of HTTP request. | +| [asyncRequest( method, url, [body], [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/asyncrequest) | Issue any type of HTTP request asynchronously. | +| [setResponseCallback(expectedStatuses)](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback) | Sets a response callback to mark responses as expected. | | [url\`url\`](https://grafana.com/docs/k6//javascript-api/k6-http/url) | Creates a URL with a name tag. Read more on [URL Grouping](https://grafana.com/docs/k6//using-k6/http-requests#url-grouping). | -| [expectedStatuses( statusCodes )](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) | Create a callback for setResponseCallback that checks status codes. | +| [expectedStatuses( statusCodes )](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) | Create a callback for setResponseCallback that checks status codes. | -| Class | Description | -| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| Class | Description | +| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | [CookieJar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | Used for storing cookies, set by the server and/or added by the client. | | [FileData](https://grafana.com/docs/k6//javascript-api/k6-http/filedata) | Used for wrapping data representing a file when doing multipart requests (file uploads). | | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) | Used for setting various HTTP request-specific parameters such as headers, cookies, etc. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/asyncrequest.md b/docs/sources/v0.48.x/javascript-api/k6-http/asyncrequest.md index 76fbc7a217..e79c2648cf 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/asyncrequest.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/asyncrequest.md @@ -7,17 +7,17 @@ weight: 10 # asyncRequest( method, url, [body], [params] ) -| Parameter | Type | Description | -| ----------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| method | string | Request method (e.g. `'POST'`). Must be uppercase. | -| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `'http://example.com'`). | -| body (optional) | string / object / ArrayBuffer | Request body. Objects will be `x-www-form-urlencoded` encoded. | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | +| Parameter | Type | Description | +| ----------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| method | string | Request method (e.g. `'POST'`). Must be uppercase. | +| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `'http://example.com'`). | +| body (optional) | string / object / ArrayBuffer | Request body. Objects will be `x-www-form-urlencoded` encoded. | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | ### Returns -| Type | Description | -| --------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| --------------------- | ------------------------------------------------------------------------------------------------- | | Promise with Response | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Examples @@ -86,6 +86,6 @@ function randomInt(min, max) { In the preceding script, after `res` gets the value from the fastest request, the other requests will continue to execute. This might block the end of the iteration, because the iteration only stops once all async jobs finish. - {{% /admonition %}} +{{% /admonition %}} {{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/batch.md b/docs/sources/v0.48.x/javascript-api/k6-http/batch.md index 3af493b8cd..81ae77c80d 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/batch.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/batch.md @@ -37,12 +37,12 @@ Note the `Position` column for the correct order. {{% /admonition %}} -| Array position | Name | Type | Description | -| -------------- | ----------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| 1 | method | string | Mandatory. The HTTP method of the request. One of GET, POST, PUT, PATCH, DELETE, HEAD or OPTION. | +| Array position | Name | Type | Description | +| -------------- | ----------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| 1 | method | string | Mandatory. The HTTP method of the request. One of GET, POST, PUT, PATCH, DELETE, HEAD or OPTION. | | 2 | url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Mandatory. The URL to request. | -| 3 | body (optional) | string / object / ArrayBuffer | The body of the request if relevant. Can be set to `null` if not applicable but you want to set the last `params` argument. | -| 4 | params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) like auth, custom headers and tags. | +| 3 | body (optional) | string / object / ArrayBuffer | The body of the request if relevant. Can be set to `null` if not applicable but you want to set the last `params` argument. | +| 4 | params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) like auth, custom headers and tags. | #### String @@ -50,8 +50,8 @@ If you pass an array of string values, k6 automatically parses them into a batch ### Returns -| Type | Description | -| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | object | The returned object contains [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) objects.

It is an array when users pass an array as `requests`, and is an ordinary object with string keys when named requests are used (see below). | ### Example with arrays diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/cookiejar.md b/docs/sources/v0.48.x/javascript-api/k6-http/cookiejar.md index 352b2eb3cc..08ca682d8d 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/cookiejar.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/cookiejar.md @@ -9,8 +9,8 @@ weight: 10 Get the active cookie jar. -| Type | Description | -| ----------------------------------------------------------------------- | ------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------------- | | [CookieJar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | A CookieJar object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/cookiejar/_index.md b/docs/sources/v0.48.x/javascript-api/k6-http/cookiejar/_index.md index 2deb7a0021..cb001cf382 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/cookiejar/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/cookiejar/_index.md @@ -8,12 +8,12 @@ weight: 60 _CookieJar_ is an object for storing cookies that are set by the server, added by the client, or both. As described in the how-to guide on using [Cookies](https://grafana.com/docs/k6//using-k6/cookies), k6 handles cookies automatically by default. If you need more control over cookies you can however create your own cookie jar and select it as the active jar (instead of the default one created by k6) for one or more requests. -| Method | Description | -| ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -| [cookiesForURL(url)](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl) | Get Object of cookies where the key is the cookie name and the value is an array. | +| Method | Description | +| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| [cookiesForURL(url)](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl) | Get Object of cookies where the key is the cookie name and the value is an array. | | [set(url, name, value, [options])](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar/cookiejar-set) | Set a cookie in the jar by specifying name, value and some other optional settings like domain, path etc. | -| [clear(url)](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar/cookiejar-clear) | Delete all cookies for the given URL. | -| [delete(url, name)](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar/cookiejar-delete) | Deletes the `name` cookie for the given URL. | +| [clear(url)](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar/cookiejar-clear) | Delete all cookies for the given URL. | +| [delete(url, name)](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar/cookiejar-delete) | Deletes the `name` cookie for the given URL. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/del.md b/docs/sources/v0.48.x/javascript-api/k6-http/del.md index feac8c3f6d..4cf308c7a1 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/del.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/del.md @@ -9,16 +9,16 @@ weight: 10 Make a DELETE request. -| Parameter | Type | Description | -| ---------------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Parameter | Type | Description | +| ---------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | -| body (optional, discouraged) | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. This is discouraged, because sending a DELETE request with a body has [no defined semantics](https://tools.ietf.org/html/rfc7231#section-4.3.5) and may cause some servers to reject it. | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | +| body (optional, discouraged) | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. This is discouraged, because sending a DELETE request with a body has [no defined semantics](https://tools.ietf.org/html/rfc7231#section-4.3.5) and may cause some servers to reject it. | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | ### Returns -| Type | Description | -| -------- | --------------------------------------------------------------------------------- | +| Type | Description | +| -------- | ------------------------------------------------------------------------------------------------- | | Response | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/expected-statuses.md b/docs/sources/v0.48.x/javascript-api/k6-http/expected-statuses.md index d297a977a1..8fbd345b64 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/expected-statuses.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/expected-statuses.md @@ -23,7 +23,9 @@ You can have as many arguments as wanted in any order. import http from 'k6/http'; // setting some pretty strange status codes as expected -http.setResponseCallback(http.expectedStatuses(406, 500, { min: 200, max: 204 }, 302, { min: 305, max: 405 })); +http.setResponseCallback( + http.expectedStatuses(406, 500, { min: 200, max: 204 }, 302, { min: 305, max: 405 }) +); export default () => { // this one will actually be marked as failed as it doesn't match any of the above listed status diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/file.md b/docs/sources/v0.48.x/javascript-api/k6-http/file.md index 91e2c18125..3baaf3f6d0 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/file.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/file.md @@ -17,8 +17,8 @@ Create a file object that is used for building [Multipart requests (file uploads ### Returns -| Type | Description | -| --------------------------------------------------------------------- | ------------------ | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------ | | [FileData](https://grafana.com/docs/k6//javascript-api/k6-http/filedata) | A FileData object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/get.md b/docs/sources/v0.48.x/javascript-api/k6-http/get.md index d1d6e8d631..4fcbb696d1 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/get.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/get.md @@ -9,15 +9,15 @@ weight: 10 Make a GET request. -| Parameter | Type | Description | -| ----------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | +| Parameter | Type | Description | +| ----------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | --------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP Response object. | ### Example fetching a URL diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/head.md b/docs/sources/v0.48.x/javascript-api/k6-http/head.md index 51856cdea1..fa9c1cd9a6 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/head.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/head.md @@ -9,15 +9,15 @@ weight: 10 Make a HEAD request. -| Parameter | Type | Description | -| ----------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | +| Parameter | Type | Description | +| ----------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | --------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP Response object. | ### Example fetching a URL diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/options.md b/docs/sources/v0.48.x/javascript-api/k6-http/options.md index 0e9fe9e228..84cb17baa9 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/options.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/options.md @@ -7,16 +7,16 @@ weight: 10 # options( url, [body], [params] ) -| Parameter | Type | Description | -| ----------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | -| body (optional) | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | +| Parameter | Type | Description | +| ----------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | +| body (optional) | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | ### Returns -| Type | Description | -| -------- | --------------------------------------------------------------------------------- | +| Type | Description | +| -------- | ------------------------------------------------------------------------------------------------- | | Response | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/params.md b/docs/sources/v0.48.x/javascript-api/k6-http/params.md index 36ba52287e..64713724d9 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/params.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/params.md @@ -9,18 +9,18 @@ weight: 60 _Params_ is an object used by the http.\* methods that generate HTTP requests. _Params_ contains request-specific options like e.g. HTTP headers that should be inserted into the request. -| Name | Type | Description | -| ------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Params.auth` | string | The authentication method used for the request. It currently supports `digest`, `ntlm`, and `basic` authentication methods. | -| `Params.cookies` | object | Object with key-value pairs representing request scoped cookies (they won't be added to VU cookie jar)
`{cookies: { key: "val", key2: "val2" }}`

You also have the option to say that a request scoped cookie should override a cookie in the VU cookie jar:
`{cookies: { key: { value: "val", replace: true }}}` | -| `Params.headers` | object | Object with key-value pairs representing custom HTTP headers the user would like to add to the request. | -| `Params.jar` | object | http.CookieJar object to override default VU cookie jar with. Cookies added to request will be sourced from this jar and cookies set by server will be added to this jar. | -| `Params.redirects` | number | The number of redirects to follow for this request. Overrides the global test option [`maxRedirects`](https://grafana.com/docs/k6//using-k6/k6-options/reference). | -| `Params.tags` | object | Key-value pairs where the keys are names of tags and the values are tag values. Response time metrics generated as a result of the request will have these tags added to them, allowing the user to filter out those results specifically, when looking at results data. | -| `Params.timeout` | string / number | Maximum time to wait for the request to complete. Default timeout is 60 seconds (`"60s"`).
The type can also be a number, in which case k6 interprets it as milliseconds, e.g., `60000` is equivalent to `"60s"`. | -| `Params.compression` | string | Sets whether the request body should be compressed. If set to `gzip` it will use gzip to compress the body and set the appropriate `Content-Length` and `Content-Encoding` headers.

Possible values: `gzip`, `deflate`, `br`, `zstd`, and any comma-separated combination of them (for stacked compression) | -| `Params.responseType` | string | ResponseType is used to specify how to treat the body of the response. The three options are:
- text: k6 will return it as a string. This might not be what you want in cases of binary data as the conversation to UTF-16 will probably break it. This is also the default if
[discardResponseBodies](https://grafana.com/docs/k6//using-k6/k6-options/reference) is set to false or not set at all.
- `binary`: k6 will return an ArrayBuffer object
- `none`: k6 will return null as the body. The whole body will be ignored. This is the default when [discardResponseBodies](https://grafana.com/docs/k6//using-k6/k6-options/reference) is set to true. | -| `Params.responseCallback` | [expectedStatuses](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) | sets a [responseCallback](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback) only for this request. For performance reasons it's better to initialize it once and reference it for each time the same callback will need to be used | +| Name | Type | Description | +| ------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Params.auth` | string | The authentication method used for the request. It currently supports `digest`, `ntlm`, and `basic` authentication methods. | +| `Params.cookies` | object | Object with key-value pairs representing request scoped cookies (they won't be added to VU cookie jar)
`{cookies: { key: "val", key2: "val2" }}`

You also have the option to say that a request scoped cookie should override a cookie in the VU cookie jar:
`{cookies: { key: { value: "val", replace: true }}}` | +| `Params.headers` | object | Object with key-value pairs representing custom HTTP headers the user would like to add to the request. | +| `Params.jar` | object | http.CookieJar object to override default VU cookie jar with. Cookies added to request will be sourced from this jar and cookies set by server will be added to this jar. | +| `Params.redirects` | number | The number of redirects to follow for this request. Overrides the global test option [`maxRedirects`](https://grafana.com/docs/k6//using-k6/k6-options/reference). | +| `Params.tags` | object | Key-value pairs where the keys are names of tags and the values are tag values. Response time metrics generated as a result of the request will have these tags added to them, allowing the user to filter out those results specifically, when looking at results data. | +| `Params.timeout` | string / number | Maximum time to wait for the request to complete. Default timeout is 60 seconds (`"60s"`).
The type can also be a number, in which case k6 interprets it as milliseconds, e.g., `60000` is equivalent to `"60s"`. | +| `Params.compression` | string | Sets whether the request body should be compressed. If set to `gzip` it will use gzip to compress the body and set the appropriate `Content-Length` and `Content-Encoding` headers.

Possible values: `gzip`, `deflate`, `br`, `zstd`, and any comma-separated combination of them (for stacked compression) | +| `Params.responseType` | string | ResponseType is used to specify how to treat the body of the response. The three options are:
- text: k6 will return it as a string. This might not be what you want in cases of binary data as the conversation to UTF-16 will probably break it. This is also the default if
[discardResponseBodies](https://grafana.com/docs/k6//using-k6/k6-options/reference) is set to false or not set at all.
- `binary`: k6 will return an ArrayBuffer object
- `none`: k6 will return null as the body. The whole body will be ignored. This is the default when [discardResponseBodies](https://grafana.com/docs/k6//using-k6/k6-options/reference) is set to true. | +| `Params.responseCallback` | [expectedStatuses](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) | sets a [responseCallback](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback) only for this request. For performance reasons it's better to initialize it once and reference it for each time the same callback will need to be used | ### Example of custom HTTP headers and tags @@ -58,7 +58,7 @@ const url2 = 'https://httpbin.test.k6.io/get'; const apiToken = 'f232831bda15dd233c53b9c548732c0197619a3d3c451134d9abded7eb5bb195'; const requestHeaders = { 'User-Agent': 'k6', - Authorization: 'Token ' + apiToken, + 'Authorization': 'Token ' + apiToken, }; export default function () { diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/patch.md b/docs/sources/v0.48.x/javascript-api/k6-http/patch.md index 87f1d6617f..cf97fd0022 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/patch.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/patch.md @@ -7,16 +7,16 @@ weight: 10 # patch( url, [body], [params] ) -| Parameter | Type | Description | -| ----------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | -| body (optional) | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters | +| Parameter | Type | Description | +| ----------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | +| body (optional) | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | --------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP Response object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/post.md b/docs/sources/v0.48.x/javascript-api/k6-http/post.md index b6616b4291..76b6c6cc80 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/post.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/post.md @@ -7,16 +7,16 @@ weight: 10 # post( url, [body], [params] ) -| Parameter | Type | Description | -| ------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -| `url` | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | -| `body` | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. | -| `params` (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters | +| Parameter | Type | Description | +| ------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `url` | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | +| `body` | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. | +| `params` (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters | ### Returns -| Type | Description | -| ---------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ---------- | ------------------------------------------------------------------------------------------------- | | `Response` | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/put.md b/docs/sources/v0.48.x/javascript-api/k6-http/put.md index 9653051960..2ba93522f9 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/put.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/put.md @@ -7,16 +7,16 @@ weight: 10 # put( url, [body], [params] ) -| Parameter | Type | Description | -| ----------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | -| body (optional) | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | +| Parameter | Type | Description | +| ----------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `http://example.com`). | +| body (optional) | string / object / ArrayBuffer | Request body; objects will be `x-www-form-urlencoded`. | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | ### Returns -| Type | Description | -| -------- | --------------------------------------------------------------------------------- | +| Type | Description | +| -------- | ------------------------------------------------------------------------------------------------- | | Response | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/request.md b/docs/sources/v0.48.x/javascript-api/k6-http/request.md index 827ed63ea6..1f62015311 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/request.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/request.md @@ -7,17 +7,17 @@ weight: 10 # request( method, url, [body], [params] ) -| Parameter | Type | Description | -| ----------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| method | string | Request method (e.g. `'POST'`). Must be uppercase. | -| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `'http://example.com'`). | -| body (optional) | string / object / ArrayBuffer | Request body; Objects will be `x-www-form-urlencoded` encoded. | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | +| Parameter | Type | Description | +| ----------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| method | string | Request method (e.g. `'POST'`). Must be uppercase. | +| url | string /[HTTP URL](https://grafana.com/docs/k6//javascript-api/k6-http/url#returns) | Request URL (e.g. `'http://example.com'`). | +| body (optional) | string / object / ArrayBuffer | Request body; Objects will be `x-www-form-urlencoded` encoded. | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object containing additional request parameters. | ### Returns -| Type | Description | -| -------- | --------------------------------------------------------------------------------- | +| Type | Description | +| -------- | ------------------------------------------------------------------------------------------------- | | Response | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md b/docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md index 151ad90c43..9e5974fb49 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/response/_index.md @@ -12,44 +12,44 @@ Response is used by the http.\* methods that generate HTTP request. Those method Note that in the case of redirects, all the information in the Response object will pertain to the last request (the one that doesn't get redirected). -| Name | Type | Description | -| ------------------------------------------------------------------------------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Response.body` | string | Response body content, often used to extract dynamic data (see examples [here](https://grafana.com/docs/k6//examples/correlation-and-dynamic-data)) and when verifying the presence of content using [checks](https://grafana.com/docs/k6//javascript-api/k6/check).

See [Params.responseType](https://grafana.com/docs/k6//javascript-api/k6-http/params) and [options.discardResponseBodies](https://grafana.com/docs/k6//using-k6/k6-options/reference) for how to discard the body when it is not needed (and to save memory) or when handling bodies with binary data. | -| `Response.cookies` | object | Response cookies. The object properties are the cookie names and the value is an array of cookie objects (with `name`, `value`, `domain`, `path`, `httpOnly`, `secure`, `maxAge` and `expires` fields). | -| `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | -| `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//javascript-api/error-codes) if there was a non-HTTP error or 4xx or 5xx HTTP error it will be set to a specific code that describes the error. (Added in 0.24.0) | -| `Response.headers` | object | Key-value pairs representing all HTTP headers sent by the server. Note that the header names are in [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey), i.e.: if the server responds with "accept-encoding", the key will be "Accept-Encoding". | -| `Response.ocsp.produced_at` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response was signed by CA (or by CA entrusted OCSP responder) | -| `Response.ocsp.this_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time at which the status being indicated was known to be correct. | -| `Response.ocsp.next_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response will be refreshed with CA (or by CA entrusted OCSP responder). | -| `Response.ocsp.revocation_reason` | string | The reason for revocation of the certificate (if that is the status), one of the following constants: `http.OCSP_REASON_UNSPECIFIED`, `http.OCSP_REASON_KEY_COMPROMISE`, `http.OCSP_REASON_CA_COMPROMISE`,
`http.OCSP_REASON_AFFILIATION_CHANGED`,
`http.OCSP_REASON_SUPERSEDED`,
`http.OCSP_REASON_CESSATION_OF_OPERATION`,
`http.OCSP_REASON_CERTIFICATE_HOLD`,
`http.OCSP_REASON_REMOVE_FROM_CRL`,
`http.OCSP_REASON_PRIVILEGE_WITHDRAWN` or
`http.OCSP_REASON_AA_COMPROMISE`. | -| `Response.ocsp.revoked_at` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this certificate was revoked (if that is the status). | -| `Response.ocsp.status` | string | The status of the certificate, one of the following constants: `http.OCSP_STATUS_GOOD`, `http.OCSP_STATUS_REVOKED`, `http.OCSP_STATUS_UNKNOWN` or `http.OCSP_STATUS_SERVER_FAILED`. | -| `Response.proto` | string | Protocol used to perform the transfer. Possible values are "HTTP/1.0", "HTTP/1.1", or "HTTP/2.0". | -| `Response.remote_ip` | string | The IP address of the server handling the request. | -| `Response.remote_port` | number | The port that was connected to on the server side. | -| `Response.request.body` | string | Request body content. | -| `Response.request.cookies` | object | Request cookies. The object properties are the cookie names and the value is an array of cookie objects (with `name`, `value` and `replace` fields). | -| `Response.request.headers` | object | Request headers. | -| `Response.request.method` | string | Request HTTP method. | -| `Response.request.url` | string | Request URL. | -| `Response.status` | number | HTTP status code returned by the server. | -| `Response.status_text` | string | _(new in k6 v0.29.0)_ HTTP status text returned by the server. | -| `Response.timings` | object | Performance timing information for the HTTP request. | -| `Response.timings.blocked` | float | Containing time (ms) spent blocked before initiating request. | -| `Response.timings.connecting` | float | Containing time (ms) spent setting up TCP connection to host. | -| `Response.timings.tls_handshaking` | float | Containing time (ms) spent handshaking TLS session with host. | -| `Response.timings.sending` | float | Containing time (ms) spent sending request. | -| `Response.timings.waiting` | float | Containing time (ms) spent waiting for server response. | -| `Response.timings.receiving` | float | Containing time (ms) spent receiving response data. | -| `Response.timings.duration` | float | Total time for the request (ms). It's equal to `sending + waiting + receiving`, i.e. how long did the remote server take to process the request and respond, without the initial DNS lookup/connection times. | -| `Response.tls_cipher_suite` | string | If a TLS session was established, the cipher suite that was used. | -| `Response.tls_version` | string | If a TLS session was established, the version of SSL/TLS that was used. | -| `Response.url` | string | The URL that was ultimately fetched (i.e. after any potential redirects). | -| [Response.clickLink( [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/response/response-clicklink) | function | Parses response as HTML, looks for a specific link and does the request-level equivalent of a click on that link. | -| [Response.html()](https://grafana.com/docs/k6//javascript-api/k6-http/response/response-html) | function | Returns an object that supports [Selection.find(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-find). | -| [Response.json( [selector] )](https://grafana.com/docs/k6//javascript-api/k6-http/response/response-json) | function | Parses the response body data as JSON and returns a JS object or array. This call caches the deserialized JSON data, additional calls will return the cached data. An optional selector can be specified to extract a specific part of the data, see [here for selector syntax](https://github.com/tidwall/gjson#path-syntax). | -| [Response.submitForm( [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/response/response-submitform) | function | Parses response as HTML, parses the specified form (defaults to looking for a "form" element) with option to override fields and then submits form taking form's `method` and `action` into account. | +| Name | Type | Description | +| ------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Response.body` | string | Response body content, often used to extract dynamic data (see examples [here](https://grafana.com/docs/k6//examples/correlation-and-dynamic-data)) and when verifying the presence of content using [checks](https://grafana.com/docs/k6//javascript-api/k6/check).

See [Params.responseType](https://grafana.com/docs/k6//javascript-api/k6-http/params) and [options.discardResponseBodies](https://grafana.com/docs/k6//using-k6/k6-options/reference) for how to discard the body when it is not needed (and to save memory) or when handling bodies with binary data. | +| `Response.cookies` | object | Response cookies. The object properties are the cookie names and the value is an array of cookie objects (with `name`, `value`, `domain`, `path`, `httpOnly`, `secure`, `maxAge` and `expires` fields). | +| `Response.error` | string | Error message if there was a non-HTTP error while trying to send the request. | +| `Response.error_code` | number | [Error code](https://grafana.com/docs/k6//javascript-api/error-codes) if there was a non-HTTP error or 4xx or 5xx HTTP error it will be set to a specific code that describes the error. (Added in 0.24.0) | +| `Response.headers` | object | Key-value pairs representing all HTTP headers sent by the server. Note that the header names are in [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey), i.e.: if the server responds with "accept-encoding", the key will be "Accept-Encoding". | +| `Response.ocsp.produced_at` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response was signed by CA (or by CA entrusted OCSP responder) | +| `Response.ocsp.this_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time at which the status being indicated was known to be correct. | +| `Response.ocsp.next_update` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this OCSP stapled response will be refreshed with CA (or by CA entrusted OCSP responder). | +| `Response.ocsp.revocation_reason` | string | The reason for revocation of the certificate (if that is the status), one of the following constants: `http.OCSP_REASON_UNSPECIFIED`, `http.OCSP_REASON_KEY_COMPROMISE`, `http.OCSP_REASON_CA_COMPROMISE`,
`http.OCSP_REASON_AFFILIATION_CHANGED`,
`http.OCSP_REASON_SUPERSEDED`,
`http.OCSP_REASON_CESSATION_OF_OPERATION`,
`http.OCSP_REASON_CERTIFICATE_HOLD`,
`http.OCSP_REASON_REMOVE_FROM_CRL`,
`http.OCSP_REASON_PRIVILEGE_WITHDRAWN` or
`http.OCSP_REASON_AA_COMPROMISE`. | +| `Response.ocsp.revoked_at` | number | If a stapled OSCP response was provided by server, the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, representing the time when this certificate was revoked (if that is the status). | +| `Response.ocsp.status` | string | The status of the certificate, one of the following constants: `http.OCSP_STATUS_GOOD`, `http.OCSP_STATUS_REVOKED`, `http.OCSP_STATUS_UNKNOWN` or `http.OCSP_STATUS_SERVER_FAILED`. | +| `Response.proto` | string | Protocol used to perform the transfer. Possible values are "HTTP/1.0", "HTTP/1.1", or "HTTP/2.0". | +| `Response.remote_ip` | string | The IP address of the server handling the request. | +| `Response.remote_port` | number | The port that was connected to on the server side. | +| `Response.request.body` | string | Request body content. | +| `Response.request.cookies` | object | Request cookies. The object properties are the cookie names and the value is an array of cookie objects (with `name`, `value` and `replace` fields). | +| `Response.request.headers` | object | Request headers. | +| `Response.request.method` | string | Request HTTP method. | +| `Response.request.url` | string | Request URL. | +| `Response.status` | number | HTTP status code returned by the server. | +| `Response.status_text` | string | _(new in k6 v0.29.0)_ HTTP status text returned by the server. | +| `Response.timings` | object | Performance timing information for the HTTP request. | +| `Response.timings.blocked` | float | Containing time (ms) spent blocked before initiating request. | +| `Response.timings.connecting` | float | Containing time (ms) spent setting up TCP connection to host. | +| `Response.timings.tls_handshaking` | float | Containing time (ms) spent handshaking TLS session with host. | +| `Response.timings.sending` | float | Containing time (ms) spent sending request. | +| `Response.timings.waiting` | float | Containing time (ms) spent waiting for server response. | +| `Response.timings.receiving` | float | Containing time (ms) spent receiving response data. | +| `Response.timings.duration` | float | Total time for the request (ms). It's equal to `sending + waiting + receiving`, i.e. how long did the remote server take to process the request and respond, without the initial DNS lookup/connection times. | +| `Response.tls_cipher_suite` | string | If a TLS session was established, the cipher suite that was used. | +| `Response.tls_version` | string | If a TLS session was established, the version of SSL/TLS that was used. | +| `Response.url` | string | The URL that was ultimately fetched (i.e. after any potential redirects). | +| [Response.clickLink( [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/response/response-clicklink) | function | Parses response as HTML, looks for a specific link and does the request-level equivalent of a click on that link. | +| [Response.html()](https://grafana.com/docs/k6//javascript-api/k6-http/response/response-html) | function | Returns an object that supports [Selection.find(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-find). | +| [Response.json( [selector] )](https://grafana.com/docs/k6//javascript-api/k6-http/response/response-json) | function | Parses the response body data as JSON and returns a JS object or array. This call caches the deserialized JSON data, additional calls will return the cached data. An optional selector can be specified to extract a specific part of the data, see [here for selector syntax](https://github.com/tidwall/gjson#path-syntax). | +| [Response.submitForm( [params] )](https://grafana.com/docs/k6//javascript-api/k6-http/response/response-submitform) | function | Parses response as HTML, parses the specified form (defaults to looking for a "form" element) with option to override fields and then submits form taking form's `method` and `action` into account. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/response/response-clicklink---params.md b/docs/sources/v0.48.x/javascript-api/k6-http/response/response-clicklink---params.md index bfd97b938a..b15f9e4d64 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/response/response-clicklink---params.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/response/response-clicklink---params.md @@ -10,15 +10,15 @@ Create and make a request corresponding to a link, found in the HTML of response This method takes an object argument where the following properties can be set: -| Param | Type | Description | -| -------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Param | Type | Description | +| -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | selector | string | A selector string passed to [Selection.find(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-find) to locate the link to click. By default this is `"a[href]"`. | | params | object | A [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) object that will be forwarded to the link click request. Can be used to set headers, cookies etc. | ### Returns -| Type | Description | -| -------------------------------------------- | ----------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ----------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | The link click response | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/response/response-html.md b/docs/sources/v0.48.x/javascript-api/k6-http/response/response-html.md index 78e0a69c19..6961c95b0a 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/response/response-html.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/response/response-html.md @@ -9,8 +9,8 @@ Parses response as HTML and populate a [Selection](https://grafana.com/docs/k6/< ### Returns -| Type | Description | -| ---------------------------------------------- | ------------------ | +| Type | Description | +| -------------------------------------------------------------------------------------- | ------------------ | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A Selection object | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/response/response-submitform---params.md b/docs/sources/v0.48.x/javascript-api/k6-http/response/response-submitform---params.md index aee228cb06..c84a62fe4c 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/response/response-submitform---params.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/response/response-submitform---params.md @@ -10,17 +10,17 @@ Fill in and submit form found in HTML of response. By default it will look for t This method takes an object argument where the following properties can be set: -| Param | Type | Description | -| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Param | Type | Description | +| -------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | formSelector | string | A selector string passed to [Selection.find(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-find) to locate the form to fill in and submit. By default this is `"form"`. | -| fields | object | The form fields to set/override. The keys are the form fields names and the values are the form field values. | -| submitSelector | string | A selector string used to locate the submit button in the form. By default this is `'[type="submit"]'`. | +| fields | object | The form fields to set/override. The keys are the form fields names and the values are the form field values. | +| submitSelector | string | A selector string used to locate the submit button in the form. By default this is `'[type="submit"]'`. | | params | object | A [Params (k6/http)](https://grafana.com/docs/k6//javascript-api/k6-http/params) object that will be forwarded to the form submit request. Can be used to set headers, cookies etc. | ### Returns -| Type | Description | -| ------------------------------------------------------ | ------------------------- | +| Type | Description | +| ---------------------------------------------------------------------------------------------- | ------------------------- | | [Response (k6/http)](https://grafana.com/docs/k6//javascript-api/k6-http/response) | The form submit response. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-http/set-response-callback.md b/docs/sources/v0.48.x/javascript-api/k6-http/set-response-callback.md index bc97174eb8..59d128710a 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-http/set-response-callback.md +++ b/docs/sources/v0.48.x/javascript-api/k6-http/set-response-callback.md @@ -18,8 +18,8 @@ Due to implementation specifics: - Requests with authentication `digest` are always expected to first get 401 and then to get whatever was specified. - Requests with authentication `ntlm` will let a 401 status code on the first request as well as anything defined by `expectedStatuses` -| Parameter | Type | Description | -| --------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | callback | [expectedStatuses](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) | an object returned from [expectedStatuses](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) | Currently only the very special [expectedStatuses](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) objects are supported but in the future it is planned that a JavaScript callback will be supported as well. By default requests with status codes between 200 and 399 are considered "expected". diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/_index.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/_index.md index 09d5bc4648..2eb35cfb6b 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/_index.md @@ -11,8 +11,8 @@ All metrics (both the [built-in metrics](https://grafana.com/docs/k6//using-k6/tags-and-groups) all values added to a custom metric, which can be useful when analysing the test results. -| Metric type | Description | -| ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| Metric type | Description | +| ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | [Counter](https://grafana.com/docs/k6//javascript-api/k6-metrics/counter) | A metric that cumulatively sums added values. | | [Gauge](https://grafana.com/docs/k6//javascript-api/k6-metrics/gauge) | A metric that stores the min, max and last values added to it. | | [Rate](https://grafana.com/docs/k6//javascript-api/k6-metrics/rate) | A metric that tracks the percentage of added values that are non-zero. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/counter/_index.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/counter/_index.md index ecbc5fe834..592c5201f8 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/counter/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/counter/_index.md @@ -13,8 +13,8 @@ _Counter_ is an object for representing a custom cumulative counter metric. It i | --------- | ------ | ------------------------------ | | `name` | string | The name of the custom metric. | -| Method | Description | -| ---------------------------------------------------------------------------- | ---------------------------------- | +| Method | Description | +| -------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | | [Counter.add(value, [tags])](https://grafana.com/docs/k6//javascript-api/k6-metrics/counter/counter-add) | Add a value to the counter metric. | ## Counter usage in Thresholds @@ -74,7 +74,7 @@ export const options = { vus: 1, duration: '1m', thresholds: { - error_counter: [ + 'error_counter': [ 'count < 10', // 10 or fewer total errors are tolerated ], 'error_counter{errorType:authError}': [ diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/counter/counter-add-value---tags.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/counter/counter-add-value---tags.md index 119dd99a69..7bebfbafc1 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/counter/counter-add-value---tags.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/counter/counter-add-value---tags.md @@ -8,9 +8,9 @@ excerpt: 'Add a value to the Counter metric.' Add a value to the `Counter` metric. -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| value | number | The value to add to the counter. | +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| value | number | The value to add to the counter. | | tags | object | Set of [tags](https://grafana.com/docs/k6//using-k6/tags-and-groups) that will be tagged to the added data point (note that tags are added per data point and not for the entire metric). | [Counter examples](https://grafana.com/docs/k6//javascript-api/k6-metrics/counter#examples) diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/gauge/_index.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/gauge/_index.md index 7f06586024..8487ab6a3b 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/gauge/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/gauge/_index.md @@ -13,8 +13,8 @@ _Gauge_ is an object for representing a custom metric holding only the latest va | `name` | string | The name of the custom metric. | | `isTime` | boolean | A boolean indicating whether the values added to the metric are time values or just untyped values. | -| Method | Description | -| ---------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| Method | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | [Gauge.add(value, [tags])](https://grafana.com/docs/k6//javascript-api/k6-metrics/gauge/gauge-add) | Add a value to the gauge metric. Only the latest value added will be kept. | ## Gauge usage in Thresholds diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/gauge/gauge-add-value---tags.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/gauge/gauge-add-value---tags.md index e7312bcc4d..5caa0efeb0 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/gauge/gauge-add-value---tags.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/gauge/gauge-add-value---tags.md @@ -8,9 +8,9 @@ excerpt: 'Set the value of the Gauge metric.' Set the value of the `Gauge` metric. -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| value | number | The value to set the gauge to. | +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| value | number | The value to set the gauge to. | | tags | object | Set of [tags](https://grafana.com/docs/k6//using-k6/tags-and-groups) that will be tagged to the added data point (note that tags are added per data point and not for the entire metric). | [Gauge examples](https://grafana.com/docs/k6//javascript-api/k6-metrics/gauge#examples) diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/rate/_index.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/rate/_index.md index c0d9881d3f..9b1a667d50 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/rate/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/rate/_index.md @@ -13,8 +13,8 @@ _Rate_ is an object for representing a custom metric keeping track of the percen | --------- | ------ | ------------------------------ | | `name` | string | The name of the custom metric. | -| Method | Description | -| --------------------------------------------------------------------- | ------------------------------- | +| Method | Description | +| ----------------------------------------------------------------------------------------------------------- | ------------------------------- | | [Rate.add(value, [tags])](https://grafana.com/docs/k6//javascript-api/k6-metrics/rate/rate-add) | Add a value to the rate metric. | ## Rate usage in Thresholds diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/rate/rate-add-value---tags.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/rate/rate-add-value---tags.md index 9a2ac61f4f..823d0d4321 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/rate/rate-add-value---tags.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/rate/rate-add-value---tags.md @@ -8,9 +8,9 @@ excerpt: 'Set the value of the Rate metric.' Set the value of the `Rate` metric. -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| value | number | The value to add to the rate metric. | +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| value | number | The value to add to the rate metric. | | tags | object | Set of [tags](https://grafana.com/docs/k6//using-k6/tags-and-groups) that will be tagged to the added data point (note that tags are added per data point and not for the entire metric). | [Rate examples](https://grafana.com/docs/k6//javascript-api/k6-metrics/rate#examples) diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/trend/_index.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/trend/_index.md index dcf31a9908..6c431e298f 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/trend/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/trend/_index.md @@ -14,8 +14,8 @@ _Trend_ is an object for representing a custom metric that allows for calculatin | `name` | string | The name of the custom metric. | | `isTime` | boolean | A boolean indicating whether the values added to the metric are time values or just untyped values. | -| Method | Description | -| ---------------------------------------------------------------------- | -------------------------------- | +| Method | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------- | | [Trend.add(value, [tags])](https://grafana.com/docs/k6//javascript-api/k6-metrics/trend/trend-add) | Add a value to the trend metric. | ## Trend usage in Thresholds diff --git a/docs/sources/v0.48.x/javascript-api/k6-metrics/trend/trend-add-value---tags.md b/docs/sources/v0.48.x/javascript-api/k6-metrics/trend/trend-add-value---tags.md index a8f1bf7367..aaac3919ed 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-metrics/trend/trend-add-value---tags.md +++ b/docs/sources/v0.48.x/javascript-api/k6-metrics/trend/trend-add-value---tags.md @@ -8,9 +8,9 @@ excerpt: 'Add a value to the Trend metric.' Add a value to the `Trend` metric. -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| value | number | The value to add to the trend metric. | +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| value | number | The value to add to the trend metric. | | tags | object | Set of [tags](https://grafana.com/docs/k6//using-k6/tags-and-groups) that will be tagged to the added data point (note that tags are added per data point and not for the entire metric). | [Trend examples](https://grafana.com/docs/k6//javascript-api/k6-metrics/trend#examples) diff --git a/docs/sources/v0.48.x/javascript-api/k6-net-grpc/_index.md b/docs/sources/v0.48.x/javascript-api/k6-net-grpc/_index.md index 2ec3acba53..830d52d79e 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-net-grpc/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-net-grpc/_index.md @@ -1,6 +1,6 @@ --- -title: "k6/net/grpc" -excerpt: "k6 gRPC API" +title: 'k6/net/grpc' +excerpt: 'k6 gRPC API' weight: 11 --- @@ -10,15 +10,15 @@ weight: 11 The `k6/net/grpc` module provides a [gRPC](https://grpc.io/) client for Remote Procedure Calls (RPC) over HTTP/2. -| Class/Method | Description | -| ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | -| [Client](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client) | gRPC client used for making RPC calls to a gRPC Server. | -| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | -| [Client.connect(address [,params])](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-connect) | Connects to a given gRPC service. | -| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-invoke) | Makes an unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response). | -| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-close) | Close the connection to the gRPC service. | -| [Params](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/params) | RPC Request specific options. | -| [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response) | Returned by RPC requests. | +| Class/Method | Description | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Client](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client) | gRPC client used for making RPC calls to a gRPC Server. | +| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | +| [Client.connect(address [,params])](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-connect) | Connects to a given gRPC service. | +| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-invoke) | Makes an unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response). | +| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-close) | Close the connection to the gRPC service. | +| [Params](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/params) | RPC Request specific options. | +| [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response) | Returned by RPC requests. | | [Constants](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/constants) | Define constants to distinguish between [gRPC Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response) statuses. | ## gRPC metrics diff --git a/docs/sources/v0.48.x/javascript-api/k6-net-grpc/client/_index.md b/docs/sources/v0.48.x/javascript-api/k6-net-grpc/client/_index.md index ab399ef5dc..c27cf26cbd 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-net-grpc/client/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-net-grpc/client/_index.md @@ -11,13 +11,13 @@ weight: 20 `Client` is a gRPC client that can interact with a gRPC server. Only unary RPCs are currently supported in this module. -| Method | Description | -| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | -| [Client.loadProtoset(protosetPath)](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-loadprotoset) | Loads and parses the given protoset file to be made available for RPC requests. | -| [Client.connect(address [,params])](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-connect) | Opens a connection to the given gRPC server. | -| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-invoke) | Makes an unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response). | -| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-close) | Close the connection to the gRPC service. | +| Method | Description | +| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | +| [Client.loadProtoset(protosetPath)](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-loadprotoset) | Loads and parses the given protoset file to be made available for RPC requests. | +| [Client.connect(address [,params])](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-connect) | Opens a connection to the given gRPC server. | +| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-invoke) | Makes an unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response). | +| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-close) | Close the connection to the gRPC service. | ### Examples diff --git a/docs/sources/v0.48.x/javascript-api/k6-net-grpc/client/client-invoke.md b/docs/sources/v0.48.x/javascript-api/k6-net-grpc/client/client-invoke.md index 0bf89593a7..220e83f85d 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-net-grpc/client/client-invoke.md +++ b/docs/sources/v0.48.x/javascript-api/k6-net-grpc/client/client-invoke.md @@ -17,12 +17,12 @@ error will be thrown. | ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | url | string | The gRPC method url to invoke, in the form `/package.Service/Method`, e.g. `/google.cloud.language.v1.LanguageService/AnalyzeSentiment`. The leading slash `/` is optional. | | request | object | The canonical request object, as-per the [Protobuf JSON Mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). | -| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/params) object containing additional request parameters. | +| params (optional) | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/params) object containing additional request parameters. | ### Returns -| Type | Description | -| ---------- | ------------------------------------------------------------------------------------- | +| Type | Description | +| ---------- | ----------------------------------------------------------------------------------------------------- | | `Response` | gRPC [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response) object. | ### Examples diff --git a/docs/sources/v0.48.x/javascript-api/k6-net-grpc/response.md b/docs/sources/v0.48.x/javascript-api/k6-net-grpc/response.md index 421f5e502c..4f086167d5 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-net-grpc/response.md +++ b/docs/sources/v0.48.x/javascript-api/k6-net-grpc/response.md @@ -7,13 +7,13 @@ weight: 30 # Response -| Name | Type | Description | -| ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| Name | Type | Description | +| ------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Response.status` | number | The response gRPC status code. Use the gRPC [status constants](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/constants) to check equality. | -| `Response.message` | object | The successful protobuf message, serialized to JSON. Will be `null` if `status !== grpc.StatusOK`. | -| `Response.headers` | object | Key-value pairs representing all the metadata headers returned by the gRPC server. | -| `Response.trailers` | object | Key-value pairs representing all the metadata trailers returned by the gRPC server. | -| `Response.error` | object | If `status !== grpc.StatusOK` then the error protobuf message, serialized to JSON; otherwise `null`. | +| `Response.message` | object | The successful protobuf message, serialized to JSON. Will be `null` if `status !== grpc.StatusOK`. | +| `Response.headers` | object | Key-value pairs representing all the metadata headers returned by the gRPC server. | +| `Response.trailers` | object | Key-value pairs representing all the metadata trailers returned by the gRPC server. | +| `Response.error` | object | If `status !== grpc.StatusOK` then the error protobuf message, serialized to JSON; otherwise `null`. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-ws/_index.md b/docs/sources/v0.48.x/javascript-api/k6-ws/_index.md index 26f966335e..fbf8b793b5 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-ws/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-ws/_index.md @@ -1,6 +1,6 @@ --- -title: "k6/ws" -excerpt: "k6 WebSocket API" +title: 'k6/ws' +excerpt: 'k6 WebSocket API' weight: 12 --- @@ -10,12 +10,12 @@ weight: 12 The ws module provides a [WebSocket](https://en.wikipedia.org/wiki/WebSocket) client implementing the [WebSocket protocol](http://www.rfc-editor.org/rfc/rfc6455.txt). -| Function | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Function | Description | +| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [connect( url, params, callback )](https://grafana.com/docs/k6//javascript-api/k6-ws/connect) | Create a WebSocket connection, and provides a [Socket](https://grafana.com/docs/k6//javascript-api/k6-ws/socket) client to interact with the service. The method blocks the test finalization until the connection is closed. | -| Class/Method | Description | -| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Class/Method | Description | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [Params](https://grafana.com/docs/k6//javascript-api/k6-ws/params) | Used for setting various WebSocket connection parameters such as headers, cookie jar, compression, etc. | | [Socket](https://grafana.com/docs/k6//javascript-api/k6-ws/socket) | WebSocket client used to interact with a WS connection. | | [Socket.close()](https://grafana.com/docs/k6//javascript-api/k6-ws/socket/socket-close) | Close the WebSocket connection. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-ws/connect.md b/docs/sources/v0.48.x/javascript-api/k6-ws/connect.md index 7714e95882..7e7a300775 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-ws/connect.md +++ b/docs/sources/v0.48.x/javascript-api/k6-ws/connect.md @@ -19,16 +19,16 @@ The following events can close the connection: - [Socket.close()](https://grafana.com/docs/k6//javascript-api/k6-ws/socket/socket-close). - k6 VU interruption based on test configuration or CLI commands. -| Parameter | Type | Description | -| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| url | string | Request URL (e.g. "ws://echo.websocket.org"). | -| params | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-ws/params) object containing additional request parameters. | +| Parameter | Type | Description | +| --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | Request URL (e.g. "ws://echo.websocket.org"). | +| params | object | [Params](https://grafana.com/docs/k6//javascript-api/k6-ws/params) object containing additional request parameters. | | callback | function | The callback function that will be called when the WebSocket connection is initiated. A [Socket](https://grafana.com/docs/k6//javascript-api/k6-ws/socket) object will be passed to the function, and this object can be used to set up callbacks etc when things happen on the WebSocket connection | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | --------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP Response object. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6-ws/params.md b/docs/sources/v0.48.x/javascript-api/k6-ws/params.md index b42cdf857e..dd63637021 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-ws/params.md +++ b/docs/sources/v0.48.x/javascript-api/k6-ws/params.md @@ -11,12 +11,12 @@ weight: 20 _Params_ is an object used by the WebSocket methods that generate WebSocket requests. _Params_ contains request-specific options like headers that should be inserted into the request. -| Name | Type | Description | -| -------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Params.compression` | string | Compression algorithm to be used by the WebSocket connection. The only supported algorithm currently is `deflate`. If the option is left unset or empty, it defaults to no compression. | -| `Params.jar` | [http.CookieJar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | The cookie jar that will be used when making the initial HTTP request to establish the WebSocket connection. If empty, the [default VU cookie jar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) will be used. | -| `Params.headers` | object | Custom HTTP headers in key-value pairs that will be added to the initial HTTP request to establish the WebSocket connection. Keys are header names and values are header values. | -| `Params.tags` | object | [Custom metric tags](https://grafana.com/docs/k6//using-k6/tags-and-groups#user-defined-tags) in key-value pairs where the keys are names of tags and the values are tag values. The WebSocket connection will [generate metrics samples](https://grafana.com/docs/k6//javascript-api/k6-ws/socket#websocket-built-in-metrics) with these tags attached, allowing users to filter the results data or set [thresholds on sub-metrics](https://grafana.com/docs/k6//using-k6/thresholds#thresholds-on-tags). | +| Name | Type | Description | +| -------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Params.compression` | string | Compression algorithm to be used by the WebSocket connection. The only supported algorithm currently is `deflate`. If the option is left unset or empty, it defaults to no compression. | +| `Params.jar` | [http.CookieJar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | The cookie jar that will be used when making the initial HTTP request to establish the WebSocket connection. If empty, the [default VU cookie jar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) will be used. | +| `Params.headers` | object | Custom HTTP headers in key-value pairs that will be added to the initial HTTP request to establish the WebSocket connection. Keys are header names and values are header values. | +| `Params.tags` | object | [Custom metric tags](https://grafana.com/docs/k6//using-k6/tags-and-groups#user-defined-tags) in key-value pairs where the keys are names of tags and the values are tag values. The WebSocket connection will [generate metrics samples](https://grafana.com/docs/k6//javascript-api/k6-ws/socket#websocket-built-in-metrics) with these tags attached, allowing users to filter the results data or set [thresholds on sub-metrics](https://grafana.com/docs/k6//using-k6/thresholds#thresholds-on-tags). | ### Example of custom metadata headers and tags diff --git a/docs/sources/v0.48.x/javascript-api/k6-ws/socket/_index.md b/docs/sources/v0.48.x/javascript-api/k6-ws/socket/_index.md index 9b3c49352c..1b6b53ef00 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-ws/socket/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6-ws/socket/_index.md @@ -11,8 +11,8 @@ weight: 80 `Socket` is a WebSocket client to interact with a WebSocket connection. You can use it to listen various events happening on the WebSocket connection and send messages to the server. Additionally, you can use socket.setTimeout() and socket.setInterval() to execute code in the background, or repeatedly, while the WebSocket connection is open. -| Method | Description | -| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Method | Description | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [Socket.close()](https://grafana.com/docs/k6//javascript-api/k6-ws/socket/socket-close) | Close the WebSocket connection. | | [Socket.on(event, callback)](https://grafana.com/docs/k6//javascript-api/k6-ws/socket/socket-on) | Set up an event listener on the connection for any of the following events:
- open
- binaryMessage
- message
- ping
- pong
- close
- error. | | [Socket.ping()](https://grafana.com/docs/k6//javascript-api/k6-ws/socket/socket-ping) | Send a ping. | diff --git a/docs/sources/v0.48.x/javascript-api/k6-ws/socket/socket-on.md b/docs/sources/v0.48.x/javascript-api/k6-ws/socket/socket-on.md index 8d123df4b3..6bd0cc4d73 100644 --- a/docs/sources/v0.48.x/javascript-api/k6-ws/socket/socket-on.md +++ b/docs/sources/v0.48.x/javascript-api/k6-ws/socket/socket-on.md @@ -14,14 +14,14 @@ Set up callback functions for various events on the WebSocket connection. Multip | event | string | The event name to define a callback for. | | callback | function | The function to call when the event happens. | -| Event name | Description | -| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| open | Emitted when the connection is established | -| message | Emitted when a message is received from the server. | -| ping | Emitted when a ping is received from the server. The client will automatically send back a `pong`. | -| pong | Emitted when a pong is received from the server. | +| Event name | Description | +| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| open | Emitted when the connection is established | +| message | Emitted when a message is received from the server. | +| ping | Emitted when a ping is received from the server. The client will automatically send back a `pong`. | +| pong | Emitted when a pong is received from the server. | | close | Emitted when the connection is closed by the client [Socket.close()](https://grafana.com/docs/k6//javascript-api/k6-ws/socket/socket-close) or when the server sends the `close` event with code status 1000 (normal closure). | -| error | Emitted when an error occurs. Non-normal closure errors will be forwarded. | +| error | Emitted when an error occurs. Non-normal closure errors will be forwarded. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/k6/_index.md b/docs/sources/v0.48.x/javascript-api/k6/_index.md index 1a0cadd9b6..2debbaf366 100644 --- a/docs/sources/v0.48.x/javascript-api/k6/_index.md +++ b/docs/sources/v0.48.x/javascript-api/k6/_index.md @@ -8,8 +8,8 @@ weight: 02 The k6 module contains k6-specific functionality. -| Function | Description | -| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | +| Function | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | [check(val, sets, [tags])](https://grafana.com/docs/k6//javascript-api/k6/check) | 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. | | [fail([err])](https://grafana.com/docs/k6//javascript-api/k6/fail) | Throws an error, failing and aborting the current VU script iteration immediately. | | [group(name, fn)](https://grafana.com/docs/k6//javascript-api/k6/group) | Runs code inside a group. Used to organize results in a test. | diff --git a/docs/sources/v0.48.x/javascript-api/k6/group.md b/docs/sources/v0.48.x/javascript-api/k6/group.md index 008c0523d6..f374d6224e 100644 --- a/docs/sources/v0.48.x/javascript-api/k6/group.md +++ b/docs/sources/v0.48.x/javascript-api/k6/group.md @@ -30,7 +30,7 @@ To avoid confusion, `async` functions are forbidden as `group()` arguments. This For more information, refer to [k6 #2728](https://github.com/grafana/k6/issues/2728), which tracks possible solutions and provides detailed explanations. - {{% /admonition %}} +{{% /admonition %}} ### Example diff --git a/docs/sources/v0.48.x/javascript-api/xk6-disruptor/_index.md b/docs/sources/v0.48.x/javascript-api/xk6-disruptor/_index.md index 62b147d86a..93a8feb590 100644 --- a/docs/sources/v0.48.x/javascript-api/xk6-disruptor/_index.md +++ b/docs/sources/v0.48.x/javascript-api/xk6-disruptor/_index.md @@ -8,7 +8,7 @@ weight: 14 The xk6-disruptor API is organized around _disruptors_ that affect specific targets such as pods or services. These disruptors can inject different types of [faults](https://grafana.com/docs/k6//javascript-api/xk6-disruptor/faults) on their targets. -| Class | Description | -| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | +| Class | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | [PodDisruptor](https://grafana.com/docs/k6//javascript-api/xk6-disruptor/poddisruptor) | Targets the Pods that match selection attributes such as labels. | | [ServiceDisruptor](https://grafana.com/docs/k6//javascript-api/xk6-disruptor/servicedisruptor) | Targets the Pods that back a Kubernetes Service | diff --git a/docs/sources/v0.48.x/javascript-api/xk6-disruptor/faults/grpc.md b/docs/sources/v0.48.x/javascript-api/xk6-disruptor/faults/grpc.md index 9d04b920c2..78039c493e 100644 --- a/docs/sources/v0.48.x/javascript-api/xk6-disruptor/faults/grpc.md +++ b/docs/sources/v0.48.x/javascript-api/xk6-disruptor/faults/grpc.md @@ -24,7 +24,7 @@ A gRPC fault is described by the following attributes: `averageDelay` and `delayVariation` are applied to all requests affected by the fault, regardless of the value of `errorRate`. `statusCode` is returned only to a fraction of requests defined by `errorRate`. - {{% /admonition %}} +{{% /admonition %}} ## Example diff --git a/docs/sources/v0.48.x/javascript-api/xk6-disruptor/faults/http.md b/docs/sources/v0.48.x/javascript-api/xk6-disruptor/faults/http.md index 5891d56bc4..a2b7b74ff6 100644 --- a/docs/sources/v0.48.x/javascript-api/xk6-disruptor/faults/http.md +++ b/docs/sources/v0.48.x/javascript-api/xk6-disruptor/faults/http.md @@ -24,7 +24,7 @@ A HTTP fault is described by the following attributes: `averageDelay` and `delayVariation` are applied to all requests affected by the fault, regardless of the value of `errorRate`. `errorCode` is returned only to a fraction of requests defined by `errorRate`. - {{% /admonition %}} +{{% /admonition %}} ## Example diff --git a/docs/sources/v0.48.x/misc/archive.md b/docs/sources/v0.48.x/misc/archive.md index 5059a538d6..64f0d060f0 100644 --- a/docs/sources/v0.48.x/misc/archive.md +++ b/docs/sources/v0.48.x/misc/archive.md @@ -199,7 +199,18 @@ Breaking down the file structure we get: "noConnectionReuse": null, "ext": null, "summaryTrendStats": null, - "systemTags": ["url", "name", "check", "error", "tls_version", "method", "subproto", "status", "group", "proto"], + "systemTags": [ + "url", + "name", + "check", + "error", + "tls_version", + "method", + "subproto", + "status", + "group", + "proto" + ], "tags": null }, "filename": "/home/johndoe/tests/api-test/script.js", diff --git a/docs/sources/v0.48.x/misc/fine-tuning-os.md b/docs/sources/v0.48.x/misc/fine-tuning-os.md index ad6c107ffd..b655ac7f7f 100644 --- a/docs/sources/v0.48.x/misc/fine-tuning-os.md +++ b/docs/sources/v0.48.x/misc/fine-tuning-os.md @@ -22,7 +22,7 @@ This way you can gauge the effect of the optimization, find any negative side-ef The following modifications have been tested for macOS Sierra 10.12 and above. If you're on an older version, the process for changing these settings might differ. - {{% /admonition %}} +{{% /admonition %}} ## Network resource limit @@ -250,7 +250,7 @@ In most cases these limits should be enough to run most of your simple tests loc Please be aware that all of these limitations are put in place to protect your operating system from files and applications that are poorly written and might leak memory like in huge quantities. We would suggest not going too overboard with the values, or you might find your system slowing down to a crawl if or when it runs out of RAM. - {{% /admonition %}} +{{% /admonition %}} ## Local port range diff --git a/docs/sources/v0.48.x/misc/integrations.md b/docs/sources/v0.48.x/misc/integrations.md index 6c96511dae..7e399c79e8 100644 --- a/docs/sources/v0.48.x/misc/integrations.md +++ b/docs/sources/v0.48.x/misc/integrations.md @@ -80,4 +80,4 @@ By automating load testing with your CI / CD tools, you can quickly see when a c - [Tracetest](https://docs.tracetest.io/tools-and-integrations/integrations/k6) - Trace-based testing with Tracetest. - [Xray](https://docs.getxray.app/display/XRAYCLOUD/Performance+and+load+testing+with+k6) - Using Xray to validate test results in JIRA. -[Reach out to us](mailto:support@k6.io) if you have a tool or add-on that works well with k6, and we will list it here! \ No newline at end of file +[Reach out to us](mailto:support@k6.io) if you have a tool or add-on that works well with k6, and we will list it here! diff --git a/docs/sources/v0.48.x/results-output/end-of-test/_index.md b/docs/sources/v0.48.x/results-output/end-of-test/_index.md index 0f57c9d574..d8e8b0a64d 100644 --- a/docs/sources/v0.48.x/results-output/end-of-test/_index.md +++ b/docs/sources/v0.48.x/results-output/end-of-test/_index.md @@ -34,8 +34,8 @@ vus_max........................: 20 min=20 max=20 Besides this default summary, k6 can output the results in other formats at the end of the test: -| On this page | Result format | Read about... | -| ------------------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------- | +| On this page | Result format | Read about... | +| ---------------------------------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------- | | [Custom summary](https://grafana.com/docs/k6//results-output/end-of-test/custom-summary) | Aggregated | Using the `handleSummary()` to make completely custom reports | | [CSV](https://grafana.com/docs/k6//results-output/real-time/csv) | Time-stamped data points | Writing results as a CSV file, and the structure of the data | | [JSON](https://grafana.com/docs/k6//results-output/real-time/json) | Time-stamped data points | Writing results as a JSON file, and the structure of the data | diff --git a/docs/sources/v0.48.x/results-output/grafana-dashboards.md b/docs/sources/v0.48.x/results-output/grafana-dashboards.md index 956936018b..8320dde0a0 100644 --- a/docs/sources/v0.48.x/results-output/grafana-dashboards.md +++ b/docs/sources/v0.48.x/results-output/grafana-dashboards.md @@ -22,14 +22,14 @@ Using k6, you can [stream your local test results to any backend](https://grafan The flexibility and interoperability of Grafana and k6 let you visualize test and observability data in one dashboard, regardless of where the data is stored. The following outputs include pre-built Grafana dashboards for their storage: -| Output | Grafana Dashboard | -| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| [AWSTimestream](https://github.com/leonyork/xk6-output-timestream) | [leonyork/xk6-output-timestream](https://github.com/leonyork/xk6-output-timestream/tree/main/grafana/dashboards/) | +| Output | Grafana Dashboard | +| ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| [AWSTimestream](https://github.com/leonyork/xk6-output-timestream) | [leonyork/xk6-output-timestream](https://github.com/leonyork/xk6-output-timestream/tree/main/grafana/dashboards/) | | [InfluxDB](https://grafana.com/docs/k6//results-output/real-time/influxdb) | [grafana/xk6-output-influxdb](https://github.com/grafana/xk6-output-influxdb/tree/main/grafana/dashboards) | | [Prometheus remote write](https://grafana.com/docs/k6//results-output/real-time/prometheus-remote-write) | [k6 Prometheus](https://grafana.com/grafana/dashboards/19665-k6-prometheus/) | | [Prometheus remote write (Native Histograms)](https://grafana.com/docs/k6//results-output/real-time/prometheus-remote-write) | [k6 Prometheus (Native Histograms)](https://grafana.com/grafana/dashboards/18030-k6-prometheus-native-histograms/) | | [Grafana Cloud Prometheus](https://grafana.com/docs/k6//results-output/real-time/grafana-cloud-prometheus) | [k6 Prometheus](https://grafana.com/grafana/dashboards/19665-k6-prometheus/) | | [TimescaleDB](https://grafana.com/docs/k6//results-output/real-time/timescaledb) | [grafana/xk6-output-timescaledb](https://github.com/grafana/xk6-output-timescaledb/tree/main/grafana/dashboards) | -| ---- | [More public dashboards from the community](https://grafana.com/grafana/dashboards/?search=k6) | +| ---- | [More public dashboards from the community](https://grafana.com/grafana/dashboards/?search=k6) | For a fully managed solution, [Grafana Cloud k6](https://grafana.com/products/cloud/k6/) is our commercial product to store, view, scale, and manage your tests with ease. It provides custom views to access your testing and analyze test results, enhanced collaboration features, and many more additional capabilities. diff --git a/docs/sources/v0.48.x/results-output/real-time/amazon-cloudwatch.md b/docs/sources/v0.48.x/results-output/real-time/amazon-cloudwatch.md index 25dc6b4e1f..3faaba8a77 100644 --- a/docs/sources/v0.48.x/results-output/real-time/amazon-cloudwatch.md +++ b/docs/sources/v0.48.x/results-output/real-time/amazon-cloudwatch.md @@ -12,7 +12,7 @@ The built-in StatsD output has been deprecated on k6 v0.47.0. You can continue t For more information on the reason behind this change, you can follow [this issue](https://github.com/grafana/k6/issues/2982) in the k6 repository. - {{% /admonition %}} +{{% /admonition %}} k6 can send metrics data to [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/) through the [CloudWatch Agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html) by using the [xk6-output-statsd extension](https://github.com/LeonAdato/xk6-output-statsd). These metrics can then be visualized in dashboards. diff --git a/docs/sources/v0.48.x/results-output/real-time/datadog.md b/docs/sources/v0.48.x/results-output/real-time/datadog.md index 7bd7cefc09..4da466d96c 100644 --- a/docs/sources/v0.48.x/results-output/real-time/datadog.md +++ b/docs/sources/v0.48.x/results-output/real-time/datadog.md @@ -12,7 +12,7 @@ The built-in StatsD output has been deprecated on k6 v0.47.0. You can continue t For more information on the reason behind this change, you can follow [this issue](https://github.com/grafana/k6/issues/2982) in the k6 repository. - {{% /admonition %}} +{{% /admonition %}} k6 can send metrics to [Datadog](https://www.datadoghq.com/). That allows visualizing and correlating performance testing metrics with other monitored metrics in Datadog. diff --git a/docs/sources/v0.48.x/results-output/real-time/dynatrace.md b/docs/sources/v0.48.x/results-output/real-time/dynatrace.md index 85ca0d73ae..fb8f5e0d48 100644 --- a/docs/sources/v0.48.x/results-output/real-time/dynatrace.md +++ b/docs/sources/v0.48.x/results-output/real-time/dynatrace.md @@ -41,7 +41,7 @@ Create a Dynatrace API token to send the data. {{% admonition type="caution" %}} The Dynatrace API Token must have the scope name "metrics.ingest" (scope type `API v2`). - {{% /admonition %}} +{{% /admonition %}} You can use the Dynatrace UI: diff --git a/docs/sources/v0.48.x/results-output/real-time/elasticsearch.md b/docs/sources/v0.48.x/results-output/real-time/elasticsearch.md index db7a8f839c..5776faf90f 100644 --- a/docs/sources/v0.48.x/results-output/real-time/elasticsearch.md +++ b/docs/sources/v0.48.x/results-output/real-time/elasticsearch.md @@ -64,7 +64,7 @@ export K6_ELASTICSEARCH_URL=http://localhost:9200 {{% admonition type="caution" %}} Security and self-signed certificates for non-cloud clusters are not yet supported. - {{% /admonition %}} +{{% /admonition %}} You can now connect to Elasticsearch and query the [k6 metrics](https://grafana.com/docs/k6//using-k6/metrics) stored in the `k6-metrics` index. The following example uses an unsecured local Elasticsearch, version `7.17.9`: diff --git a/docs/sources/v0.48.x/results-output/real-time/grafana-cloud-prometheus.md b/docs/sources/v0.48.x/results-output/real-time/grafana-cloud-prometheus.md index a65f7d97a9..22d1f94146 100644 --- a/docs/sources/v0.48.x/results-output/real-time/grafana-cloud-prometheus.md +++ b/docs/sources/v0.48.x/results-output/real-time/grafana-cloud-prometheus.md @@ -13,7 +13,7 @@ This page includes instructions for running a local test that sends the test res For running and managing cloud tests in Grafana Cloud, check out [Grafana Cloud k6](https://grafana.com/docs/grafana-cloud/k6/). - {{% /admonition %}} +{{% /admonition %}} With Grafana Cloud Prometheus and the [k6 output for Prometheus remote write](https://grafana.com/docs/k6//results-output/real-time/prometheus-remote-write), you can send your k6 results output to [Grafana Cloud](https://grafana.com/products/cloud) to visualize your testing results. With k6 metrics in Grafana, you can correlate k6 metrics with other metrics of your observability stack. diff --git a/docs/sources/v0.48.x/results-output/real-time/netdata.md b/docs/sources/v0.48.x/results-output/real-time/netdata.md index 35bdbff0d0..101bd60908 100644 --- a/docs/sources/v0.48.x/results-output/real-time/netdata.md +++ b/docs/sources/v0.48.x/results-output/real-time/netdata.md @@ -12,7 +12,7 @@ The built-in StatsD output has been deprecated on k6 v0.47.0. You can continue t For more information on the reason behind this change, you can follow [this issue](https://github.com/grafana/k6/issues/2982) in the k6 repository. - {{% /admonition %}} +{{% /admonition %}} k6 can send performance testing metrics to [Netdata](https://netdata.cloud). This enables the user to start monitoring their k6 experiments right away, as Netdata is a monitoring tool with: diff --git a/docs/sources/v0.48.x/results-output/real-time/newrelic.md b/docs/sources/v0.48.x/results-output/real-time/newrelic.md index 2001d94dde..04c75c900d 100644 --- a/docs/sources/v0.48.x/results-output/real-time/newrelic.md +++ b/docs/sources/v0.48.x/results-output/real-time/newrelic.md @@ -13,7 +13,7 @@ The built-in StatsD output has been deprecated on k6 v0.47.0. You can continue t For more information on the reason behind this change, you can follow [this issue](https://github.com/grafana/k6/issues/2982) in the k6 repository. - {{% /admonition %}} +{{% /admonition %}} k6 can send telemetry data to [New Relic](https://newrelic.com/) through the New Relic [StatsD integration](https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/statsd-monitoring-integration-version-2). Within New Relic you can find your k6 performance data alongside your real users data and server side performance. This data can be visualized in dashboards and shared with others, used to compare load impact with system performance, and alert on metrics too. @@ -107,7 +107,7 @@ You can also add these metrics to [dashboards](https://docs.newrelic.com/docs/qu New Relic doesn't support calculating percentiles from metric data, which is the data format sent by this k6 output. See [this New Relic forum post](https://discuss.newrelic.com/t/percentiles-of-values-from-metrics-api-with-nrql-not-working/95832) and [the documentation about the metric data type](https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/query-metric-data-type/) for details. - {{% /admonition %}} +{{% /admonition %}} Here are some example NRQL queries you can easily copy and paste into widgets in a New Relic dashboard, you can however stick with the [chart builder](https://docs.newrelic.com/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder). Find all your k6 Metrics under the metrics tab, prefixed with `k6.` diff --git a/docs/sources/v0.48.x/results-output/real-time/prometheus-remote-write.md b/docs/sources/v0.48.x/results-output/real-time/prometheus-remote-write.md index fcff639719..60e2c28525 100644 --- a/docs/sources/v0.48.x/results-output/real-time/prometheus-remote-write.md +++ b/docs/sources/v0.48.x/results-output/real-time/prometheus-remote-write.md @@ -26,11 +26,11 @@ As much as possible, k6 respects the [naming best practices](https://prometheus. - All time series are suffixed with the base unit of the sample value (if k6 knows what the base unit is). - Trends and rates have the relative suffixes, to make them more discoverable. -| k6 | Prometheus | Name label | -| ------- | ------------------------------------------------------------------------------------------------------- | -------------------- | -| Counter | Counter | `k6_*_total` | -| Gauge | Gauge | `k6_*_` | -| Rate | Gauge | `k6_*_rate` | +| k6 | Prometheus | Name label | +| ------- | ----------------------------------------------------------------------------------------------------------- | -------------------- | +| Counter | Counter | `k6_*_total` | +| Gauge | Gauge | `k6_*_` | +| Rate | Gauge | `k6_*_rate` | | Trend | [Counter and Gauges (default)](#1-counter-and-gauges) or [Native Histogram](#2-prometheus-native-histogram) | `k6_*_` | ## Trend metric conversions @@ -159,7 +159,7 @@ k6 has special options for remote write output. | `K6_PROMETHEUS_RW_HEADERS_` | `string` | Additional header to include in the HTTP requests. It can be set using the described format, for example `K6_PROMETHEUS_RW_HEADERS_CUSTOM-HEADER-KEY=custom-header-value`. | | `K6_PROMETHEUS_RW_HTTP_HEADERS` | A comma-separated list of key-values | Additional headers to include in the HTTP requests. `K6_PROMETHEUS_RW_HTTP_HEADERS=key1:value1,key2:value2`. | | `K6_PROMETHEUS_RW_PUSH_INTERVAL` | `string` | Interval between the metrics' aggregation and upload to the endpoint. Default is `5s`. | -| `K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM` | `boolean` | If true, maps all the defined trend metrics as [Native Histograms](#2-prometheus-native-histogram). Default is `false`. | +| `K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM` | `boolean` | If true, maps all the defined trend metrics as [Native Histograms](#2-prometheus-native-histogram). Default is `false`. | | `K6_PROMETHEUS_RW_TREND_STATS` | list of `string` | If Native Histogram is not enabled, then it defines the stats functions to map for all of the defined trend metrics. It's a comma-separated list of stats functions to include (e.g. `p(90),avg,sum`). Check the trend section to see the list of supported stats. Default is `p(99)`. | | `K6_PROMETHEUS_RW_INSECURE_SKIP_TLS_VERIFY` | `boolean` | If true, the HTTP client skips TLS verification on the endpoint. Default is `false`. | | `K6_PROMETHEUS_RW_STALE_MARKERS` | `boolean` | If true, the output at the end of the test marks all the seen time series as stale. Default is `false`. | diff --git a/docs/sources/v0.48.x/results-output/real-time/statsd.md b/docs/sources/v0.48.x/results-output/real-time/statsd.md index c8bc2111b9..5d0f3d7bd7 100644 --- a/docs/sources/v0.48.x/results-output/real-time/statsd.md +++ b/docs/sources/v0.48.x/results-output/real-time/statsd.md @@ -12,7 +12,7 @@ The built-in StatsD output has been deprecated on k6 v0.47.0. You can continue t For more information on the reason behind this change, you can follow [this issue](https://github.com/grafana/k6/issues/2982) in the k6 repository. - {{% /admonition %}} +{{% /admonition %}} k6 can push test metrics to a [StatsD](https://github.com/statsd/statsd) service by using the [xk6-output-statsd extension](https://github.com/LeonAdato/xk6-output-statsd). diff --git a/docs/sources/v0.48.x/shared/browser-module-wip.md b/docs/sources/v0.48.x/shared/browser-module-wip.md index a64d65646d..29dcaac094 100644 --- a/docs/sources/v0.48.x/shared/browser-module-wip.md +++ b/docs/sources/v0.48.x/shared/browser-module-wip.md @@ -6,4 +6,4 @@ title: k6/experimental/browser module admonition This API is a work in progress. Some of the following functionalities might behave unexpectedly. -{{% /admonition %}} \ No newline at end of file +{{% /admonition %}} diff --git a/docs/sources/v0.48.x/shared/crypto-module.md b/docs/sources/v0.48.x/shared/crypto-module.md index 1d7849371a..48b7c92a20 100644 --- a/docs/sources/v0.48.x/shared/crypto-module.md +++ b/docs/sources/v0.48.x/shared/crypto-module.md @@ -9,4 +9,4 @@ A module with a better and standard API exists.
The new [k6/experimental/webcrypto API]({{< relref "../javascript-api/k6-experimental/webcrypto" >}}) partially implements the [WebCryptoAPI](https://www.w3.org/TR/WebCryptoAPI/), supporting more features than [k6/crypto]({{< relref "../javascript-api/k6-crypto" >}}). -{{% /admonition %}} \ No newline at end of file +{{% /admonition %}} diff --git a/docs/sources/v0.48.x/shared/experimental-module.md b/docs/sources/v0.48.x/shared/experimental-module.md index b247686889..ad8c800e46 100644 --- a/docs/sources/v0.48.x/shared/experimental-module.md +++ b/docs/sources/v0.48.x/shared/experimental-module.md @@ -12,4 +12,4 @@ While we intend to keep experimental modules as stable as possible, we may need
Experimental modules maintain a high level of stability and follow regular maintenance and security measures. Feel free to [open an issue](https://github.com/grafana/k6/issues) if you have any feedback or suggestions. -{{% /admonition %}} \ No newline at end of file +{{% /admonition %}} diff --git a/docs/sources/v0.48.x/shared/grpc-module.md b/docs/sources/v0.48.x/shared/grpc-module.md index 9f7d772237..59f6ee1555 100644 --- a/docs/sources/v0.48.x/shared/grpc-module.md +++ b/docs/sources/v0.48.x/shared/grpc-module.md @@ -9,4 +9,4 @@ A module with streaming support exists.
The new [k6/experimental/grpc]({{< relref "../javascript-api/k6-experimental/grpc" >}}) module extends [k6/net/grpc]({{< relref "../javascript-api/k6-net-grpc" >}}) to support [gRPC streaming]({{< relref "../javascript-api/k6-experimental/grpc/stream" >}}). We recommend using the new module. -{{% /admonition %}} \ No newline at end of file +{{% /admonition %}} diff --git a/docs/sources/v0.48.x/shared/index.md b/docs/sources/v0.48.x/shared/index.md index 3d65eaa0ff..ca03031f1e 100644 --- a/docs/sources/v0.48.x/shared/index.md +++ b/docs/sources/v0.48.x/shared/index.md @@ -1,3 +1,3 @@ --- headless: true ---- \ No newline at end of file +--- diff --git a/docs/sources/v0.48.x/shared/ws-module.md b/docs/sources/v0.48.x/shared/ws-module.md index 2b92da65c0..24874ed4af 100644 --- a/docs/sources/v0.48.x/shared/ws-module.md +++ b/docs/sources/v0.48.x/shared/ws-module.md @@ -12,4 +12,4 @@ The new [k6/experimental/websockets API]({{< relref "../javascript-api/k6-experi
When possible, we recommend using the new API. It uses a global event loop for consistency with other k6 APIs and better performance. -{{% /admonition %}} \ No newline at end of file +{{% /admonition %}} diff --git a/docs/sources/v0.48.x/testing-guides/automated-performance-testing.md b/docs/sources/v0.48.x/testing-guides/automated-performance-testing.md index 9028ccc2ce..606aef43d6 100644 --- a/docs/sources/v0.48.x/testing-guides/automated-performance-testing.md +++ b/docs/sources/v0.48.x/testing-guides/automated-performance-testing.md @@ -152,13 +152,13 @@ As a general rule on pre-release environments, we should run our larger tests wi export const options = { thresholds: { // http errors should be less than 1% - http_req_failed: ['rate<0.01'], + 'http_req_failed': ['rate<0.01'], // 90% of requests should be below 600ms - http_req_duration: ['p(90)<600'], + 'http_req_duration': ['p(90)<600'], // 95% of requests tagged as static content should be below 200ms 'http_req_duration{type:staticContent}': ['p(99)<250'], // the error rate of my custom metric should be below 5% - my_custom_metric: ['rate<0.05'], + 'my_custom_metric': ['rate<0.05'], }, }; ``` diff --git a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/_index.md b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/_index.md index c3b5b4bf41..22046fc059 100644 --- a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/_index.md +++ b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/_index.md @@ -22,18 +22,18 @@ It provides a Javascript API to inject different [faults](https://grafana.com/do Other types of faults and disruptors will be introduced in the future. The [Roadmap](https://github.com/grafana/xk6-disruptor/blob/main/ROADMAP.md) presents the project's goals for the coming months regarding new functionalities and enhancements. - ## Use cases The disruptor lets you test the resiliency of distributed applications by introducing errors in the requests served by your services. -The disruptor does not try to reproduce root causes, such as failed application instances or degraded computing or network resources. -It focuses on reproducing the side effects of such failures, so you can focus on understanding the propagation of errors between internal and public services and improving the error handling in your application. +The disruptor does not try to reproduce root causes, such as failed application instances or degraded computing or network resources. +It focuses on reproducing the side effects of such failures, so you can focus on understanding the propagation of errors between internal and public services and improving the error handling in your application. -This way, the disruptor makes reliability tests repeatable and predictable while limiting their blast radius. +This way, the disruptor makes reliability tests repeatable and predictable while limiting their blast radius. These are essentials to test applications deployed on shared infrastructures such as pre-production and testing environments. Common use cases are: + - Test resilient policies such as backoff, timeouts, retries, etc. - Test the fallback functionality when internal failures arise. - Test SLOs under common internal failures. @@ -54,4 +54,4 @@ Visit the [interactive demo environment in Killercoda](https://killercoda.com/gr For any unexpected behavior, please search the [GitHub issues](https://github.com/grafana/xk6-disruptor/issues) first. -And if you are interested in contributing to the development of this project, check the [contributing guide](https://github.com/grafana/xk6-disruptor/blob/main/docs/01-development/01-contributing.md). \ No newline at end of file +And if you are interested in contributing to the development of this project, check the [contributing guide](https://github.com/grafana/xk6-disruptor/blob/main/docs/01-development/01-contributing.md). diff --git a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/_index.md b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/_index.md index 84cb3bcd04..a2591f1121 100644 --- a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/_index.md +++ b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/_index.md @@ -8,7 +8,7 @@ weight: 06 In this section, we present some examples of using the `xk6-disruptor` extension to introduce faults in `k6` tests. -- [Injecting gRPC faults into a Service](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-grpc-faults-into-service) +- [Injecting gRPC faults into a Service](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-grpc-faults-into-service) - [Injecting HTTP faults into a Pod](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-http-faults-into-pod) - [Interactive demo](https://killercoda.com/grafana-xk6-disruptor/scenario/killercoda) (Killercoda) diff --git a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-grpc-faults-into-service.md b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-grpc-faults-into-service.md index 9306b31f47..ef774aca80 100644 --- a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-grpc-faults-into-service.md +++ b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-grpc-faults-into-service.md @@ -114,11 +114,11 @@ This test defines two [scenarios](https://grafana.com/docs/k6//using } ``` - {{% admonition type="note" %}} +{{% admonition type="note" %}} The `disrupt` scenario uses a `shared-iterations` executor with one iteration and one `VU`. This setting ensures the `disrupt` function is executed only once. Executing this function multiples times concurrently may have unpredictable results. - {{% /admonition %}} +{{% /admonition %}} ## Executions @@ -126,13 +126,14 @@ The `disrupt` scenario uses a `shared-iterations` executor with one iteration an The commands in this section assume the `xk6-disruptor` binary is available in your current directory. This location can change depending on the installation process and the platform. Refer to [Installation](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/installation) for details on how to install it in your environment. - {{% /admonition %}} +{{% /admonition %}} ### Baseline execution We will first execute the test without introducing faults to have an baseline using the following command: {{< code >}} + ```bash xk6-disruptor --env SKIP_FAULTS=1 --env GRPC_HOST=$GRPC_HOST run grpc-faults.js ``` @@ -140,6 +141,7 @@ xk6-disruptor --env SKIP_FAULTS=1 --env GRPC_HOST=$GRPC_HOST run grpc-faults.js ```windows-powershell xk6-disruptor --env SKIP_FAULTS=1 --env "GRPC_HOST=$Env:GRPC_HOST" run grpc-faults.js ``` + {{< /code >}} Notice the argument `--env SKIP_FAULT=1`, which makes the `disrupt` function return without injecting any fault as explained in the [fault injection](#fault-injection) section. Also notice the `--env GRPC_HOST` argument, which passes the external IP used to access the `grpcbin` application. @@ -187,6 +189,7 @@ load ✓ [======================================] 000/010 VUs 30s We repeat the execution injecting the faults. Notice we have removed the `--env SKIP_FAULTS=1` argument. {{< code >}} + ```bash xk6-disruptor --env GRPC_HOST=$GRPC_HOST run grpc-faults.js ``` @@ -194,6 +197,7 @@ xk6-disruptor --env GRPC_HOST=$GRPC_HOST run grpc-faults.js ```windows-powershell xk6-disruptor --env "GRPC_HOST=$Env:GRPC_HOST" run grpc-faults.js ``` + {{< /code >}} {{< code >}} diff --git a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-http-faults-into-pod.md b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-http-faults-into-pod.md index 6d9700ecc8..8474f3c5e2 100644 --- a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-http-faults-into-pod.md +++ b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/examples/inject-http-faults-into-pod.md @@ -39,7 +39,7 @@ export default function (data) { The test uses the `delay` endpoint which return after the requested delay. It requests a `0.1s` (`100ms`) delay to ensure the baseline scenario (see scenarios below) has meaningful statistics for the request duration. If we were simply calling a locally deployed http server (for example `nginx`), the response time would exhibit a large variation between a few microseconds to a few milliseconds. Having `100ms` as baseline response time has proved to offer more consistent results. - {{% /admonition %}} +{{% /admonition %}} ## Fault injection @@ -106,11 +106,11 @@ This test defines two [scenarios](https://grafana.com/docs/k6//using } ``` - {{% admonition type="note" %}} +{{% admonition type="note" %}} Notice that the `disrupt` scenario uses a `shared-iterations` executor with one iteration and one `VU`. This setting ensures the `disrupt` function is executed only once. Executing this function multiples times concurrently may have unpredictable results. - {{% /admonition %}} +{{% /admonition %}} ## Executions @@ -118,13 +118,14 @@ Notice that the `disrupt` scenario uses a `shared-iterations` executor with one The commands in this section assume the `xk6-disruptor` binary is available in your current directory. This location can change depending on the installation process and the platform. Refer to the [installation section](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/installation) for details on how to install it in your environment. - {{% /admonition %}} +{{% /admonition %}} ### Baseline execution We will first execute the test without introducing faults to have an baseline using the following command: {{< code >}} + ```bash xk6-disruptor run --env SKIP_FAULTS=1 --env SVC_IP=$SVC_IP disrupt-pod.js ``` @@ -132,6 +133,7 @@ xk6-disruptor run --env SKIP_FAULTS=1 --env SVC_IP=$SVC_IP disrupt-pod.js ```windows-powershell xk6-disruptor run --env SKIP_FAULTS=1 --env "SVC_IP=$Env:SVC_IP" disrupt-pod.js ``` + {{< /code >}} Notice the argument `--env SKIP_FAULT=1`, which makes the `disrupt` function return without injecting any fault as explained in the [fault injection](#fault-injection) section. Also notice the `--env SVC_IP` argument, which passes the external IP used to access the `httpbin` application. @@ -186,6 +188,7 @@ load ✓ [======================================] 000/013 VUs 30s We repeat the execution injecting the faults. Notice we have removed the `--env SKIP_FAULTS=1` argument. {{< code >}} + ```bash xk6-disruptor run --env SVC_IP=$SVC_IP disrupt-pod.js ``` @@ -193,6 +196,7 @@ xk6-disruptor run --env SVC_IP=$SVC_IP disrupt-pod.js ```windows-powershell xk6-disruptor run --env "SVC_IP=$Env:SVC_IP" disrupt-pod.js ``` + {{< /code >}} {{< code >}} @@ -253,7 +257,7 @@ Let's take a closer look at the results for the requests on each scenario. We ca Notice we have used the average response time reported as `expected_response:true` because this metric only consider successful requests while `http_req_duration` considers all requests, including those returning a fault. - {{% /admonition %}} +{{% /admonition %}} ## Source Code diff --git a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/first-steps.md b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/first-steps.md index a2c67fc025..005445be76 100644 --- a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/first-steps.md +++ b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/first-steps.md @@ -10,19 +10,18 @@ weight: 01 It provides a Javascript [API](https://grafana.com/docs/k6//javascript-api/xk6-disruptor/) to inject [faults](https://grafana.com/docs/k6//javascript-api/xk6-disruptor/faults) such as errors and delays into HTTP and gRPC requests served by selected Kubernetes [Pods](https://grafana.com/docs/k6//javascript-api/xk6-disruptor/poddisruptor) or [Services](https://grafana.com/docs/k6//javascript-api/xk6-disruptor/servicedisruptor). - ```javascript export default function () { - // Create a new disruptor that targets a service - const disruptor = new ServiceDisruptor("app-service","app-namespace"); - - // Disrupt the targets by injecting delays and faults into HTTP request for 30 seconds - const fault = { - averageDelay: '500ms', - errorRate: 0.1, - errorCode: 500 - } - disruptor.injectHTTPFaults(fault, "30s") + // Create a new disruptor that targets a service + const disruptor = new ServiceDisruptor('app-service', 'app-namespace'); + + // Disrupt the targets by injecting delays and faults into HTTP request for 30 seconds + const fault = { + averageDelay: '500ms', + errorRate: 0.1, + errorCode: 500, + }; + disruptor.injectHTTPFaults(fault, '30s'); } ``` @@ -38,4 +37,4 @@ Learn the basics of using the disruptor in your test project: - [Requirements](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/requirements) -- [Installation](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/installation) \ No newline at end of file +- [Installation](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/installation) diff --git a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/requirements.md b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/requirements.md index 566b9a9fac..e2ef3814cf 100644 --- a/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/requirements.md +++ b/docs/sources/v0.48.x/testing-guides/injecting-faults-with-xk6-disruptor/requirements.md @@ -18,7 +18,7 @@ Ensure that this file is pointed to by the `KUBECONFIG` environment variable or xk6-disruptor requires Kubernetes version 1.23 or higher - {{% /admonition %}} +{{% /admonition %}} `xk6-disruptor` requires the [grafana/xk6-disruptor-agent](https://github.com/grafana/xk6-disruptor/pkgs/container/xk6-disruptor-agent) image for injecting the [disruptor agent](https://grafana.com/docs/k6//testing-guides/injecting-faults-with-xk6-disruptor/how--it-works) into the disruption targets. Kubernetes clusters can be configured to restrict the download of images from public repositories. You need to ensure this image is available in the cluster where the application under test is running. Additionally, the xk6-disruptor-agent must run with network access privileges. Kubernetes clusters [can be configured to restrict the privileges of containers](https://kubernetes.io/docs/concepts/security/pod-security-admission/). If you find an error similar to the following when using the xk6-disruptor, contact your cluster administrator and request the necessary privileges. diff --git a/docs/sources/v0.48.x/testing-guides/running-distributed-tests.md b/docs/sources/v0.48.x/testing-guides/running-distributed-tests.md index d2a11f8196..51f842909d 100644 --- a/docs/sources/v0.48.x/testing-guides/running-distributed-tests.md +++ b/docs/sources/v0.48.x/testing-guides/running-distributed-tests.md @@ -35,7 +35,7 @@ The only requirement being access to a Kubernetes cluster and having the appropr This process can be performed on a local Kubernetes cluster running within [Docker](https://docs.docker.com/get-docker/)! Using [kind](https://kind.sigs.k8s.io/) or [k3d](https://k3d.io/) are awesome options to experiment with the process. - {{% /admonition %}} +{{% /admonition %}} - [Introducing k6-operator](#introducing-k6-operator) - [Get started with k6-operator](#get-started-with-k6-operator) @@ -69,7 +69,7 @@ Besides privileged access to a Kubernetes cluster, installation will require tha - [Kustomize](https://kubectl.docs.kubernetes.io/installation/kustomize/) - [Make](https://www.gnu.org/software/make/) - {{% /admonition %}} +{{% /admonition %}} From your command-line, execute the following: @@ -139,7 +139,7 @@ export default function () { While creating scripts, [run them locally](https://grafana.com/docs/k6//get-started/running-k6#running-local-tests) before publishing to your cluster. This can give you immediate feedback if you have errors in your script. - {{% /admonition %}} +{{% /admonition %}} Let's go ahead and verify our script is valid by performing a brief test: @@ -172,7 +172,7 @@ Kubernetes imposes a size limit of 1,048,576 bytes (1 MiB) for the data, therefo Check the [motivations](https://kubernetes.io/docs/concepts/configuration/configmap/#motivation) for when you should use a `ConfigMap` versus a `PersistentVolume`. - {{% /admonition %}} +{{% /admonition %}} You should see confirmation with `configmap/my-test created`. @@ -187,13 +187,13 @@ This mechanism is ideal when breaking up monolithic scripts into reusable [modul Organizing your test scripts was part of the discussion during [episode #76](https://www.youtube.com/watch?v=zDtEzp_JUOE&utm=k6-guides) of k6 Office Hours. - {{% /admonition %}} +{{% /admonition %}} {{% admonition type="caution" %}} When using a `PersistentVolume`, the operator will expect all test scripts to be contained within a directory named `/test/`. - {{% /admonition %}} +{{% /admonition %}} To learn more about creating `PersistentVolume` and `PersistentVolumeClaim` resources, review the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes/). @@ -209,7 +209,7 @@ Specifically, the main elements defined within the `TestRun` object relate to th The `TestRun` custom resource provides many configuration options to control the initialization and execution of tests. For the full listing of possible options, please refer to the project [source](https://github.com/grafana/k6-operator/blob/main/config/crd/bases/k6.io_testruns.yaml) and [README](https://github.com/grafana/k6-operator/blob/main/README.md). - {{% /admonition %}} +{{% /admonition %}} The following examples will show some common variations for the custom resource: @@ -248,7 +248,7 @@ The operator will split the workload between the pods using [execution segments] It is important that the `ConfigMap` and `CustomResource` are created in the same [Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/). - {{% /admonition %}} +{{% /admonition %}} ### Script in a PersistentVolume @@ -279,7 +279,7 @@ spec: It is important that the `PersistentVolumeClaim` and `CustomResource` are created in the same [Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/). - {{% /admonition %}} +{{% /admonition %}} ### Configure the environment @@ -320,7 +320,7 @@ spec: The above YAML introduces the `runner` section. This section applies to each pod that will be running a portion of your test, based upon the desired `parallelism`. - {{% /admonition %}} +{{% /admonition %}} Now, with the referenced resources, our test scripts can [use environment variables](https://grafana.com/docs/k6//using-k6/environment-variables) as in the following: @@ -359,7 +359,7 @@ With the above arguments, we're adding a [test-wide custom tag](https://grafana. Be sure to visit the [options reference](https://grafana.com/docs/k6//using-k6/k6-options/reference) for a listing of available options. - {{% /admonition %}} +{{% /admonition %}} ## 5. Run your test @@ -397,7 +397,7 @@ spec: arguments: -o experimental-prometheus-rw ``` - {{% /admonition %}} +{{% /admonition %}} ## 6. When things go wrong diff --git a/docs/sources/v0.48.x/testing-guides/running-large-tests.md b/docs/sources/v0.48.x/testing-guides/running-large-tests.md index daa36c1af2..d721edb517 100644 --- a/docs/sources/v0.48.x/testing-guides/running-large-tests.md +++ b/docs/sources/v0.48.x/testing-guides/running-large-tests.md @@ -109,7 +109,7 @@ As the test runs, these are good indicators to monitor: ## Error handling should be resilient When running [large stress tests](https://grafana.com/docs/k6//testing-guides/test-types/stress-testing), your script shouldn't assume anything about the HTTP response. -An oversight of some scripts is to test with only the [happy path](https://grafana.com/docs/k6//misc/glossary#happy-path "The default behavior that happens when the system returns no errors") in mind. +An oversight of some scripts is to test with only the [happy path](https://grafana.com/docs/k6//misc/glossary#happy-path 'The default behavior that happens when the system returns no errors') in mind. For example, in k6 scripts, we often see something like this _happy path_ check: @@ -298,7 +298,7 @@ WARN[0034] Request Failed error="Get http://test.k6.io/: dial tcp 99.81.83.1 Decide what level of errors is acceptable. At large scale, some errors are always present. If you make 50M requests with 100 failures, this is generally a good result (0.00002% errors). - {{% /admonition %}} +{{% /admonition %}} ## Benchmarking k6 diff --git a/docs/sources/v0.48.x/testing-guides/test-types/load-testing.md b/docs/sources/v0.48.x/testing-guides/test-types/load-testing.md index 7f75f4ceba..843b6ec405 100644 --- a/docs/sources/v0.48.x/testing-guides/test-types/load-testing.md +++ b/docs/sources/v0.48.x/testing-guides/test-types/load-testing.md @@ -56,7 +56,7 @@ When you prepare an average-load test, consider the following: If this is your first time running load tests, we recommend starting small or configuring the ramp-up to be slow. Your application and infrastructure might not be as rock solid as you think. We've had thousands of users run load tests that quickly crash their applications (or staging environments). - {{% /admonition %}} +{{% /admonition %}} The goal of an average-load test is to simulate the average amount of activity on a typical day in production. The pattern follows this sequence: diff --git a/docs/sources/v0.48.x/testing-guides/test-types/stress-testing.md b/docs/sources/v0.48.x/testing-guides/test-types/stress-testing.md index 4ebac24a15..40ec727899 100644 --- a/docs/sources/v0.48.x/testing-guides/test-types/stress-testing.md +++ b/docs/sources/v0.48.x/testing-guides/test-types/stress-testing.md @@ -96,7 +96,7 @@ Note that in the same way as the average-load test, the Stress test starts at 0 Run stress tests only after smoke and average-load tests. Running this test type earlier may be wasteful and make it hard to pinpoint problems if they appear at low volumes or at loads under the average utilization. - {{% /admonition %}} +{{% /admonition %}} ## Results analysis diff --git a/docs/sources/v0.48.x/using-k6-browser/_index.md b/docs/sources/v0.48.x/using-k6-browser/_index.md index acbe0dac8c..7989d38e53 100644 --- a/docs/sources/v0.48.x/using-k6-browser/_index.md +++ b/docs/sources/v0.48.x/using-k6-browser/_index.md @@ -18,7 +18,7 @@ This module aims to provide rough compatibility with the Playwright API, so you To work with the browser module, make sure you are using the latest [k6 version](https://github.com/grafana/k6/releases), and install a Chromium-based browser on your machine (such as [Google Chrome](https://www.google.com/chrome/)). - {{% /admonition %}} +{{% /admonition %}} ## Use case for browser testing diff --git a/docs/sources/v0.48.x/using-k6-browser/metrics.md b/docs/sources/v0.48.x/using-k6-browser/metrics.md index b133e22501..dbb4a8bc85 100644 --- a/docs/sources/v0.48.x/using-k6-browser/metrics.md +++ b/docs/sources/v0.48.x/using-k6-browser/metrics.md @@ -41,7 +41,7 @@ The following snippet is an example: As Google also recommends measuring the 75th percentile for each web vital metric, there will still be future tweaks to improve the summary output. - {{% /admonition %}} +{{% /admonition %}} ```bash browser_data_received.......: 2.6 kB 2.0 kB/s @@ -73,14 +73,14 @@ As the following example shows, you can also pass in different URLs if you're go Currently, you can only use URLs to specify thresholds for different pages. If you use [Groups](https://grafana.com/docs/k6/latest/using-k6/tags-and-groups/#groups), the metrics are not correctly grouped as described in [#721](https://github.com/grafana/xk6-browser/issues/721). - {{% /admonition %}} +{{% /admonition %}} {{< code >}} ```javascript export const options = { thresholds: { - browser_web_vital_lcp: ['p(90) < 1000'], + 'browser_web_vital_lcp': ['p(90) < 1000'], 'browser_web_vital_inp{url:https://test.k6.io/}': ['p(90) < 80'], 'browser_web_vital_inp{url:https://test.k6.io/my_messages.php}': ['p(90) < 100'], }, @@ -101,30 +101,29 @@ When the test is run, you should see a similar output as the one below. ## Measure custom metrics -When using the k6 browser `page.evaluate` function, you can call the [Performance API](https://developer.mozilla.org/en-US/docs/Web/API/Performance_API) to measure the performance of web applications. For example, if you want to measure the time it takes for your users to complete actions, such as a search feature, you can use the [`performance.mark`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) method to add a timestamp in your browser's performance timeline. - +When using the k6 browser `page.evaluate` function, you can call the [Performance API](https://developer.mozilla.org/en-US/docs/Web/API/Performance_API) to measure the performance of web applications. For example, if you want to measure the time it takes for your users to complete actions, such as a search feature, you can use the [`performance.mark`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) method to add a timestamp in your browser's performance timeline. Using the [`performance.measure`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure) method, you can also measure the time difference between two performance markers. The time duration that `performance.measure` returns can be added as a custom metric in k6 browser using [Trends](https://k6.io/docs/javascript-api/k6-metrics/trend/). {{< code >}} ```javascript -import { browser } from "k6/experimental/browser"; -import { Trend } from "k6/metrics"; +import { browser } from 'k6/experimental/browser'; +import { Trend } from 'k6/metrics'; export const options = { scenarios: { ui: { - executor: "shared-iterations", + executor: 'shared-iterations', options: { browser: { - type: "chromium", + type: 'chromium', }, }, }, }, }; -const myTrend = new Trend('total_action_time',true); +const myTrend = new Trend('total_action_time', true); export default async function () { const page = browser.newPage(); @@ -141,15 +140,13 @@ export default async function () { // Get time difference between visiting the page and completing the actions page.evaluate(() => - window.performance.measure( - 'total-action-time', - 'page-visit', - 'action-completed', - ) + window.performance.measure('total-action-time', 'page-visit', 'action-completed') ); - const totalActionTime = page.evaluate(() => - JSON.parse(JSON.stringify(window.performance.getEntriesByName('total-action-time')))[0].duration + const totalActionTime = page.evaluate( + () => + JSON.parse(JSON.stringify(window.performance.getEntriesByName('total-action-time')))[0] + .duration ); myTrend.add(totalActionTime); @@ -167,4 +164,4 @@ After you run the test, you should see a similar output as the one below. iteration_duration..........: avg=1.06s min=1.06s med=1.06s max=1.06s p(90)=1.06s p(95)=1.06s iterations..................: 1 0.70866/s total_action_time.............: avg=295.3ms min=295.3ms med=295.3ms max=295.3ms p(90)=295.3ms p(95)=295.3ms -``` \ No newline at end of file +``` diff --git a/docs/sources/v0.48.x/using-k6-browser/migrating-to-k6-v0-46.md b/docs/sources/v0.48.x/using-k6-browser/migrating-to-k6-v0-46.md index 25a96649d2..fca576ecb8 100644 --- a/docs/sources/v0.48.x/using-k6-browser/migrating-to-k6-v0-46.md +++ b/docs/sources/v0.48.x/using-k6-browser/migrating-to-k6-v0-46.md @@ -22,7 +22,7 @@ The updated version introduces notable structural changes in its operation and A You no longer need to use the `K6_BROWSER_ENABLED` flag when running browser tests with the `k6` command. - {{% /admonition %}} +{{% /admonition %}} ## Before and after comparison @@ -219,7 +219,7 @@ PS C:\k6> $env:K6_BROWSER_WS_URL='REMOTE_URL' ; k6 run script.js The following browser options are no longer supported: `devtools`, `env`, and `proxy` since they weren't providing much value. `slowMo` has been temporarily removed, and we're working on reintroducing it. - {{% /admonition %}} +{{% /admonition %}} ## Scenario options @@ -286,7 +286,7 @@ The `browser.close()` method has been removed, so you can remove that from your Closing of the page is critical for the calculation of accurate Web Vital metrics. See the [browser metrics](https://grafana.com/docs/k6//using-k6-browser/metrics) for more details. - {{% /admonition %}} +{{% /admonition %}} ## Browser context limit diff --git a/docs/sources/v0.48.x/using-k6-browser/recommended-practices/hybrid-approach-to-performance.md b/docs/sources/v0.48.x/using-k6-browser/recommended-practices/hybrid-approach-to-performance.md index 54efeedad9..5ac7dc9041 100644 --- a/docs/sources/v0.48.x/using-k6-browser/recommended-practices/hybrid-approach-to-performance.md +++ b/docs/sources/v0.48.x/using-k6-browser/recommended-practices/hybrid-approach-to-performance.md @@ -8,9 +8,9 @@ weight: 01 # Hybrid performance with k6 browser -An alternative approach to [browser-based load testing](https://grafana.com/docs/k6//testing-guides/load-testing-websites/#browser-based-load-testing) that's much less resource-intensive is combining a small number of virtual users for a browser test with a large number of virtual users for a protocol-level test. +An alternative approach to [browser-based load testing](https://grafana.com/docs/k6//testing-guides/load-testing-websites/#browser-based-load-testing) that's much less resource-intensive is combining a small number of virtual users for a browser test with a large number of virtual users for a protocol-level test. -You can achieve hybrid performance in multiple ways, often by using different tools. To simplify the developer experience, you can combine k6 browser with core k6 features to write hybrid tests in a single script. +You can achieve hybrid performance in multiple ways, often by using different tools. To simplify the developer experience, you can combine k6 browser with core k6 features to write hybrid tests in a single script. ## Browser and HTTP test @@ -19,9 +19,9 @@ The code below shows an example of combining a browser and HTTP test in a single {{< code >}} ```javascript -import http from "k6/http"; -import { check } from "k6"; -import { browser } from "k6/experimental/browser"; +import http from 'k6/http'; +import { check } from 'k6'; +import { browser } from 'k6/experimental/browser'; const BASE_URL = __ENV.BASE_URL; @@ -42,18 +42,18 @@ export const options = { executor: 'constant-vus', vus: 1, duration: '30s', - options: { - browser: { - type: 'chromium', - }, + options: { + browser: { + type: 'chromium', + }, }, - } + }, }, thresholds: { http_req_failed: ['rate<0.01'], http_req_duration: ['p(95)<500', 'p(99)<1000'], - browser_web_vital_fcp: ["p(95) < 1000"], - browser_web_vital_lcp: ["p(95) < 2000"], + browser_web_vital_fcp: ['p(95) < 1000'], + browser_web_vital_lcp: ['p(95) < 2000'], }, }; @@ -64,8 +64,8 @@ export function getPizza() { excludedIngredients: ['pepperoni'], excludedTools: ['knife'], maxNumberOfToppings: 6, - minNumberOfToppings: 2 - } + minNumberOfToppings: 2, + }; let res = http.post(`${BASE_URL}/api/pizza`, JSON.stringify(restrictions), { headers: { @@ -74,8 +74,8 @@ export function getPizza() { }, }); - check(res, { - 'status is 200': (res) => res.status === 200 + check(res, { + 'status is 200': (res) => res.status === 200, }); } @@ -83,9 +83,9 @@ export async function checkFrontend() { const page = browser.newPage(); try { - await page.goto(BASE_URL) + await page.goto(BASE_URL); check(page, { - 'header': page.locator('h1').textContent() == 'Looking to break out of your pizza routine?', + header: page.locator('h1').textContent() == 'Looking to break out of your pizza routine?', }); await page.locator('//button[. = "Pizza, Please!"]').click(); @@ -93,13 +93,12 @@ export async function checkFrontend() { page.screenshot({ path: `screenshots/${__ITER}.png` }); check(page, { - 'recommendation': page.locator('div#recommendations').textContent() != '', + recommendation: page.locator('div#recommendations').textContent() != '', }); } finally { page.close(); } } - ``` {{< /code >}} @@ -115,63 +114,63 @@ To find out more information about injecting faults to your service, check out t {{< code >}} ```javascript -import http from "k6/http"; -import { check } from "k6"; -import { browser } from "k6/experimental/browser"; +import http from 'k6/http'; +import { check } from 'k6'; +import { browser } from 'k6/experimental/browser'; const BASE_URL = __ENV.BASE_URL; export const options = { scenarios: { disrupt: { - executor: "shared-iterations", + executor: 'shared-iterations', iterations: 1, vus: 1, - exec: "disrupt", + exec: 'disrupt', }, browser: { - executor: "constant-vus", + executor: 'constant-vus', vus: 1, - duration: "10s", - startTime: "10s", - exec: "browser", + duration: '10s', + startTime: '10s', + exec: 'browser', options: { browser: { - type: "chromium", + type: 'chromium', }, }, }, }, thresholds: { - browser_web_vital_fcp: ["p(95) < 1000"], - browser_web_vital_lcp: ["p(95) < 2000"], + browser_web_vital_fcp: ['p(95) < 1000'], + browser_web_vital_lcp: ['p(95) < 2000'], }, }; // Add faults to the service by introducing a delay of 1s and 503 errors to 10% of the requests. const fault = { - averageDelay: "1000ms", + averageDelay: '1000ms', errorRate: 0.1, errorCode: 503, -} +}; export function disrupt() { - const disruptor = new ServiceDisruptor("pizza-info", "pizza-ns"); + const disruptor = new ServiceDisruptor('pizza-info', 'pizza-ns'); const targets = disruptor.targets(); if (targets.length == 0) { - throw new Error("expected list to have one target"); + throw new Error('expected list to have one target'); } - disruptor.injectHTTPFaults(fault, "20s"); + disruptor.injectHTTPFaults(fault, '20s'); } export async function checkFrontend() { const page = browser.newPage(); try { - await page.goto(BASE_URL) + await page.goto(BASE_URL); check(page, { - 'header': page.locator('h1').textContent() == 'Looking to break out of your pizza routine?', + header: page.locator('h1').textContent() == 'Looking to break out of your pizza routine?', }); await page.locator('//button[. = "Pizza, Please!"]').click(); @@ -179,13 +178,12 @@ export async function checkFrontend() { page.screenshot({ path: `screenshots/${__ITER}.png` }); check(page, { - 'recommendation': page.locator('div#recommendations').textContent() != '', + recommendation: page.locator('div#recommendations').textContent() != '', }); } finally { page.close(); } } - ``` {{< /code >}} @@ -194,4 +192,4 @@ export async function checkFrontend() { - **Start small**. Start with a small number of browser-based virtual users. A good starting point is to have 10% virtual users or less to monitor the user experience for your end-users, while the script emulates around 90% of traffic from the protocol level. - **Combine browser test with different load testing types**. To fully understand the impact of different traffic patterns on your end-user experience, experiment with running your browser test with different [load testing types](https://grafana.com/docs/k6//testing-guides/test-types/). -- **Focus on high-risk user journeys as a start**. Identify the high-risk user journeys first so you can start monitoring the web performance metrics for them while your backend applications are being exposed to high traffic or service faults. \ No newline at end of file +- **Focus on high-risk user journeys as a start**. Identify the high-risk user journeys first so you can start monitoring the web performance metrics for them while your backend applications are being exposed to high traffic or service faults. diff --git a/docs/sources/v0.48.x/using-k6-browser/recommended-practices/selecting-elements.md b/docs/sources/v0.48.x/using-k6-browser/recommended-practices/selecting-elements.md index dadd2545bf..667ae0144c 100644 --- a/docs/sources/v0.48.x/using-k6-browser/recommended-practices/selecting-elements.md +++ b/docs/sources/v0.48.x/using-k6-browser/recommended-practices/selecting-elements.md @@ -14,7 +14,7 @@ Currently, the browser module supports the standard **CSS and XPath selectors**. Text-based selectors are currently not supported. This will be supported in future releases. - {{% /admonition %}} +{{% /admonition %}} ## Recommended practices diff --git a/docs/sources/v0.48.x/using-k6-browser/running-browser-tests.md b/docs/sources/v0.48.x/using-k6-browser/running-browser-tests.md index 6e28551d5c..da13360416 100644 --- a/docs/sources/v0.48.x/using-k6-browser/running-browser-tests.md +++ b/docs/sources/v0.48.x/using-k6-browser/running-browser-tests.md @@ -17,7 +17,7 @@ Follow along to learn how to: With these example snippets, you'll run the test locally with your machine's resources. The browser module is not available within k6 cloud as of yet. - {{% /admonition %}} +{{% /admonition %}} ## Run a test @@ -31,7 +31,7 @@ To run a simple local script: ```javascript import { browser } from 'k6/experimental/browser'; - + export const options = { scenarios: { ui: { @@ -47,10 +47,10 @@ To run a simple local script: checks: ['rate==1.0'], }, }; - + export default async function () { const page = browser.newPage(); - + try { await page.goto('https://test.k6.io/'); page.screenshot({ path: 'screenshots/screenshot.png' }); @@ -154,7 +154,7 @@ To find out which selectors the browser module supports, check out [Selecting El You can also use `page.$()` instead of `page.locator()`. You can find the differences between `page.locator()` and `page.$` in the [Locator API documentation](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator). - {{% /admonition %}} +{{% /admonition %}} {{< code >}} @@ -272,7 +272,7 @@ To run a browser-level and protocol-level test concurrently, you can use [scenar Keep in mind that there is an additional performance overhead when it comes to spinning up a browser VU and that the resource usage will depend on the system under test. - {{% /admonition %}} +{{% /admonition %}} {{< code >}} @@ -312,7 +312,8 @@ export async function browserTest() { page.locator('#checkbox1').check(); check(page, { - 'checkbox is checked': page.locator('#checkbox-info-display').textContent() === 'Thanks for checking the box', + 'checkbox is checked': + page.locator('#checkbox-info-display').textContent() === 'Thanks for checking the box', }); } finally { page.close(); diff --git a/docs/sources/v0.48.x/using-k6/checks.md b/docs/sources/v0.48.x/using-k6/checks.md index 937f81d392..9902ddc84f 100644 --- a/docs/sources/v0.48.x/using-k6/checks.md +++ b/docs/sources/v0.48.x/using-k6/checks.md @@ -51,7 +51,8 @@ import http from 'k6/http'; export default function () { const res = http.get('http://test.k6.io/'); check(res, { - 'verify homepage text': (r) => r.body.includes('Collection of simple web-pages suitable for load testing'), + 'verify homepage text': (r) => + r.body.includes('Collection of simple web-pages suitable for load testing'), }); } ``` @@ -140,7 +141,7 @@ $ k6 run checks.js {{% admonition type="note" %}} -When a check fails, the script will continue executing successfully and will not return a 'failed' exit status. +When a check fails, the script will continue executing successfully and will not return a 'failed' exit status. If you need the whole test to fail based on the results of a check, you have to [combine checks with thresholds](https://grafana.com/docs/k6//using-k6/thresholds#fail-a-load-test-using-checks). This is particularly useful in specific contexts, such as integrating k6 into your CI pipelines or receiving alerts when scheduling your performance tests. diff --git a/docs/sources/v0.48.x/using-k6/execution-context-variables.md b/docs/sources/v0.48.x/using-k6/execution-context-variables.md index da48592eac..6d62d39ca4 100644 --- a/docs/sources/v0.48.x/using-k6/execution-context-variables.md +++ b/docs/sources/v0.48.x/using-k6/execution-context-variables.md @@ -19,8 +19,8 @@ To solve these issues, you can use _execution context variables_. The [k6/execution](https://grafana.com/docs/k6//javascript-api/k6-execution) module exposes details about the current execution state, such as _the name of the currently executed scenario_, _how many VUs are currently active_, and more. The module provides test-execution information via three properties: -| Property | Meta-information and execution details about | -| -------------------------------------------------------------------------- | -------------------------------------------- | +| Property | Meta-information and execution details about | +| ----------------------------------------------------------------------------------------- | -------------------------------------------- | | [instance](https://grafana.com/docs/k6//javascript-api/k6-execution#instance) | The current running k6 instance | | [scenario](https://grafana.com/docs/k6//javascript-api/k6-execution#scenario) | The current running scenario | | [vu](https://grafana.com/docs/k6//javascript-api/k6-execution#vu) | The current VU and iteration | diff --git a/docs/sources/v0.48.x/using-k6/http-requests.md b/docs/sources/v0.48.x/using-k6/http-requests.md index a09b2f8da7..0e6fddfbe8 100644 --- a/docs/sources/v0.48.x/using-k6/http-requests.md +++ b/docs/sources/v0.48.x/using-k6/http-requests.md @@ -54,8 +54,8 @@ export default function () { The [http module](https://grafana.com/docs/k6//javascript-api/k6-http) handles all kinds of HTTP requests and methods. -| Name | Value | -| --------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| Name | Value | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | | [batch()](https://grafana.com/docs/k6//javascript-api/k6-http/batch) | Issue multiple HTTP requests in parallel (like e.g. browsers tend to do). | | [del()](https://grafana.com/docs/k6//javascript-api/k6-http/del) | Issue an HTTP DELETE request. | | [get()](https://grafana.com/docs/k6//javascript-api/k6-http/get) | Issue an HTTP GET request. | @@ -71,15 +71,15 @@ The [http module](https://grafana.com/docs/k6//javascript-api/k6-htt k6 automatically applies [tags](https://grafana.com/docs/k6//using-k6/tags-and-groups#section-tags) to your HTTP requests. You can use these tags to filter your results and organize your analysis. -| Name | Description | -| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Name | Description | +| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | expected_response | By default, response statuses between 200 and 399 are `true`. Change the default behavior with [setResponseCallback](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback). | | group | When the request runs inside a [group](https://grafana.com/docs/k6//javascript-api/k6/group), the tag value is the group name. Default is empty. | -| name | Defaults to URL requested | -| method | Request method (`GET`, `POST`, `PUT` etc.) | +| name | Defaults to URL requested | +| method | Request method (`GET`, `POST`, `PUT` etc.) | | scenario | When the request runs inside a [scenario](https://grafana.com/docs/k6//using-k6/scenarios), the tag value is the scenario name. Default is `default`. | -| status | response status | -| url | defaults to URL requested | +| status | response status | +| url | defaults to URL requested | The following snippet shows a JSON example of how a test-result data point is logged. In this example, the metric is the duration of an HTTP request. diff --git a/docs/sources/v0.48.x/using-k6/k6-options/_index.md b/docs/sources/v0.48.x/using-k6/k6-options/_index.md index f24ff5fbb3..929b36a92a 100644 --- a/docs/sources/v0.48.x/using-k6/k6-options/_index.md +++ b/docs/sources/v0.48.x/using-k6/k6-options/_index.md @@ -10,7 +10,7 @@ weight: 05 Options configure test-run behavior. For example, options are how you define test tags, thresholds, user agents, and the number of virtual users and iterations. -| On this page | Read about... | -| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| On this page | Read about... | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | [How to use options](https://grafana.com/docs/k6//using-k6/k6-options/how-to) | How to set options in different places (with examples), how to override options, and how to access the value of an option as the test runs. | | [Options reference](https://grafana.com/docs/k6//using-k6/k6-options/reference) | Every option, with examples, defaults, and descriptions. | diff --git a/docs/sources/v0.48.x/using-k6/k6-options/how-to.md b/docs/sources/v0.48.x/using-k6/k6-options/how-to.md index 0b7dbc3d09..52736ba3bc 100644 --- a/docs/sources/v0.48.x/using-k6/k6-options/how-to.md +++ b/docs/sources/v0.48.x/using-k6/k6-options/how-to.md @@ -39,22 +39,22 @@ Other times, the context of your test dictates the most sensible place to put yo - **Options in the script to version control and keep tests tidy** - The script `options` object is generally the best place to put your options. - This provides automatic version control, allows for easy reuse, and lets you modularize your script. + The script `options` object is generally the best place to put your options. + This provides automatic version control, allows for easy reuse, and lets you modularize your script. - **CLI flags to set options on the fly** - When you want to run a quick test, command-line flags are convenient. + When you want to run a quick test, command-line flags are convenient. - You can also use command-line flags to override files in your script (as determined by the [order of precedence](#order-of-precedence)). - For example, if your script file sets the test duration at 60 seconds, you could use a CLI flag to run a one-time shorter test. - With a flag like `--duration 30s`, the test would be half as long but otherwise identical. + You can also use command-line flags to override files in your script (as determined by the [order of precedence](#order-of-precedence)). + For example, if your script file sets the test duration at 60 seconds, you could use a CLI flag to run a one-time shorter test. + With a flag like `--duration 30s`, the test would be half as long but otherwise identical. - **Environment variables to set options from your build chain** - For example, you could derive the option from a variable in your Docker container definition, CI UI, or vault—wherever you declare environment variables. + For example, you could derive the option from a variable in your Docker container definition, CI UI, or vault—wherever you declare environment variables. - The [block hostnames](https://grafana.com/docs/k6//using-k6/k6-options/reference#block-hostnames) option is an example of an option that works well with environment variables. + The [block hostnames](https://grafana.com/docs/k6//using-k6/k6-options/reference#block-hostnames) option is an example of an option that works well with environment variables. ## Examples of setting options diff --git a/docs/sources/v0.48.x/using-k6/metrics/create-custom-metrics.md b/docs/sources/v0.48.x/using-k6/metrics/create-custom-metrics.md index 94093ea7d5..105c438f75 100644 --- a/docs/sources/v0.48.x/using-k6/metrics/create-custom-metrics.md +++ b/docs/sources/v0.48.x/using-k6/metrics/create-custom-metrics.md @@ -24,7 +24,7 @@ Each topic has examples to make a custom metric and create [thresholds](https:// Custom metrics must be created in [init context](https://grafana.com/docs/k6//using-k6/test-lifecycle). This limits memory and ensures that k6 can validate that all thresholds are evaluating defined metrics. - {{% /admonition %}} +{{% /admonition %}} The generic procedure to create a custom metric is as follows: @@ -75,7 +75,7 @@ You can use these tags to filter test results. Here's how the output of the preceding script might look in the end-of-test summary. Since the metric is a trend, k6 calculates various trends based on the number of values and their summation. - {{< code >}} +{{< code >}} ```bash $ k6 run script.js @@ -96,7 +96,7 @@ $ k6 run script.js Custom metrics are collected from VU threads only at the end of a VU iteration. For long-running scripts, custom metrics might appear only after the test runs a while. - {{% /admonition %}} +{{% /admonition %}} ## Read more diff --git a/docs/sources/v0.48.x/using-k6/metrics/reference.md b/docs/sources/v0.48.x/using-k6/metrics/reference.md index e88e63e0da..11a1b6d42e 100644 --- a/docs/sources/v0.48.x/using-k6/metrics/reference.md +++ b/docs/sources/v0.48.x/using-k6/metrics/reference.md @@ -13,16 +13,16 @@ Each supported protocol also has its specific metrics. k6 always collects the following metrics, no matter what protocol the test uses: -| Metric Name | Type | Description | -| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| vus | Gauge | Current number of active virtual users | +| Metric Name | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vus | Gauge | Current number of active virtual users | | vus_max | Gauge | Max possible number of virtual users (VU resources are [pre-allocated](https://grafana.com/docs/k6//using-k6/scenarios/concepts/arrival-rate-vu-allocation), to avoid affecting performance when scaling up load ) | -| iterations | Counter | The aggregate number of times the VUs execute the JS script (the `default` function). | +| iterations | Counter | The aggregate number of times the VUs execute the JS script (the `default` function). | | iteration_duration | Trend | The time to complete one full iteration, including time spent in `setup` and `teardown`. To calculate the duration of the iteration's function for the specific scenario, [try this workaround](https://grafana.com/docs/k6//using-k6/workaround-iteration-duration) | | dropped_iterations | Counter | The number of iterations that weren't started due to lack of VUs (for the arrival-rate executors) or lack of time (expired maxDuration in the iteration-based executors). [About dropped iterations](https://grafana.com/docs/k6//using-k6/scenarios/concepts/dropped-iterations) | -| data_received | Counter | The amount of received data. [This example covers how to track data for an individual URL](https://grafana.com/docs/k6//examples/tracking-data-per). | -| data_sent | Counter | The amount of data sent. [Track data for an individual URL](https://grafana.com/docs/k6//examples/tracking-data-per) to track data for an individual URL. | -| checks | Rate | The rate of successful checks. | +| data_received | Counter | The amount of received data. [This example covers how to track data for an individual URL](https://grafana.com/docs/k6//examples/tracking-data-per). | +| data_sent | Counter | The amount of data sent. [Track data for an individual URL](https://grafana.com/docs/k6//examples/tracking-data-per) to track data for an individual URL. | +| checks | Rate | The rate of successful checks. | ## HTTP-specific built-in metrics {#http} @@ -33,7 +33,7 @@ These metrics are generated only when the test makes HTTP requests. For all `http_req_*` metrics, **the timestamp is emitted the end of the request.** In other words, the timestamp happens when k6 receives the end of the response body, or the request times out. - {{% /admonition %}} +{{% /admonition %}} | Metric Name | Type | Description | | ------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -45,7 +45,7 @@ In other words, the timestamp happens when k6 receives the end of the response b | http_req_waiting | Trend | Time spent waiting for response from remote host (a.k.a. “time to first byte”, or “TTFB”). `float` | | http_req_receiving | Trend | Time spent receiving response data from the remote host. `float` | | http_req_duration | Trend | Total time for the request. It's equal to `http_req_sending + http_req_waiting + http_req_receiving` (i.e. how long did the remote server take to process the request and respond, without the initial DNS lookup/connection times). `float` | -| http_req_failed | Rate | The rate of failed requests according to [setResponseCallback](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback). | +| http_req_failed | Rate | The rate of failed requests according to [setResponseCallback](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback). | ## Browser metrics {#browser} @@ -105,4 +105,4 @@ k6 emits the following metrics when it interacts with a service through the [`gR Steams-related metrics (`grpc_streams*`) are available only when using the `k6/experimental/grpc` module which is available on `k6` version `0.45.0` or higher. - {{% /admonition %}} +{{% /admonition %}} diff --git a/docs/sources/v0.48.x/using-k6/modules.md b/docs/sources/v0.48.x/using-k6/modules.md index e8b5b8e303..91a918e07d 100644 --- a/docs/sources/v0.48.x/using-k6/modules.md +++ b/docs/sources/v0.48.x/using-k6/modules.md @@ -79,7 +79,7 @@ k6 is not NodeJS, nor is it a browser. Packages that rely on APIs provided by No instance the `os` and `fs` modules, will not work in k6. The same goes for browser-specific APIs like the `window` object. - {{% /admonition %}} +{{% /admonition %}} The steps of this tutorial are as follows: @@ -94,7 +94,7 @@ The steps of this tutorial are as follows: A [ready-to-use Webpack and Babel starter](https://github.com/k6io/k6-es6) is avaialble in a repository. - {{% /admonition %}} +{{% /admonition %}} In a JavaScript project running NodeJS, modules are imported using either `import` or `require()`, using the node module resolution algorithm. diff --git a/docs/sources/v0.48.x/using-k6/protocols/_index.md b/docs/sources/v0.48.x/using-k6/protocols/_index.md index 72e5857636..5207ddd2b5 100644 --- a/docs/sources/v0.48.x/using-k6/protocols/_index.md +++ b/docs/sources/v0.48.x/using-k6/protocols/_index.md @@ -1,6 +1,6 @@ --- -title: "Protocols" -excerpt: "Out of the box k6 comes with support for a few protocols: HTTP / WebSockets / gRPC / ..." +title: 'Protocols' +excerpt: 'Out of the box k6 comes with support for a few protocols: HTTP / WebSockets / gRPC / ...' weight: 10 --- diff --git a/docs/sources/v0.48.x/using-k6/protocols/ssl-tls/_index.md b/docs/sources/v0.48.x/using-k6/protocols/ssl-tls/_index.md index 56dacc0897..1731b2e9b5 100644 --- a/docs/sources/v0.48.x/using-k6/protocols/ssl-tls/_index.md +++ b/docs/sources/v0.48.x/using-k6/protocols/ssl-tls/_index.md @@ -33,6 +33,6 @@ Each is worth discussing in more detail: - [TLS client certificates](https://grafana.com/docs/k6//using-k6/protocols/ssl-tls/ssl-tls-client-certificates) - [TLS version and ciphers](https://grafana.com/docs/k6//using-k6/protocols/ssl-tls/ssl-tls-version-and-ciphers) (restricting as -well as checking what was used for a HTTP request by checking response object properties) + well as checking what was used for a HTTP request by checking response object properties) - [Online Certificate Status Protocol (OCSP)](https://grafana.com/docs/k6//using-k6/protocols/ssl-tls/online-certificate-status-protocol--ocsp) - [Response.timings.tls_handshaking](https://grafana.com/docs/k6//javascript-api/k6-http/response) diff --git a/docs/sources/v0.48.x/using-k6/protocols/ssl-tls/ssl-tls-version-and-ciphers.md b/docs/sources/v0.48.x/using-k6/protocols/ssl-tls/ssl-tls-version-and-ciphers.md index 2ec14ea6d8..ec7609b92f 100644 --- a/docs/sources/v0.48.x/using-k6/protocols/ssl-tls/ssl-tls-version-and-ciphers.md +++ b/docs/sources/v0.48.x/using-k6/protocols/ssl-tls/ssl-tls-version-and-ciphers.md @@ -33,7 +33,7 @@ export default function () { ``` {{< /code >}} - + You can also accept a range of SSL/TLS versions: {{< code >}} diff --git a/docs/sources/v0.48.x/using-k6/scenarios/_index.md b/docs/sources/v0.48.x/using-k6/scenarios/_index.md index cbdf208c8d..c72d32127a 100644 --- a/docs/sources/v0.48.x/using-k6/scenarios/_index.md +++ b/docs/sources/v0.48.x/using-k6/scenarios/_index.md @@ -84,14 +84,14 @@ For the full list, refer to [Executors](https://grafana.com/docs/k6/ ## Scenario options {#options} -| Option | Type | Description | Default | -| ------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| Option | Type | Description | Default | +| ------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | | executor(required) ️ | string | Unique executor name. See the list of possible values in the [executors](https://grafana.com/docs/k6//using-k6/scenarios/executors) section. | - | -| startTime | string | Time offset since the start of the test, at which point this scenario should begin execution. | `"0s"` | +| startTime | string | Time offset since the start of the test, at which point this scenario should begin execution. | `"0s"` | | gracefulStop | string | Time to wait for iterations to finish executing before stopping them forcefully. To learn more, read [Graceful stop](https://grafana.com/docs/k6//using-k6/scenarios/concepts/graceful-stop). | `"30s"` | -| exec | string | Name of exported JS function to execute. | `"default"` | -| env | object | Environment variables specific to this scenario. | `{}` | -| tags | object | [Tags](https://grafana.com/docs/k6//using-k6/tags-and-groups) specific to this scenario. | `{}` | +| exec | string | Name of exported JS function to execute. | `"default"` | +| env | object | Environment variables specific to this scenario. | `{}` | +| tags | object | [Tags](https://grafana.com/docs/k6//using-k6/tags-and-groups) specific to this scenario. | `{}` | ## Scenario example diff --git a/docs/sources/v0.48.x/using-k6/scenarios/advanced-examples.md b/docs/sources/v0.48.x/using-k6/scenarios/advanced-examples.md index 5f18187692..8c0b573e5d 100644 --- a/docs/sources/v0.48.x/using-k6/scenarios/advanced-examples.md +++ b/docs/sources/v0.48.x/using-k6/scenarios/advanced-examples.md @@ -121,7 +121,7 @@ You can combine these tags with thresholds, or use them to simplify results filt To disable scenario tags, use the [`--system-tags` option](https://grafana.com/docs/k6//using-k6/k6-options#system-tags). - {{% /admonition %}} +{{% /admonition %}} ## Run multiple scenario functions, with different thresholds diff --git a/docs/sources/v0.48.x/using-k6/scenarios/concepts/_index.md b/docs/sources/v0.48.x/using-k6/scenarios/concepts/_index.md index df39001746..842a836930 100644 --- a/docs/sources/v0.48.x/using-k6/scenarios/concepts/_index.md +++ b/docs/sources/v0.48.x/using-k6/scenarios/concepts/_index.md @@ -1,5 +1,5 @@ --- -title: "Concepts" +title: 'Concepts' excerpt: High-level explanations about how your executor configuration can change the test execution and test results weight: -10 --- @@ -12,8 +12,8 @@ Different scenario configurations can affect many different aspects of your syst including the generated load, utilized resources, and emitted metrics. If you know a bit about how scenarios work, you'll design better tests and interpret test results with more understanding. -| On this page | Read about | -| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| On this page | Read about | +| ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | [Open and closed models](https://grafana.com/docs/k6//using-k6/scenarios/concepts/open-vs-closed) | Different ways k6 can schedule VUs, their affects on test results, and how k6 implements the open model in its arrival-rate executors | | [Graceful Stop](https://grafana.com/docs/k6//using-k6/scenarios/concepts/graceful-stop) | A configurable period for iterations to finish or ramp down after the test reaches its scheduled duration | | [Arrival-rate VU allocation](https://grafana.com/docs/k6//using-k6/scenarios/concepts/arrival-rate-vu-allocation) | How k6 allocates VUs in arrival-rate executors | diff --git a/docs/sources/v0.48.x/using-k6/scenarios/executors/_index.md b/docs/sources/v0.48.x/using-k6/scenarios/executors/_index.md index 9a0d7620e7..accc7c470b 100644 --- a/docs/sources/v0.48.x/using-k6/scenarios/executors/_index.md +++ b/docs/sources/v0.48.x/using-k6/scenarios/executors/_index.md @@ -28,14 +28,14 @@ export const options = { The following table lists all k6 executors and links to their documentation. -| Name | Value | Description | -| ----------------------------------------------------------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [Shared iterations](https://grafana.com/docs/k6//using-k6/scenarios/executors/shared-iterations) | `shared-iterations` | A fixed amount of iterations are
shared between a number of VUs. | -| [Per VU iterations](https://grafana.com/docs/k6//using-k6/scenarios/executors/per-vu-iterations) | `per-vu-iterations` | Each VU executes an exact number of iterations. | -| [Constant VUs](https://grafana.com/docs/k6//using-k6/scenarios/executors/constant-vus) | `constant-vus` | A fixed number of VUs execute as many
iterations as possible for a specified amount of time. | -| [Ramping VUs](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-vus) | `ramping-vus` | A variable number of VUs execute as many
iterations as possible for a specified amount of time. | -| [Constant Arrival Rate](https://grafana.com/docs/k6//using-k6/scenarios/executors/constant-arrival-rate) | `constant-arrival-rate` | A fixed number of iterations are executed
in a specified period of time. | -| [Ramping Arrival Rate](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-arrival-rate) | `ramping-arrival-rate` | A variable number of iterations are
executed in a specified period of time. | +| Name | Value | Description | +| -------------------------------------------------------------------------------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [Shared iterations](https://grafana.com/docs/k6//using-k6/scenarios/executors/shared-iterations) | `shared-iterations` | A fixed amount of iterations are
shared between a number of VUs. | +| [Per VU iterations](https://grafana.com/docs/k6//using-k6/scenarios/executors/per-vu-iterations) | `per-vu-iterations` | Each VU executes an exact number of iterations. | +| [Constant VUs](https://grafana.com/docs/k6//using-k6/scenarios/executors/constant-vus) | `constant-vus` | A fixed number of VUs execute as many
iterations as possible for a specified amount of time. | +| [Ramping VUs](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-vus) | `ramping-vus` | A variable number of VUs execute as many
iterations as possible for a specified amount of time. | +| [Constant Arrival Rate](https://grafana.com/docs/k6//using-k6/scenarios/executors/constant-arrival-rate) | `constant-arrival-rate` | A fixed number of iterations are executed
in a specified period of time. | +| [Ramping Arrival Rate](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-arrival-rate) | `ramping-arrival-rate` | A variable number of iterations are
executed in a specified period of time. | | [Externally Controlled](https://grafana.com/docs/k6//using-k6/scenarios/executors/externally-controlled) | `externally-controlled` | Control and scale execution at runtime
via [k6's REST API](https://grafana.com/docs/k6//misc/k6-rest-api) or the [CLI](https://k6.io/blog/how-to-control-a-live-k6-test). | {{% admonition type="note" %}} @@ -47,4 +47,4 @@ So the tenth VU could use the tenth item in your array (or the sixth iteration t But, you _cannot_ reliably map, for example, the tenth VU to the tenth iteration. - {{% /admonition %}} +{{% /admonition %}} diff --git a/docs/sources/v0.48.x/using-k6/scenarios/executors/ramping-vus.md b/docs/sources/v0.48.x/using-k6/scenarios/executors/ramping-vus.md index b74196a953..fea83b446a 100644 --- a/docs/sources/v0.48.x/using-k6/scenarios/executors/ramping-vus.md +++ b/docs/sources/v0.48.x/using-k6/scenarios/executors/ramping-vus.md @@ -67,7 +67,7 @@ export default function () { With [`gracefulRampDown`](https://grafana.com/docs/k6//using-k6/scenarios/concepts/graceful-stop#the-gracefulrampdown) set to 0 seconds, some iterations might be interrupted during the ramp down stage. - {{% /admonition %}} +{{% /admonition %}} ## Observations diff --git a/docs/sources/v0.48.x/using-k6/tags-and-groups.md b/docs/sources/v0.48.x/using-k6/tags-and-groups.md index dab67f8306..e674a7af5e 100644 --- a/docs/sources/v0.48.x/using-k6/tags-and-groups.md +++ b/docs/sources/v0.48.x/using-k6/tags-and-groups.md @@ -33,21 +33,21 @@ k6 provides two types of tags: Currently, k6 automatically creates the following tags by default: -| Tag | Description | -| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `proto` | the name of the protocol used (e.g. `HTTP/1.1`) | -| `subproto` | the subprotocol name (used by websockets) | -| `status` | the HTTP status code (e.g. `200`, `404`, etc.) | -| `method` | the HTTP method name (e.g. `GET`, `POST`, etc.) or the RPC method name for gRPC | -| `url` | the HTTP request URL | +| Tag | Description | +| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `proto` | the name of the protocol used (e.g. `HTTP/1.1`) | +| `subproto` | the subprotocol name (used by websockets) | +| `status` | the HTTP status code (e.g. `200`, `404`, etc.) | +| `method` | the HTTP method name (e.g. `GET`, `POST`, etc.) or the RPC method name for gRPC | +| `url` | the HTTP request URL | | `name` | the HTTP [request name](https://grafana.com/docs/k6//using-k6/http-requests#url-grouping) | -| `group` | the full [group](#groups) path, see the preceding explanation for details about its value | +| `group` | the full [group](#groups) path, see the preceding explanation for details about its value | | `check` | the [Check](https://grafana.com/docs/k6//using-k6/checks) name | -| `error` | a string with a non-HTTP error message (e.g. network or DNS error) | +| `error` | a string with a non-HTTP error message (e.g. network or DNS error) | | `error_code` | A number specifying an error types; a list of current error codes can be found at the [Error Codes](https://grafana.com/docs/k6//javascript-api/error-codes) page | | `tls_version` | the [TLS](https://grafana.com/docs/k6//using-k6/protocols/ssl-tls) version | -| `scenario` | the name of the scenario where the metric was emitted | -| `service` | the RPC service name for gRPC | +| `scenario` | the name of the scenario where the metric was emitted | +| `service` | the RPC service name for gRPC | | `expected_response` | `true` or `false` based on the [responseCallback](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback); by default checks whether the status is 2xx or 3xx | To disable some of the preceding tags, use the [`systemTags` option](https://grafana.com/docs/k6//using-k6/k6-options/reference#system-tags). @@ -55,11 +55,11 @@ Note that some data collectors, for example `cloud` runs, may require certain ta The following system tags are optional. Enable them as needed: -| Tag | Description | -| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `vu` | the ID of the virtual user that executed the request | -| `iter` | the iteration number | -| `ip` | The IP address of the remote server | +| Tag | Description | +| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `vu` | the ID of the virtual user that executed the request | +| `iter` | the iteration number | +| `ip` | The IP address of the remote server | | `ocsp_status` | the [Online Certificate Status Protocol (OCSP)](https://grafana.com/docs/k6//using-k6/protocols/ssl-tls/online-certificate-status-protocol--ocsp) HTTPS status | ## User-defined tags diff --git a/docs/sources/v0.48.x/using-k6/test-lifecycle.md b/docs/sources/v0.48.x/using-k6/test-lifecycle.md index 6b8838b7f2..eac388812e 100644 --- a/docs/sources/v0.48.x/using-k6/test-lifecycle.md +++ b/docs/sources/v0.48.x/using-k6/test-lifecycle.md @@ -21,7 +21,7 @@ a script always runs through these stages in the same order: Except for init code, each stage occurs in a _lifecycle function_, a function called in a specific sequence in the k6 runtime. - {{% /admonition %}} +{{% /admonition %}} {{< code >}} diff --git a/docs/sources/v0.48.x/using-k6/thresholds.md b/docs/sources/v0.48.x/using-k6/thresholds.md index 3c1feed982..b768813531 100644 --- a/docs/sources/v0.48.x/using-k6/thresholds.md +++ b/docs/sources/v0.48.x/using-k6/thresholds.md @@ -89,6 +89,7 @@ To use a threshold, follow these steps: ``` 2. Define at least one threshold expression. You can do this in two ways: + - The short format puts all threshold expressions as strings in an array. - The long format puts each threshold in an object, with extra properties to [abort on failure](#abort-a-test-when-a-threshold-is-crossed). @@ -159,14 +160,14 @@ export const CounterErrors = new Counter('Errors'); export const options = { thresholds: { // Count: Incorrect content cannot be returned more than 99 times. - Errors: ['count<100'], + 'Errors': ['count<100'], // Gauge: returned content must be smaller than 4000 bytes - ContentSize: ['value<4000'], + 'ContentSize': ['value<4000'], // Rate: content must be OK more than 95 times 'Content OK': ['rate>0.95'], // Trend: Percentiles, averages, medians, and minimums // must be within specified milliseconds. - RTT: ['p(99)<300', 'p(70)<250', 'avg<200', 'med<150', 'min<100'], + 'RTT': ['p(99)<300', 'p(70)<250', 'avg<200', 'med<150', 'min<100'], }, }; @@ -189,7 +190,7 @@ export default function () { Do not specify multiple thresholds for the same metric by repeating the same object key. - {{% /admonition %}} +{{% /admonition %}} Since thresholds are defined as the properties of a JavaScript object, you can't specify multiple ones with the same property name. @@ -370,7 +371,12 @@ export default function () { const responses = http.batch([ ['GET', 'https://test-api.k6.io/static/favicon.ico', null, { tags: { type: 'staticContent' } }], - ['GET', 'https://test-api.k6.io/static/css/site.css', null, { tags: { type: 'staticContent' } }], + [ + 'GET', + 'https://test-api.k6.io/static/css/site.css', + null, + { tags: { type: 'staticContent' } }, + ], ]); sleep(1); @@ -444,7 +450,7 @@ export default function () { When k6 runs in the cloud, thresholds are evaluated every 60 seconds. Therefore, the `abortOnFail` feature may be delayed by up to 60 seconds. - {{% /admonition %}} +{{% /admonition %}} ## Fail a load test using checks From dee057fb6ab94f4df55a8c8a016352e49ac62ac0 Mon Sep 17 00:00:00 2001 From: Heitor Tashiro Sergent Date: Fri, 29 Dec 2023 13:34:09 -0600 Subject: [PATCH 04/11] chore: run prettier on v0.47.x folder --- .../v0.47.x/examples/api-crud-operations.md | 6 +- .../examples/correlation-and-dynamic-data.md | 2 +- docs/sources/v0.47.x/examples/data-uploads.md | 6 +- .../v0.47.x/examples/distribute-workloads.md | 4 +- .../examples/get-started-with-k6/_index.md | 4 +- .../get-started-with-k6/analyze-results.md | 90 ++--- .../reuse-and-re-run-tests.md | 338 +++++++++--------- .../test-for-functional-behavior.md | 4 +- .../test-for-performance.md | 2 +- .../v0.47.x/examples/http-authentication.md | 9 +- .../v0.47.x/examples/oauth-authentication.md | 63 ++-- docs/sources/v0.47.x/examples/parse-html.md | 4 +- docs/sources/v0.47.x/examples/soap.md | 10 +- .../v0.47.x/examples/tracking-data-per.md | 2 +- docs/sources/v0.47.x/extensions/_index.md | 6 +- .../build-k6-binary-using-docker.md | 6 +- .../extensions/build-k6-binary-using-go.md | 2 +- .../v0.47.x/extensions/create/_index.md | 2 +- .../create/javascript-extensions.md | 14 +- .../extensions/create/output-extensions.md | 2 +- .../explanations/extension-graduation.md | 4 +- .../explanations/extensions-registry.md | 2 +- .../v0.47.x/get-started/results-output.md | 2 +- docs/sources/v0.47.x/javascript-api/_index.md | 125 ++++--- .../javascript-api/init-context/_index.md | 6 +- .../v0.47.x/javascript-api/jslib/_index.md | 8 +- .../jslib/aws/EventBridgeClient/_index.md | 4 +- .../jslib/aws/SystemsManagerClient/_index.md | 9 +- .../javascript-api/jslib/httpx/_index.md | 36 +- .../javascript-api/jslib/httpx/addheaders.md | 2 +- .../jslib/httpx/asyncrequest.md | 16 +- .../javascript-api/jslib/httpx/batch.md | 4 +- .../javascript-api/jslib/httpx/delete.md | 14 +- .../v0.47.x/javascript-api/jslib/httpx/get.md | 14 +- .../javascript-api/jslib/httpx/head.md | 14 +- .../javascript-api/jslib/httpx/options.md | 14 +- .../javascript-api/jslib/httpx/patch.md | 14 +- .../javascript-api/jslib/httpx/post.md | 14 +- .../v0.47.x/javascript-api/jslib/httpx/put.md | 14 +- .../javascript-api/jslib/httpx/request.md | 16 +- .../javascript-api/jslib/httpx/trace.md | 14 +- .../javascript-api/jslib/k6chaijs/_index.md | 8 +- .../javascript-api/jslib/utils/_index.md | 26 +- .../javascript-api/jslib/utils/findbetween.md | 10 +- .../javascript-api/k6-crypto/_index.md | 12 +- .../javascript-api/k6-crypto/createhash.md | 4 +- .../javascript-api/k6-crypto/createhmac.md | 4 +- .../v0.47.x/javascript-api/k6-data/_index.md | 8 +- .../javascript-api/k6-data/sharedarray.md | 2 +- .../javascript-api/k6-encoding/_index.md | 6 +- .../v0.47.x/javascript-api/k6-execution.md | 22 +- .../javascript-api/k6-experimental/_index.md | 8 +- .../k6-experimental/browser/_index.md | 36 +- .../browser/browsercontext/_index.md | 30 +- .../browser/browsercontext/addcookies.md | 2 +- .../browsercontext/clearpermissions.md | 2 +- .../browser/browsercontext/cookies.md | 10 +- .../browser/browsercontext/newpage.md | 4 +- .../browser/browsercontext/pages.md | 2 +- .../browser/browsercontext/setgeolocation.md | 2 +- .../browser/browsercontext/waitforevent.md | 6 +- .../k6-experimental/browser/context.md | 6 +- .../k6-experimental/browser/isconnected.md | 6 +- .../k6-experimental/browser/locator/_index.md | 4 +- .../k6-experimental/browser/locator/check.md | 20 +- .../k6-experimental/browser/locator/click.md | 28 +- .../browser/locator/dblclick.md | 26 +- .../k6-experimental/browser/locator/fill.md | 12 +- .../k6-experimental/browser/locator/focus.md | 6 +- .../browser/locator/getattribute.md | 8 +- .../k6-experimental/browser/locator/hover.md | 22 +- .../browser/locator/innerhtml.md | 6 +- .../browser/locator/innertext.md | 6 +- .../browser/locator/inputvalue.md | 6 +- .../browser/locator/ischecked.md | 6 +- .../browser/locator/isdisabled.md | 6 +- .../browser/locator/iseditable.md | 6 +- .../browser/locator/isenabled.md | 6 +- .../browser/locator/ishidden.md | 6 +- .../browser/locator/isvisible.md | 6 +- .../k6-experimental/browser/locator/press.md | 12 +- .../browser/locator/selectoption.md | 14 +- .../k6-experimental/browser/locator/tap.md | 22 +- .../browser/locator/textcontent.md | 6 +- .../k6-experimental/browser/locator/type.md | 12 +- .../browser/locator/uncheck.md | 20 +- .../browser/locator/waitfor.md | 10 +- .../k6-experimental/browser/newcontext.md | 64 ++-- .../k6-experimental/browser/newpage.md | 66 ++-- .../k6-experimental/browser/page/_index.md | 126 +++---- .../k6-experimental/browser/page/check.md | 24 +- .../k6-experimental/browser/page/click.md | 32 +- .../k6-experimental/browser/page/context.md | 4 +- .../k6-experimental/browser/page/dblclick.md | 30 +- .../browser/page/dispatchevent.md | 16 +- .../k6-experimental/browser/page/dollar.md | 6 +- .../browser/page/doubledollar.md | 6 +- .../browser/page/evaluatehandle.md | 4 +- .../k6-experimental/browser/page/fill.md | 18 +- .../k6-experimental/browser/page/focus.md | 12 +- .../k6-experimental/browser/page/frames.md | 4 +- .../browser/page/getattribute.md | 14 +- .../k6-experimental/browser/page/goto.md | 20 +- .../k6-experimental/browser/page/hover.md | 26 +- .../k6-experimental/browser/page/innerhtml.md | 12 +- .../k6-experimental/browser/page/innertext.md | 12 +- .../browser/page/inputvalue.md | 12 +- .../k6-experimental/browser/page/ischecked.md | 12 +- .../k6-experimental/browser/page/isclosed.md | 2 +- .../browser/page/isdisabled.md | 12 +- .../browser/page/iseditable.md | 12 +- .../k6-experimental/browser/page/isenabled.md | 12 +- .../k6-experimental/browser/page/ishidden.md | 12 +- .../k6-experimental/browser/page/isvisible.md | 12 +- .../k6-experimental/browser/page/keyboard.md | 4 +- .../k6-experimental/browser/page/locator.md | 4 +- .../k6-experimental/browser/page/mainframe.md | 4 +- .../k6-experimental/browser/page/mouse.md | 4 +- .../k6-experimental/browser/page/on.md | 9 +- .../k6-experimental/browser/page/opener.md | 4 +- .../k6-experimental/browser/page/press.md | 18 +- .../k6-experimental/browser/page/reload.md | 16 +- .../browser/page/selectoption.md | 18 +- .../browser/page/setcontent.md | 10 +- .../k6-experimental/browser/page/tap.md | 26 +- .../browser/page/textcontent.md | 12 +- .../browser/page/touchscreen.md | 4 +- .../k6-experimental/browser/page/type.md | 18 +- .../k6-experimental/browser/page/uncheck.md | 24 +- .../browser/page/waitforfunction.md | 16 +- .../browser/page/waitforloadstate.md | 14 +- .../browser/page/waitfornavigation.md | 16 +- .../browser/page/waitforselector.md | 18 +- .../browser/page/waitfortimeout.md | 2 +- .../k6-experimental/browser/page/workers.md | 4 +- .../k6-experimental/browser/request/_index.md | 2 +- .../k6-experimental/browser/response.md | 34 +- .../k6-experimental/grpc/_index.md | 26 +- .../k6-experimental/grpc/client/_index.md | 14 +- .../grpc/client/client-invoke.md | 6 +- .../k6-experimental/grpc/response.md | 12 +- .../k6-experimental/grpc/stream/_index.md | 6 +- .../k6-experimental/grpc/stream/stream-on.md | 8 +- .../k6-experimental/redis/_index.md | 6 +- .../k6-experimental/redis/client/_index.md | 20 +- .../k6-experimental/tracing/_index.md | 4 +- .../k6-experimental/tracing/client.md | 8 +- .../k6-experimental/tracing/instrumenthttp.md | 4 +- .../k6-experimental/webcrypto/_index.md | 13 +- .../webcrypto/crypto/_index.md | 16 +- .../webcrypto/subtlecrypto/_index.md | 9 +- .../webcrypto/subtlecrypto/decrypt.md | 13 +- .../webcrypto/subtlecrypto/encrypt.md | 15 +- .../webcrypto/subtlecrypto/exportkey.md | 11 +- .../webcrypto/subtlecrypto/generatekey.md | 8 +- .../webcrypto/subtlecrypto/importkey.md | 17 +- .../webcrypto/subtlecrypto/sign.md | 8 +- .../webcrypto/subtlecrypto/verify.md | 10 +- .../k6-experimental/websockets/_index.md | 16 +- .../k6-experimental/websockets/params.md | 12 +- .../websockets/websocket/_index.md | 8 +- .../websocket/websocket-addeventlistener.md | 14 +- .../v0.47.x/javascript-api/k6-html/_index.md | 12 +- .../v0.47.x/javascript-api/k6-html/element.md | 70 ++-- .../javascript-api/k6-html/parsehtml.md | 4 +- .../k6-html/selection/_index.md | 72 ++-- .../k6-html/selection/selection-children.md | 4 +- .../k6-html/selection/selection-closest.md | 4 +- .../k6-html/selection/selection-contents.md | 4 +- .../k6-html/selection/selection-eq.md | 4 +- .../k6-html/selection/selection-filter.md | 12 +- .../k6-html/selection/selection-find.md | 4 +- .../k6-html/selection/selection-first.md | 4 +- .../k6-html/selection/selection-has.md | 4 +- .../k6-html/selection/selection-is.md | 12 +- .../k6-html/selection/selection-last.md | 4 +- .../k6-html/selection/selection-next.md | 4 +- .../k6-html/selection/selection-nextall.md | 4 +- .../k6-html/selection/selection-nextuntil.md | 10 +- .../k6-html/selection/selection-not.md | 4 +- .../k6-html/selection/selection-parent.md | 4 +- .../k6-html/selection/selection-parents.md | 4 +- .../selection/selection-parentsuntil.md | 10 +- .../k6-html/selection/selection-prev.md | 4 +- .../k6-html/selection/selection-prevall.md | 4 +- .../k6-html/selection/selection-prevuntil.md | 10 +- .../k6-html/selection/selection-slice.md | 12 +- .../k6-html/selection/selection-toarray.md | 4 +- .../v0.47.x/javascript-api/k6-http/_index.md | 36 +- .../javascript-api/k6-http/asyncrequest.md | 18 +- .../v0.47.x/javascript-api/k6-http/batch.md | 14 +- .../javascript-api/k6-http/cookiejar.md | 4 +- .../k6-http/cookiejar/_index.md | 10 +- .../v0.47.x/javascript-api/k6-http/del.md | 12 +- .../k6-http/expected-statuses.md | 4 +- .../v0.47.x/javascript-api/k6-http/file.md | 4 +- .../v0.47.x/javascript-api/k6-http/get.md | 12 +- .../v0.47.x/javascript-api/k6-http/head.md | 12 +- .../v0.47.x/javascript-api/k6-http/options.md | 14 +- .../v0.47.x/javascript-api/k6-http/params.md | 26 +- .../v0.47.x/javascript-api/k6-http/patch.md | 14 +- .../v0.47.x/javascript-api/k6-http/post.md | 14 +- .../v0.47.x/javascript-api/k6-http/put.md | 14 +- .../v0.47.x/javascript-api/k6-http/request.md | 16 +- .../javascript-api/k6-http/response/_index.md | 76 ++-- .../response/response-clicklink---params.md | 8 +- .../k6-http/response/response-html.md | 4 +- .../response/response-submitform---params.md | 12 +- .../k6-http/set-response-callback.md | 4 +- .../javascript-api/k6-metrics/_index.md | 4 +- .../k6-metrics/counter/_index.md | 6 +- .../counter/counter-add-value---tags.md | 6 +- .../javascript-api/k6-metrics/gauge/_index.md | 4 +- .../gauge/gauge-add-value---tags.md | 6 +- .../javascript-api/k6-metrics/rate/_index.md | 4 +- .../k6-metrics/rate/rate-add-value---tags.md | 6 +- .../javascript-api/k6-metrics/trend/_index.md | 4 +- .../trend/trend-add-value---tags.md | 6 +- .../javascript-api/k6-net-grpc/_index.md | 22 +- .../k6-net-grpc/client/_index.md | 14 +- .../k6-net-grpc/client/client-invoke.md | 6 +- .../javascript-api/k6-net-grpc/response.md | 12 +- .../v0.47.x/javascript-api/k6-ws/_index.md | 12 +- .../v0.47.x/javascript-api/k6-ws/connect.md | 12 +- .../v0.47.x/javascript-api/k6-ws/params.md | 12 +- .../javascript-api/k6-ws/socket/_index.md | 4 +- .../javascript-api/k6-ws/socket/socket-on.md | 14 +- .../v0.47.x/javascript-api/k6/_index.md | 4 +- .../v0.47.x/javascript-api/k6/group.md | 2 +- .../javascript-api/xk6-disruptor/_index.md | 4 +- .../xk6-disruptor/faults/_index.md | 10 +- .../xk6-disruptor/faults/grpc.md | 2 +- .../xk6-disruptor/faults/http.md | 2 +- .../xk6-disruptor/faults/pod-termination.md | 8 +- .../xk6-disruptor/poddisruptor/_index.md | 14 +- .../poddisruptor/injectgrpcfaults.md | 8 +- .../poddisruptor/injecthttpfaults.md | 10 +- .../poddisruptor/terminate-pods.md | 12 +- .../xk6-disruptor/servicedisruptor/_index.md | 14 +- .../servicedisruptor/injectgrpcfaults.md | 8 +- .../servicedisruptor/injecthttpfaults.md | 10 +- .../servicedisruptor/terminate-pods.md | 12 +- docs/sources/v0.47.x/misc/archive.md | 13 +- docs/sources/v0.47.x/misc/fine-tuning-os.md | 4 +- docs/sources/v0.47.x/misc/integrations.md | 2 +- .../results-output/end-of-test/_index.md | 4 +- .../results-output/grafana-dashboards.md | 8 +- .../real-time/amazon-cloudwatch.md | 2 +- .../results-output/real-time/datadog.md | 2 +- .../results-output/real-time/dynatrace.md | 2 +- .../results-output/real-time/elasticsearch.md | 2 +- .../real-time/grafana-cloud-prometheus.md | 2 +- .../results-output/real-time/netdata.md | 2 +- .../results-output/real-time/newrelic.md | 4 +- .../real-time/prometheus-remote-write.md | 12 +- .../results-output/real-time/statsd.md | 2 +- .../v0.47.x/shared/browser-module-wip.md | 2 +- docs/sources/v0.47.x/shared/crypto-module.md | 2 +- .../v0.47.x/shared/experimental-module.md | 2 +- docs/sources/v0.47.x/shared/grpc-module.md | 2 +- docs/sources/v0.47.x/shared/index.md | 2 +- docs/sources/v0.47.x/shared/ws-module.md | 2 +- .../automated-performance-testing.md | 6 +- .../_index.md | 10 +- .../examples/_index.md | 2 +- .../inject-grpc-faults-into-service.md | 10 +- .../examples/inject-http-faults-into-pod.md | 14 +- .../first-steps.md | 23 +- .../requirements.md | 2 +- .../running-distributed-tests.md | 24 +- .../testing-guides/running-large-tests.md | 4 +- .../testing-guides/test-types/load-testing.md | 2 +- .../test-types/stress-testing.md | 2 +- .../v0.47.x/using-k6-browser/_index.md | 2 +- .../v0.47.x/using-k6-browser/metrics.md | 31 +- .../using-k6-browser/migrating-to-k6-v0-46.md | 6 +- .../hybrid-approach-to-performance.md | 82 +++-- .../selecting-elements.md | 2 +- .../using-k6-browser/running-browser-tests.md | 15 +- docs/sources/v0.47.x/using-k6/checks.md | 5 +- .../using-k6/execution-context-variables.md | 4 +- .../sources/v0.47.x/using-k6/http-requests.md | 16 +- .../v0.47.x/using-k6/k6-options/_index.md | 4 +- .../v0.47.x/using-k6/k6-options/how-to.md | 16 +- .../v0.47.x/using-k6/k6-options/reference.md | 122 +++---- .../v0.47.x/using-k6/metrics/_index.md | 8 +- .../using-k6/metrics/create-custom-metrics.md | 6 +- .../v0.47.x/using-k6/metrics/reference.md | 20 +- docs/sources/v0.47.x/using-k6/modules.md | 4 +- .../v0.47.x/using-k6/protocols/_index.md | 4 +- .../using-k6/protocols/ssl-tls/_index.md | 2 +- .../ssl-tls/ssl-tls-version-and-ciphers.md | 2 +- .../v0.47.x/using-k6/scenarios/_index.md | 12 +- .../using-k6/scenarios/advanced-examples.md | 2 +- .../using-k6/scenarios/concepts/_index.md | 6 +- .../using-k6/scenarios/executors/_index.md | 18 +- .../scenarios/executors/ramping-vus.md | 2 +- .../scenarios/executors/shared-iterations.md | 2 +- .../v0.47.x/using-k6/tags-and-groups.md | 32 +- .../v0.47.x/using-k6/test-lifecycle.md | 2 +- docs/sources/v0.47.x/using-k6/thresholds.md | 18 +- 301 files changed, 2078 insertions(+), 1990 deletions(-) diff --git a/docs/sources/v0.47.x/examples/api-crud-operations.md b/docs/sources/v0.47.x/examples/api-crud-operations.md index e580bca992..0633988d98 100644 --- a/docs/sources/v0.47.x/examples/api-crud-operations.md +++ b/docs/sources/v0.47.x/examples/api-crud-operations.md @@ -154,7 +154,11 @@ export default (authToken) => { ```javascript import { describe, expect } from 'https://jslib.k6.io/k6chaijs/4.3.4.3/index.js'; import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js'; -import { randomIntBetween, randomItem, randomString } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; +import { + randomIntBetween, + randomItem, + randomString, +} from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; export const options = { // for the example, let's run only 1 VU with 1 iteration diff --git a/docs/sources/v0.47.x/examples/correlation-and-dynamic-data.md b/docs/sources/v0.47.x/examples/correlation-and-dynamic-data.md index 4ec449c2de..30ca08ec01 100644 --- a/docs/sources/v0.47.x/examples/correlation-and-dynamic-data.md +++ b/docs/sources/v0.47.x/examples/correlation-and-dynamic-data.md @@ -110,7 +110,7 @@ export default function () { **Relevant k6 APIs**: - [Selection.find(selector)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-find) (the [jQuery Selector API](http://api.jquery.com/category/selectors/) -docs are also a good resource on what possible selector queries can be made) + docs are also a good resource on what possible selector queries can be made) - [Selection.attr(name)](https://grafana.com/docs/k6//javascript-api/k6-html/selection/selection-attr) ### Generic extraction of values/tokens diff --git a/docs/sources/v0.47.x/examples/data-uploads.md b/docs/sources/v0.47.x/examples/data-uploads.md index 81be230cf1..f4354347df 100644 --- a/docs/sources/v0.47.x/examples/data-uploads.md +++ b/docs/sources/v0.47.x/examples/data-uploads.md @@ -118,7 +118,11 @@ const txt = open('/path/to/text.txt'); export default function () { const fd = new FormData(); fd.append('someTextField', 'someValue'); - fd.append('aBinaryFile', { data: new Uint8Array(img1).buffer, filename: 'logo.png', content_type: 'image/png' }); + fd.append('aBinaryFile', { + data: new Uint8Array(img1).buffer, + filename: 'logo.png', + content_type: 'image/png', + }); fd.append('anotherTextField', 'anotherValue'); fd.append('images', http.file(img1, 'image1.png', 'image/png')); fd.append('images', http.file(img2, 'image2.jpg', 'image/jpeg')); diff --git a/docs/sources/v0.47.x/examples/distribute-workloads.md b/docs/sources/v0.47.x/examples/distribute-workloads.md index 868873334d..2dcf1a189d 100644 --- a/docs/sources/v0.47.x/examples/distribute-workloads.md +++ b/docs/sources/v0.47.x/examples/distribute-workloads.md @@ -19,7 +19,7 @@ To inspect the results for a certain behavior, you can [create a custom metric]( These techniques can create very complex configurations. However, more complexity creates more ambiguity in result interpretation - {{% /admonition %}} +{{% /admonition %}} ## Split logic across scenarios @@ -27,7 +27,7 @@ However, more complexity creates more ambiguity in result interpretation In this context, _workload_ refers to the traffic pattern simulated by a scenario. - {{% /admonition %}} +{{% /admonition %}} One way to distribute traffic is to use scenarios to schedule different workloads for different functions. diff --git a/docs/sources/v0.47.x/examples/get-started-with-k6/_index.md b/docs/sources/v0.47.x/examples/get-started-with-k6/_index.md index 8f18ddf199..3e8f7c81a3 100644 --- a/docs/sources/v0.47.x/examples/get-started-with-k6/_index.md +++ b/docs/sources/v0.47.x/examples/get-started-with-k6/_index.md @@ -38,8 +38,8 @@ The tutorial requires the following: ## Tutorials -| In this tutorial | Learn how to | -| ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | +| In this tutorial | Learn how to | +| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | [Test for functional behavior](https://grafana.com/docs/k6//examples/get-started-with-k6/test-for-functional-behavior) | Use k6 to script requests and evaluate that performance is correct | | [Test for performance](https://grafana.com/docs/k6//examples/get-started-with-k6/test-for-performance) | Use k6 to increase load and find faults | | [Analyze results](https://grafana.com/docs/k6//examples/get-started-with-k6/analyze-results) | Filter results and make custom metrics | diff --git a/docs/sources/v0.47.x/examples/get-started-with-k6/analyze-results.md b/docs/sources/v0.47.x/examples/get-started-with-k6/analyze-results.md index 6c259f6c69..e5bf0ea95f 100644 --- a/docs/sources/v0.47.x/examples/get-started-with-k6/analyze-results.md +++ b/docs/sources/v0.47.x/examples/get-started-with-k6/analyze-results.md @@ -75,6 +75,7 @@ jq '. | select(.type == "Point" and .data.tags.status == "200")' results.json Or calculate the aggregated value of any metric with any particular tags. {{< code >}} + ```average jq '. | select(.type == "Point" and .metric == "http_req_duration") | .data.value' results.json | jq -s 'add/length' ``` @@ -86,6 +87,7 @@ jq '. | select(.type == "Point" and .metric == "http_req_duration") | .data.valu ```max jq '. | select(.type == "Point" and .metric == "http_req_duration") | .data.value' results.json | jq -s max ``` + {{< /code >}} ## Apply custom tags @@ -132,7 +134,7 @@ export default function () { } ``` - {{< /code >}} +{{< /code >}} Run the test: @@ -193,8 +195,8 @@ export default function () { sleep(1); } ``` -{{< /code >}} +{{< /code >}} ### Add Group functions @@ -212,22 +214,22 @@ import { group, sleep } from 'k6'; const baseUrl = 'https://test.k6.io'; export default function () { -// visit some endpoints in one group -group('Contacts flow', function () { - http.get(`${baseUrl}/contacts.php`); - sleep(1); - // return to the home page - http.get(`${baseUrl}/`); - sleep(1); -}); + // visit some endpoints in one group + group('Contacts flow', function () { + http.get(`${baseUrl}/contacts.php`); + sleep(1); + // return to the home page + http.get(`${baseUrl}/`); + sleep(1); + }); -// Coinflip players in another group -group('Coinflip game', function () { - http.get(`${baseUrl}/flip_coin.php?bet=heads`); - sleep(1); - http.get(`${baseUrl}/flip_coin.php?bet=tails`); - sleep(1); -}); + // Coinflip players in another group + group('Coinflip game', function () { + http.get(`${baseUrl}/flip_coin.php?bet=heads`); + sleep(1); + http.get(`${baseUrl}/flip_coin.php?bet=tails`); + sleep(1); + }); } ``` @@ -279,35 +281,35 @@ const contactsLatency = new Trend('contacts_duration'); const coinflipLatency = new Trend('coinflip_duration'); export default function () { -// Put visits to contact page in one group -let res; -group('Contacts flow', function () { - // save response as variable - res = http.get(`${baseUrl}/contacts.php`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - - res = http.get(`${baseUrl}/`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); -}); + // Put visits to contact page in one group + let res; + group('Contacts flow', function () { + // save response as variable + res = http.get(`${baseUrl}/contacts.php`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + + res = http.get(`${baseUrl}/`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + }); -// Coinflip players in another group + // Coinflip players in another group -group('Coinflip game', function () { - // save response as variable - let res = http.get(`${baseUrl}/flip_coin.php?bet=heads`); - // add duration property to metric - coinflipLatency.add(res.timings.duration); - sleep(1); + group('Coinflip game', function () { + // save response as variable + let res = http.get(`${baseUrl}/flip_coin.php?bet=heads`); + // add duration property to metric + coinflipLatency.add(res.timings.duration); + sleep(1); - res = http.get(`${baseUrl}/flip_coin.php?bet=tails`); - // add duration property to metric - coinflipLatency.add(res.timings.duration); - sleep(1); -}); + res = http.get(`${baseUrl}/flip_coin.php?bet=tails`); + // add duration property to metric + coinflipLatency.add(res.timings.duration); + sleep(1); + }); } ``` @@ -329,6 +331,7 @@ contacts_duration..............: avg=125.76985 min=116.973 med=120.6735 max=200 You can also query custom metric results from the JSON results. For example, to get the aggregated results as. {{< code >}} + ```avg jq '. | select(.type == "Point" and .metric == "coinflip_duration") | .data.value' results.json | jq -s 'add/length' ``` @@ -340,6 +343,7 @@ jq '. | select(.type == "Point" and .metric == "coinflip_duration") | .data.valu ```max jq '. | select(.type == "Point" and .metric == "coinflip_duration") | .data.value' results.json | jq -s max ``` + {{< /code >}} ## Next steps diff --git a/docs/sources/v0.47.x/examples/get-started-with-k6/reuse-and-re-run-tests.md b/docs/sources/v0.47.x/examples/get-started-with-k6/reuse-and-re-run-tests.md index 048c43a22f..64e3859b21 100644 --- a/docs/sources/v0.47.x/examples/get-started-with-k6/reuse-and-re-run-tests.md +++ b/docs/sources/v0.47.x/examples/get-started-with-k6/reuse-and-re-run-tests.md @@ -136,121 +136,125 @@ As is, this script won't work, since it has undeclared functions and variables. 1. Finally, pass `baseUrl` as a parameter of the `contacts` function. - {{< code >}} - ```javascript - import http from 'k6/http'; - import { Trend } from 'k6/metrics'; - import { group, sleep } from 'k6'; - - const contactsLatency = new Trend('contact_duration'); - - export function contacts(baseUrl) { - group('Contacts flow', function () { - // save response as variable - let res = http.get(`${baseUrl}/contacts.php`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - - res = http.get(`${baseUrl}/`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - }); - } - ``` - {{< /code >}} +{{< code >}} + +```javascript +import http from 'k6/http'; +import { Trend } from 'k6/metrics'; +import { group, sleep } from 'k6'; + +const contactsLatency = new Trend('contact_duration'); + +export function contacts(baseUrl) { + group('Contacts flow', function () { + // save response as variable + let res = http.get(`${baseUrl}/contacts.php`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + + res = http.get(`${baseUrl}/`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + }); +} +``` + +{{< /code >}} 1. Repeat the process with the `coinflip` group in a file called `coinflip.js`. Use the tabs to see the final three files should (`options` moved to the bottom of `main.js` for better readability). - {{< code >}} - ```main - import { contacts } from './contacts.js'; - import { coinflip } from './coinflip.js'; - - const baseUrl = 'https://test.k6.io'; - - export default function () { - // Put visits to contact page in one group - contacts(baseUrl); - // Coinflip players in another group - coinflip(baseUrl); - } - - //define configuration - export const options = { - scenarios: { - //arbitrary name of scenario: - breaking: { - executor: 'ramping-vus', - stages: [ - { duration: '10s', target: 20 }, - { duration: '50s', target: 20 }, - { duration: '50s', target: 40 }, - { duration: '50s', target: 60 }, - { duration: '50s', target: 80 }, - { duration: '50s', target: 100 }, - { duration: '50s', target: 120 }, - { duration: '50s', target: 140 }, - //.... - ], - }, - }, - //define thresholds - thresholds: { - http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], // availability threshold for error rate - http_req_duration: ['p(99)<1000'], // Latency threshold for percentile +{{< code >}} + +```main +import { contacts } from './contacts.js'; +import { coinflip } from './coinflip.js'; + +const baseUrl = 'https://test.k6.io'; + +export default function () { + // Put visits to contact page in one group + contacts(baseUrl); + // Coinflip players in another group + coinflip(baseUrl); +} + +//define configuration +export const options = { + scenarios: { + //arbitrary name of scenario: + breaking: { + executor: 'ramping-vus', + stages: [ + { duration: '10s', target: 20 }, + { duration: '50s', target: 20 }, + { duration: '50s', target: 40 }, + { duration: '50s', target: 60 }, + { duration: '50s', target: 80 }, + { duration: '50s', target: 100 }, + { duration: '50s', target: 120 }, + { duration: '50s', target: 140 }, + //.... + ], }, - }; - ``` - - ```contacts - import http from 'k6/http'; - import { Trend } from 'k6/metrics'; - import { group, sleep } from 'k6'; - - const contactsLatency = new Trend('contact_duration'); - - export function contacts(baseUrl) { - group('Contacts flow', function () { - // save response as variable - let res = http.get(`${baseUrl}/contacts.php`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - - res = http.get(`${baseUrl}/`); - // add duration property to metric - contactsLatency.add(res.timings.duration); - sleep(1); - }); - } - ``` - - ```coinflip - import http from 'k6/http'; - import { Trend } from 'k6/metrics'; - import { group, sleep } from 'k6'; - - const coinflipLatency = new Trend('coinflip_duration'); - - export function coinflip(baseUrl) { - group('Coinflip game', function () { - // save response as variable - let res = http.get(`${baseUrl}/flip_coin.php?bet=heads`); - // add duration property to metric - coinflipLatency.add(res.timings.duration); - sleep(1); - // mutate for new request - res = http.get(`${baseUrl}/flip_coin.php?bet=tails`); - // add duration property to metric - coinflipLatency.add(res.timings.duration); - sleep(1); - }); - } - ``` - {{< /code >}} + }, + //define thresholds + thresholds: { + http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], // availability threshold for error rate + http_req_duration: ['p(99)<1000'], // Latency threshold for percentile + }, +}; +``` + +```contacts +import http from 'k6/http'; +import { Trend } from 'k6/metrics'; +import { group, sleep } from 'k6'; + +const contactsLatency = new Trend('contact_duration'); + +export function contacts(baseUrl) { + group('Contacts flow', function () { + // save response as variable + let res = http.get(`${baseUrl}/contacts.php`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + + res = http.get(`${baseUrl}/`); + // add duration property to metric + contactsLatency.add(res.timings.duration); + sleep(1); + }); +} +``` + +```coinflip +import http from 'k6/http'; +import { Trend } from 'k6/metrics'; +import { group, sleep } from 'k6'; + +const coinflipLatency = new Trend('coinflip_duration'); + +export function coinflip(baseUrl) { + group('Coinflip game', function () { + // save response as variable + let res = http.get(`${baseUrl}/flip_coin.php?bet=heads`); + // add duration property to metric + coinflipLatency.add(res.timings.duration); + sleep(1); + // mutate for new request + res = http.get(`${baseUrl}/flip_coin.php?bet=tails`); + // add duration property to metric + coinflipLatency.add(res.timings.duration); + sleep(1); + }); +} +``` + +{{< /code >}} Run the test: @@ -268,6 +272,7 @@ Now that the iteration code is totally modularized, you might modularize your `o The following example creates a module `config.js` to export the threshold and workload settings. {{< code >}} + ```main import { coinflip } from './coinflip.js'; import { contacts } from './contacts.js'; @@ -307,6 +312,7 @@ export const breakingWorkload = { ], }; ``` + {{< /code >}} Notice the length of this final script and compare it with the script at the beginning of this page. @@ -327,65 +333,69 @@ Change `main.js` and `config.js` so that it: To do this, follow these steps: 1. Add the workload settings for configuring the smoke test to `config.js`: - - {{< code >}} - - ```javascript - export const smokeWorkload = { - executor: 'shared-iterations', - iterations: 5, - vus: 1, - }; - - export const thresholdsSettings = { - http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], - http_req_duration: ['p(99)<1000'], - }; - - export const breakingWorkload = { - executor: 'ramping-vus', - stages: [ - { duration: '10s', target: 20 }, - { duration: '50s', target: 20 }, - { duration: '50s', target: 40 }, - { duration: '50s', target: 60 }, - { duration: '50s', target: 80 }, - { duration: '50s', target: 100 }, - { duration: '50s', target: 120 }, - { duration: '50s', target: 140 }, - //.... - ], - }; - ``` - {{< /code >}} + +{{< code >}} + +```javascript +export const smokeWorkload = { + executor: 'shared-iterations', + iterations: 5, + vus: 1, +}; + +export const thresholdsSettings = { + http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], + http_req_duration: ['p(99)<1000'], +}; + +export const breakingWorkload = { + executor: 'ramping-vus', + stages: [ + { duration: '10s', target: 20 }, + { duration: '50s', target: 20 }, + { duration: '50s', target: 40 }, + { duration: '50s', target: 60 }, + { duration: '50s', target: 80 }, + { duration: '50s', target: 100 }, + { duration: '50s', target: 120 }, + { duration: '50s', target: 140 }, + //.... + ], +}; +``` + +{{< /code >}} 2. Edit `main.js` to choose the workload settings depending on the `WORKLOAD` environment variable. For example: - {{< code >}} - ```javascript - import { coinflip } from './coinflip.js'; - import { contacts } from './contacts.js'; - import { thresholdsSettings, breakingWorkload, smokeWorkload } from './config.js'; +{{< code >}} + +```javascript +import { coinflip } from './coinflip.js'; +import { contacts } from './contacts.js'; +import { thresholdsSettings, breakingWorkload, smokeWorkload } from './config.js'; + +export const options = { + scenarios: { + my_scenario: __ENV.WORKLOAD === 'breaking' ? breakingWorkload : smokeWorkload, + }, + thresholds: thresholdsSettings, +}; + +const baseUrl = 'https://test.k6.io'; + +export default function () { + contacts(baseUrl); + coinflip(baseUrl); +} +``` + +{{< /code >}} - export const options = { - scenarios: { - my_scenario: __ENV.WORKLOAD === 'breaking' ? breakingWorkload : smokeWorkload, - }, - thresholds: thresholdsSettings, - }; - - const baseUrl = 'https://test.k6.io'; - - export default function () { - contacts(baseUrl); - coinflip(baseUrl); - } - ``` - {{< /code >}} - 3. Run the script with and without the `-e` flag. - - What happens when you run `k6 run main.js`? - - What about `k6 run main.js -e WORKLOAD=breaking`? + +- What happens when you run `k6 run main.js`? +- What about `k6 run main.js -e WORKLOAD=breaking`? This was a simple example to showcase how you can modularize a test. As your test suite grows and more people are involved in performance testing, your modularization strategy becomes essential to building and maintaining an efficient testing suite. diff --git a/docs/sources/v0.47.x/examples/get-started-with-k6/test-for-functional-behavior.md b/docs/sources/v0.47.x/examples/get-started-with-k6/test-for-functional-behavior.md index d3ac1aa300..953091b589 100644 --- a/docs/sources/v0.47.x/examples/get-started-with-k6/test-for-functional-behavior.md +++ b/docs/sources/v0.47.x/examples/get-started-with-k6/test-for-functional-behavior.md @@ -123,7 +123,7 @@ export default function () { } ``` - {{< /code >}} +{{< /code >}} 1. Run the script again. @@ -145,7 +145,7 @@ Under larger loads, this check will fail in some iterations. Rather, k6 tracks the success rate and presents it in your [end of test](https://grafana.com/docs/k6//results-output/end-of-test) summary. - {{% /admonition %}} +{{% /admonition %}} ## Next steps diff --git a/docs/sources/v0.47.x/examples/get-started-with-k6/test-for-performance.md b/docs/sources/v0.47.x/examples/get-started-with-k6/test-for-performance.md index 5e48cbba79..e65a26719c 100644 --- a/docs/sources/v0.47.x/examples/get-started-with-k6/test-for-performance.md +++ b/docs/sources/v0.47.x/examples/get-started-with-k6/test-for-performance.md @@ -111,7 +111,7 @@ Scenarios schedule load according to the number of VUs, number of iterations, VU ### Run a smoke test -Start small. Run a [smoke test](https://grafana.com/docs/k6//testing-guides/test-types/smoke-testing "a small test to confirm the script works properly") to check that your script can handle a minimal load. +Start small. Run a [smoke test](https://grafana.com/docs/k6//testing-guides/test-types/smoke-testing 'a small test to confirm the script works properly') to check that your script can handle a minimal load. To do so, use the [`--iterations`](https://grafana.com/docs/k6//using-k6/k6-options/reference#iterations) flag with an argument of 10 or fewer. diff --git a/docs/sources/v0.47.x/examples/http-authentication.md b/docs/sources/v0.47.x/examples/http-authentication.md index dba178a35f..cb409bc857 100644 --- a/docs/sources/v0.47.x/examples/http-authentication.md +++ b/docs/sources/v0.47.x/examples/http-authentication.md @@ -74,9 +74,12 @@ export default function () { // Passing username and password as part of URL plus the auth option will // authenticate using HTTP Digest authentication. const credentials = `${username}:${password}`; - const res = http.get(`https://${credentials}@httpbin.test.k6.io/digest-auth/auth/${username}/${password}`, { - auth: 'digest', - }); + const res = http.get( + `https://${credentials}@httpbin.test.k6.io/digest-auth/auth/${username}/${password}`, + { + auth: 'digest', + } + ); // Verify response (checking the echoed data from the httpbin.test.k6.io digest auth // test API endpoint) diff --git a/docs/sources/v0.47.x/examples/oauth-authentication.md b/docs/sources/v0.47.x/examples/oauth-authentication.md index d360eaca65..604e402a57 100644 --- a/docs/sources/v0.47.x/examples/oauth-authentication.md +++ b/docs/sources/v0.47.x/examples/oauth-authentication.md @@ -70,30 +70,30 @@ This example is based on a JMeter example found at the [azure-ad-b2c/load-tests] To use this script, you need to: 1. [Set up your own Azure B2C tenant](https://learn.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant) - * Copy the tenant name, it will be used in your test script. + - Copy the tenant name, it will be used in your test script. 1. [Register a web application](https://learn.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-applications?tabs=app-reg-ga) - * Register a single page application with the redirect URL of: https://jwt.ms. That's needed for the flow to receive a token. - * After the creation, you can get the Application (client) ID, and the Directory (tenant) ID. Copy both of them, they'll be used in your test script. + - Register a single page application with the redirect URL of: https://jwt.ms. That's needed for the flow to receive a token. + - After the creation, you can get the Application (client) ID, and the Directory (tenant) ID. Copy both of them, they'll be used in your test script. 1. [Create a user flow so that you can sign up and create a user](https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-user-flows) - * Create a new user, and copy the username and password. They'll be used in the test script. + - Create a new user, and copy the username and password. They'll be used in the test script. You can find the settings in the B2C settings in the Azure portal if you need to refer to them later on. Make sure to fill out all the variables for the `B2CGraphSettings` object, as well as replace `USERNAME` and `PASSWORD` in `export default function`. {{< code >}} ```javascript -import http from "k6/http"; -import crypto from "k6/crypto"; -import { randomString } from "https://jslib.k6.io/k6-utils/1.2.0/index.js"; +import http from 'k6/http'; +import crypto from 'k6/crypto'; +import { randomString } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; const B2CGraphSettings = { B2C: { - client_id: "", // Application ID in Azure - user_flow_name: "", - tenant_id: "", // Directory ID in Azure - tenant_name: "", - scope: "openid", - redirect_url: "https://jwt.ms", + client_id: '', // Application ID in Azure + user_flow_name: '', + tenant_id: '', // Directory ID in Azure + tenant_name: '', + scope: 'openid', + redirect_url: 'https://jwt.ms', }, }; @@ -137,9 +137,9 @@ const GetToken = (code, codeVerifier) => { `&redirect_uri=${B2CGraphSettings.B2C.redirect_url}` + `&code_verifier=${codeVerifier}`; - const response = http.post(url, "", { + const response = http.post(url, '', { tags: { - b2c_login: "GetToken", + b2c_login: 'GetToken', }, }); @@ -162,9 +162,9 @@ const CombinedSigninAndSignup = (state) => { `&tx=StateProperties=${state.stateProperty}` + `&p=${B2CGraphSettings.B2C.user_flow_name}`; - const response = http.get(url, "", { + const response = http.get(url, '', { tags: { - b2c_login: "CombinedSigninAndSignup", + b2c_login: 'CombinedSigninAndSignup', }, }); const codeRegex = '.*code=([^"]*)'; @@ -190,13 +190,13 @@ const SelfAsserted = (state, username, password) => { const params = { headers: { - "X-CSRF-TOKEN": `${state.csrfToken}`, + 'X-CSRF-TOKEN': `${state.csrfToken}`, }, tags: { - b2c_login: "SelfAsserted", + b2c_login: 'SelfAsserted', }, }; - http.post(url, "", params); + http.post(url, '', params); }; /** @@ -206,7 +206,7 @@ const SelfAsserted = (state, username, password) => { */ const GetState = () => { const nonce = randomString(50); - const challenge = crypto.sha256(nonce.toString(), "base64rawurl"); + const challenge = crypto.sha256(nonce.toString(), 'base64rawurl'); const url = `https://${B2CGraphSettings.B2C.tenant_name}.b2clogin.com` + @@ -222,9 +222,9 @@ const GetState = () => { `&code_challenge=${challenge}` + `&response_mode=fragment`; - const response = http.get(url, "", { + const response = http.get(url, '', { tags: { - b2c_login: "GetCookyAndState", + b2c_login: 'GetCookyAndState', }, }); @@ -233,7 +233,7 @@ const GetState = () => { const b2cState = {}; b2cState.codeVerifier = nonce; - b2cState.csrfToken = responseCookies["x-ms-cpim-csrf"][0]; + b2cState.csrfToken = responseCookies['x-ms-cpim-csrf'][0]; b2cState.stateProperty = response.body.match('.*StateProperties=([^"]*)')[1]; return b2cState; }; @@ -248,14 +248,14 @@ export const GetAuthorizationHeaderForUser = (user) => { return { headers: { - "Content-Type": "application/json", - Authorization: "Bearer " + token, + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + token, }, }; }; export default function () { - const token = GetB2cIdToken("USERNAME", "PASSWORD"); + const token = GetB2cIdToken('USERNAME', 'PASSWORD'); console.log(token); } ``` @@ -280,7 +280,14 @@ import encoding from 'k6/encoding'; * @param {string} scope - Space-separated list of scopes * @param {string|object} resource - Either a resource ID (as string) or an object containing username and password */ -export function authenticateUsingOkta(oktaDomain, authServerId, clientId, clientSecret, scope, resource) { +export function authenticateUsingOkta( + oktaDomain, + authServerId, + clientId, + clientSecret, + scope, + resource +) { if (authServerId === 'undefined' || authServerId == '') { authServerId = 'default'; } diff --git a/docs/sources/v0.47.x/examples/parse-html.md b/docs/sources/v0.47.x/examples/parse-html.md index dc8d5039b3..ca19fac3c5 100644 --- a/docs/sources/v0.47.x/examples/parse-html.md +++ b/docs/sources/v0.47.x/examples/parse-html.md @@ -8,8 +8,8 @@ weight: 06 Examples parsing HTML content. Use the `k6/html` module for HTML parsing. -| Name | Type | Description | -| ---------------------------------------------------------------------------- | -------- | ----------------------------------------------------- | +| Name | Type | Description | +| ------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------- | | [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | Class | A jQuery-like API for accessing HTML DOM elements. | | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | Class | An HTML DOM element as returned by the Selection API. | | [parseHTML(src)](https://grafana.com/docs/k6//javascript-api/k6-html/parsehtml) | function | Parse an HTML string and populate a Selection object. | diff --git a/docs/sources/v0.47.x/examples/soap.md b/docs/sources/v0.47.x/examples/soap.md index 20c29e2187..598b33c1e2 100644 --- a/docs/sources/v0.47.x/examples/soap.md +++ b/docs/sources/v0.47.x/examples/soap.md @@ -28,9 +28,13 @@ const soapReqBody = ` export default function () { // When making a SOAP POST request we must not forget to set the content type to text/xml - const res = http.post('http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx', soapReqBody, { - headers: { 'Content-Type': 'text/xml' }, - }); + const res = http.post( + 'http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx', + soapReqBody, + { + headers: { 'Content-Type': 'text/xml' }, + } + ); // Make sure the response is correct check(res, { diff --git a/docs/sources/v0.47.x/examples/tracking-data-per.md b/docs/sources/v0.47.x/examples/tracking-data-per.md index 51fdc1c05e..0e459d0c8a 100644 --- a/docs/sources/v0.47.x/examples/tracking-data-per.md +++ b/docs/sources/v0.47.x/examples/tracking-data-per.md @@ -33,7 +33,7 @@ export const options = { vus: 10, thresholds: { // We can setup thresholds on these custom metrics, "count" means bytes in this case. - endpoint_data_sent: ['count < 2048'], + 'endpoint_data_sent': ['count < 2048'], // The above threshold would look at all data points added to the custom metric. // If we want to only consider data points for a particular URL/endpoint we can filter by URL. diff --git a/docs/sources/v0.47.x/extensions/_index.md b/docs/sources/v0.47.x/extensions/_index.md index 4c5ed572b9..794d727e31 100644 --- a/docs/sources/v0.47.x/extensions/_index.md +++ b/docs/sources/v0.47.x/extensions/_index.md @@ -35,12 +35,12 @@ Currently, k6 supports two ways to extend its native functionality: - **Output extensions** send metrics to a custom file format or service. Add custom processing and dispatching. - ## xk6 makes custom binaries [xk6](https://github.com/grafana/xk6/) is command-line tool and framework written in Go. With xk6, you build custom k6 binaries that bundle one or more extensions written in Go. You have two options for creating k6 binaries: using [Go and xk6](https://grafana.com/docs/k6/latest/extensions/build-k6-binary-using-go/) or [Docker](https://grafana.com/docs/k6/latest/extensions/build-k6-binary-using-docker/): {{< code >}} + ```go-and-xk6 xk6 build \ --with github.com/grafana/xk6-sql@v0.0.1 \ @@ -52,6 +52,7 @@ docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \ --with github.com/grafana/xk6-sql@v0.0.1 \ --with github.com/grafana/xk6-output-prometheus-remote ``` + {{< /code >}}
@@ -61,7 +62,7 @@ docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \ The extensions ecosystem provides endless possibilities to expand the functionality for your k6 testing. Some reasons you might want to extend k6 include the following: - **To add support for a new network protocol** - + For example, [xk6-amqp](https://github.com/grafana/xk6-amqp) gives access to resources using the Advanced Message Queueing Protocol (AMQP). With xk6-amqp, your scripts can create message queues and seed messages for tests that include systems like RabbitMQ or ActiveMQ (among others). - **To incorporate a client library for test dependency** @@ -76,5 +77,4 @@ The extensions ecosystem provides endless possibilities to expand the functional Perhaps your company uses OpenTelemetry to trace service requests through layers of microservices. Using [xk6-distributed-tracing](https://github.com/grafana/xk6-distributed-tracing), you can update the http client to link your test requests as the origin for your traces—no need to add JavaScript code to supply the required trace headers. - Next, [Explore the available extensions](https://grafana.com/docs/k6//extensions/explore) to see how you can expand your use of k6 right now. diff --git a/docs/sources/v0.47.x/extensions/build-k6-binary-using-docker.md b/docs/sources/v0.47.x/extensions/build-k6-binary-using-docker.md index a31d000134..f57365033f 100644 --- a/docs/sources/v0.47.x/extensions/build-k6-binary-using-docker.md +++ b/docs/sources/v0.47.x/extensions/build-k6-binary-using-docker.md @@ -13,6 +13,7 @@ Using the [xk6 Docker image](https://hub.docker.com/r/grafana/xk6/) can simplify For example, to build a custom k6 binary with the latest versions of k6 and the [`xk6-kafka`](https://github.com/mostafa/xk6-kafka) and [`xk6-output-influxdb`](https://github.com/grafana/xk6-output-influxdb) extensions, run one of the commands below, depending on your operating system: {{< code >}} + ```linux docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \ --with github.com/mostafa/xk6-kafka \ @@ -39,6 +40,7 @@ docker run --rm -e GOOS=windows -v "%cd%:/xk6" ^ --with github.com/mostafa/xk6-kafka ^ --with github.com/grafana/xk6-output-influxdb ``` + {{< /code >}} This creates a `k6` (or `k6.exe`) binary in the current working directory. @@ -46,6 +48,7 @@ This creates a `k6` (or `k6.exe`) binary in the current working directory. To build the binary with concrete versions, see the example below (k6 `v0.45.1`, xk6-kafka `v0.19.1`, and xk6-output-influxdb `v0.4.1`): {{< code >}} + ```linux docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build v0.45.1 \ --with github.com/mostafa/xk6-kafka@v0.19.1 \ @@ -72,6 +75,7 @@ docker run --rm -e GOOS=windows -v "%cd%:/xk6" ^ --with github.com/mostafa/xk6-kafka@v0.19.1 ^ --with github.com/grafana/xk6-output-influxdb@v0.4.1 ``` + {{< /code >}} ## Breaking down the command @@ -116,7 +120,7 @@ Flags: The use of `--replace` should be considered an advanced feature to be avoided unless required. - {{% /admonition %}} +{{% /admonition %}} Referring back to our executed command, note that: diff --git a/docs/sources/v0.47.x/extensions/build-k6-binary-using-go.md b/docs/sources/v0.47.x/extensions/build-k6-binary-using-go.md index 0018f88780..a983bba173 100644 --- a/docs/sources/v0.47.x/extensions/build-k6-binary-using-go.md +++ b/docs/sources/v0.47.x/extensions/build-k6-binary-using-go.md @@ -13,7 +13,7 @@ you need to build a binary using Go. Not interested in setting up a Go environment? You can [use Docker instead](https://grafana.com/docs/k6/latest/extensions/build-k6-binary-using-docker/). - {{% /admonition %}} +{{% /admonition %}} ## Before you start diff --git a/docs/sources/v0.47.x/extensions/create/_index.md b/docs/sources/v0.47.x/extensions/create/_index.md index d4dcc20601..20c2fd52f6 100644 --- a/docs/sources/v0.47.x/extensions/create/_index.md +++ b/docs/sources/v0.47.x/extensions/create/_index.md @@ -29,7 +29,7 @@ there's some background knowledge you should have: If you maintain a public xk6 repository and wish to have your extension listed in our [registry](https://grafana.com/docs/k6//extensions/explore), be sure to review the [requirements](https://grafana.com/docs/k6//extensions/explanations/extensions-registry#registry-requirements). - {{% /admonition %}} +{{% /admonition %}} ## Avoid unneeded work diff --git a/docs/sources/v0.47.x/extensions/create/javascript-extensions.md b/docs/sources/v0.47.x/extensions/create/javascript-extensions.md index a23493d8c8..3f59d35e3b 100644 --- a/docs/sources/v0.47.x/extensions/create/javascript-extensions.md +++ b/docs/sources/v0.47.x/extensions/create/javascript-extensions.md @@ -66,12 +66,12 @@ func (c *Compare) IsGreater(a, b int) bool { 1. Register the module to use these from k6 test scripts. - {{% admonition type="note" %}} +{{% admonition type="note" %}} k6 extensions must have the `k6/x/` prefix, and the short name must be unique among all extensions built in the same k6 binary. - {{% /admonition %}} +{{% /admonition %}} ```go import "go.k6.io/k6/js/modules" @@ -116,7 +116,7 @@ func (c *Compare) IsGreater(a, b int) bool { } ``` - {{< /code >}} +{{< /code >}} ## Compile your extended k6 @@ -131,7 +131,7 @@ $ xk6 build --with xk6-compare=. When building from source code, `xk6-compare` is the Go module name passed to `go mod init`. Usually, this would be a URL similar to `github.com/grafana/xk6-compare`. - {{% /admonition %}} +{{% /admonition %}} ## Use your extension @@ -150,7 +150,7 @@ export default function () { } ``` - {{< /code >}} +{{< /code >}} 1. Run the test with `./k6 run test.js`. @@ -180,7 +180,7 @@ interface to serve as a factory of `Compare` instances for each VU. The significance depends on the size of your module. - {{% /admonition %}} +{{% /admonition %}} Here's what that would look like: @@ -263,7 +263,7 @@ func (mi *ModuleInstance) Exports() modules.Exports { Notice that we implemented the Module API and now `modules.Register` the _root module_ rather than our _Compare_ object! - {{% /admonition %}} +{{% /admonition %}} ## Accessing runtime state diff --git a/docs/sources/v0.47.x/extensions/create/output-extensions.md b/docs/sources/v0.47.x/extensions/create/output-extensions.md index 67a582f476..dbe3582ec6 100644 --- a/docs/sources/v0.47.x/extensions/create/output-extensions.md +++ b/docs/sources/v0.47.x/extensions/create/output-extensions.md @@ -207,7 +207,7 @@ export default function () { } ``` - {{< /code >}} +{{< /code >}} 1. Now, run the test. diff --git a/docs/sources/v0.47.x/extensions/explanations/extension-graduation.md b/docs/sources/v0.47.x/extensions/explanations/extension-graduation.md index 49a0c4d344..d84b9a4b54 100644 --- a/docs/sources/v0.47.x/extensions/explanations/extension-graduation.md +++ b/docs/sources/v0.47.x/extensions/explanations/extension-graduation.md @@ -25,7 +25,7 @@ These extensions might be provided by Grafana or by the community, and _may_ be Only Grafana-controlled extensions may progress beyond the _extension_ phase to become _experimental_ or _core modules_. - {{% /admonition %}} +{{% /admonition %}} ### Experimental Module @@ -44,7 +44,7 @@ The key will be to achieve a balance between usability and stability. Not all experimental modules will progress to become a core module! The k6 team reserves the right to discontinue and remove any experimental module if is no longer deemed desirable. - {{% /admonition %}} +{{% /admonition %}} ### Core Module diff --git a/docs/sources/v0.47.x/extensions/explanations/extensions-registry.md b/docs/sources/v0.47.x/extensions/explanations/extensions-registry.md index 538b0da507..2158eca059 100644 --- a/docs/sources/v0.47.x/extensions/explanations/extensions-registry.md +++ b/docs/sources/v0.47.x/extensions/explanations/extensions-registry.md @@ -74,7 +74,7 @@ Applying our conventions, we'd recommend naming this repository as `xk6-output-a Our goal is to quickly understand the intent of the extension. - {{% /admonition %}} +{{% /admonition %}} ## Extension Tiers diff --git a/docs/sources/v0.47.x/get-started/results-output.md b/docs/sources/v0.47.x/get-started/results-output.md index c2b3da1aeb..803f7f4877 100644 --- a/docs/sources/v0.47.x/get-started/results-output.md +++ b/docs/sources/v0.47.x/get-started/results-output.md @@ -99,7 +99,7 @@ The available built-in outputs include: - [Netdata](https://grafana.com/docs/k6//results-output/real-time/netdata) - [New Relic](https://grafana.com/docs/k6//results-output/real-time/newrelic) - [Prometheus](https://grafana.com/docs/k6//results-output/real-time/prometheus-remote-write) -- [TimescaleDB](https://grafana.com/docs/k6//results-output/real-time/timescaledb) +- [TimescaleDB](https://grafana.com/docs/k6//results-output/real-time/timescaledb) - [StatsD](https://grafana.com/docs/k6//results-output/real-time/statsd) diff --git a/docs/sources/v0.47.x/javascript-api/_index.md b/docs/sources/v0.47.x/javascript-api/_index.md index 3b46585cf6..31500f7978 100644 --- a/docs/sources/v0.47.x/javascript-api/_index.md +++ b/docs/sources/v0.47.x/javascript-api/_index.md @@ -13,16 +13,16 @@ Before the k6 starts the test logic, code in the _init context_ prepares the scr A few functions are available only in init context. For details about the runtime, refer to the [Test lifecycle](https://grafana.com/docs/k6//using-k6/test-lifecycle). -| Function | Description | -| ------------------------------------------------------------- | ---------------------------------------------------- | +| Function | Description | +| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | | [open( filePath, [mode] )](https://grafana.com/docs/k6//javascript-api/init-context/open) | Opens a file and reads all the contents into memory. | ## k6 The k6 module contains k6-specific functionality. -| Function | Description | -| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | +| Function | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | [check(val, sets, [tags])](https://grafana.com/docs/k6//javascript-api/k6/check) | 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. | | [fail([err])](https://grafana.com/docs/k6//javascript-api/k6/fail) | Throws an error, failing and aborting the current VU script iteration immediately. | | [group(name, fn)](https://grafana.com/docs/k6//javascript-api/k6/group) | Runs code inside a group. Used to organize results in a test. | @@ -33,8 +33,8 @@ The k6 module contains k6-specific functionality. The k6/crypto `module` provides common hashing functionality available in the GoLang [crypto](https://golang.org/pkg/crypto/) package. -| Function | Description | -| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| Function | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | [createHash(algorithm)](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhash) | Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way. | | [createHMAC(algorithm, secret)](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhmac) | Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way. | | [hmac(algorithm, secret, data, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/hmac) | Use HMAC to sign an input string. | @@ -49,16 +49,16 @@ The k6/crypto `module` provides common hashing functionality available in the Go | [sha512_224(input, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/sha512_224) | Use SHA-512/224 to hash an input string. | | [sha512_256(input, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/sha512_256) | Use SHA-512/256 to hash an input string. | -| Class | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Class | Description | +| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [Hasher](https://grafana.com/docs/k6//javascript-api/k6-crypto/hasher) | Object returned by [crypto.createHash()](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhash). It allows adding more data to be hashed and to extract digests along the way. | ## k6/data The data module provides helpers to work with data. -| Class/Method | Description | -| --------------------------------------------------------------------------- | ------------------------------------------------------------- | +| Class/Method | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------- | | [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | read-only array like structure that shares memory between VUs | ## k6/encoding @@ -66,8 +66,8 @@ The data module provides helpers to work with data. The encoding module provides [base64](https://en.wikipedia.org/wiki/Base64) encoding/decoding as defined by [RFC4648](https://tools.ietf.org/html/rfc4648). -| Function | Description | -| -------------------------------------------------------------------------------- | ----------------------- | +| Function | Description | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------- | | [b64decode(input, [encoding], [format])](http://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/) | Base64 decode a string. | | [b64encode(input, [encoding])](http://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64encode/) | Base64 encode a string. | @@ -101,7 +101,7 @@ Meta information and execution details about the current running [scenario](http | Property | Type | Description | | ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | name | string | The assigned name of the running scenario. | -| executor | string | The name of the running [Executor](https://grafana.com/docs/k6//using-k6/scenarios#executors) type. | +| executor | string | The name of the running [Executor](https://grafana.com/docs/k6//using-k6/scenarios#executors) type. | | startTime | integer | The Unix timestamp in milliseconds when the scenario started. | | progress | float | Percentage in a 0 to 1 interval of the scenario progress. | | iterationInInstance | integer | The unique and zero-based sequential number of the current iteration in the scenario, across the current instance. | @@ -111,27 +111,26 @@ Meta information and execution details about the current running [scenario](http Control the test execution. -| Property | Type | Description | -| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| abort([String]) | function | It aborts the test run with the exit code `108`, and an optional string parameter can provide an error message. Aborting the test will not prevent the `teardown()` execution. | +| Property | Type | Description | +| --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| abort([String]) | function | It aborts the test run with the exit code `108`, and an optional string parameter can provide an error message. Aborting the test will not prevent the `teardown()` execution. | | options | Object | It returns an object with all the test options as properties. The options' values are consolidated following the [order of precedence](https://grafana.com/docs/k6//using-k6/k6-options/how-to#order-of-precedence) and derived if shortcuts have been used. It returns `null` for properties where the relative option hasn't been defined. | #### vu Meta information and execution details about the current vu. -| Property | Type | Description | -| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| iterationInInstance | integer | The identifier of the iteration in the current instance for this VU. This is only unique for current VU and this instance (if multiple instances). This keeps being aggregated if a given VU is reused between multiple scenarios. | -| iterationInScenario | integer | The identifier of the iteration in the current scenario for this VU. This is only unique for current VU and scenario it is currently executing. | -| idInInstance | integer | The identifier of the VU across the instance. Not unique across multiple instances. | -| idInTest | integer | The globally unique (across the whole test run) identifier of the VU. | - +| Property | Type | Description | +| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| iterationInInstance | integer | The identifier of the iteration in the current instance for this VU. This is only unique for current VU and this instance (if multiple instances). This keeps being aggregated if a given VU is reused between multiple scenarios. | +| iterationInScenario | integer | The identifier of the iteration in the current scenario for this VU. This is only unique for current VU and scenario it is currently executing. | +| idInInstance | integer | The identifier of the VU across the instance. Not unique across multiple instances. | +| idInTest | integer | The globally unique (across the whole test run) identifier of the VU. | ## k6/experimental -| Modules | Description | -| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| Modules | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | | [browser](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) | Provides browser-level APIs to interact with browsers and collect frontend performance metrics as part of your k6 tests. | | [redis](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis) | Functionality to interact with [Redis](https://redis.io/). | | [timers](https://grafana.com/docs/k6//javascript-api/k6-experimental/timers) | `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` | @@ -144,39 +143,39 @@ Meta information and execution details about the current vu. The k6/html module contains functionality for HTML parsing. -| Function | Description | -| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| Function | Description | +| ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | [parseHTML(src)](https://grafana.com/docs/k6//javascript-api/k6-html/parsehtml) | Parse an HTML string and populate a [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) object. | -| Class | Description | -| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| Class | Description | +| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | [Element](https://grafana.com/docs/k6//javascript-api/k6-html/element) | An HTML DOM element as returned by the [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) API. | -| [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A jQuery-like API for accessing HTML DOM elements. | +| [Selection](https://grafana.com/docs/k6//javascript-api/k6-html/selection) | A jQuery-like API for accessing HTML DOM elements. | ## k6/http The k6/http module contains functionality for performing HTTP transactions. -| Function | Description | -| --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| [batch( requests )](https://grafana.com/docs/k6//javascript-api/k6-http/batch) | Issue multiple HTTP requests in parallel (like e.g. browsers tend to do). | -| [cookieJar()](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | Get active HTTP Cookie jar. | -| [del( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/del) | Issue an HTTP DELETE request. | -| [file( data, [filename], [contentType] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/file) | Create a file object that is used for building multi-part requests. | -| [get( url, [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/get) | Issue an HTTP GET request. | -| [head( url, [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/head) | Issue an HTTP HEAD request. | -| [options( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/options) | Issue an HTTP OPTIONS request. | -| [patch( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/patch) | Issue an HTTP PATCH request. | -| [post( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/post) | Issue an HTTP POST request. | -| [put( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/put) | Issue an HTTP PUT request. | -| [request( method, url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/request) | Issue any type of HTTP request. | -| [asyncRequest( method, url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/asyncrequest) | Issue any type of HTTP request asynchronously. | -| [setResponseCallback(expectedStatuses)](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback) | Sets a response callback to mark responses as expected. | +| Function | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | +| [batch( requests )](https://grafana.com/docs/k6//javascript-api/k6-http/batch) | Issue multiple HTTP requests in parallel (like e.g. browsers tend to do). | +| [cookieJar()](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | Get active HTTP Cookie jar. | +| [del( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/del) | Issue an HTTP DELETE request. | +| [file( data, [filename], [contentType] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/file) | Create a file object that is used for building multi-part requests. | +| [get( url, [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/get) | Issue an HTTP GET request. | +| [head( url, [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/head) | Issue an HTTP HEAD request. | +| [options( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/options) | Issue an HTTP OPTIONS request. | +| [patch( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/patch) | Issue an HTTP PATCH request. | +| [post( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/post) | Issue an HTTP POST request. | +| [put( url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/put) | Issue an HTTP PUT request. | +| [request( method, url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/request) | Issue any type of HTTP request. | +| [asyncRequest( method, url, [body], [params] )](https://grafana.com/docs/k6/latest/javascript-api/k6-http/asyncrequest) | Issue any type of HTTP request asynchronously. | +| [setResponseCallback(expectedStatuses)](https://grafana.com/docs/k6//javascript-api/k6-http/set-response-callback) | Sets a response callback to mark responses as expected. | | [url\`url\`](https://grafana.com/docs/k6//javascript-api/k6-http/url) | Creates a URL with a name tag. Read more on [URL Grouping](https://grafana.com/docs/k6//using-k6/http-requests#url-grouping). | -| [expectedStatuses( statusCodes )](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) | Create a callback for setResponseCallback that checks status codes. | +| [expectedStatuses( statusCodes )](https://grafana.com/docs/k6//javascript-api/k6-http/expected-statuses) | Create a callback for setResponseCallback that checks status codes. | -| Class | Description | -| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| Class | Description | +| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | [CookieJar](https://grafana.com/docs/k6//javascript-api/k6-http/cookiejar) | Used for storing cookies, set by the server and/or added by the client. | | [FileData](https://grafana.com/docs/k6//javascript-api/k6-http/filedata) | Used for wrapping data representing a file when doing multipart requests (file uploads). | | [Params](https://grafana.com/docs/k6//javascript-api/k6-http/params) | Used for setting various HTTP request-specific parameters such as headers, cookies, etc. | @@ -189,8 +188,8 @@ All metrics (both the [built-in metrics](https://grafana.com/docs/k6//using-k6/tags-and-groups) all values added to a custom metric, which can be useful when analysing the test results. -| Metric type | Description | -| ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| Metric type | Description | +| ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | [Counter](https://grafana.com/docs/k6//javascript-api/k6-metrics/counter) | A metric that cumulatively sums added values. | | [Gauge](https://grafana.com/docs/k6//javascript-api/k6-metrics/gauge) | A metric that stores the min, max and last values added to it. | | [Rate](https://grafana.com/docs/k6//javascript-api/k6-metrics/rate) | A metric that tracks the percentage of added values that are non-zero. | @@ -202,27 +201,27 @@ You can optionally [tag](https://grafana.com/docs/k6//using-k6/tags- The `k6/net/grpc` module provides a [gRPC](https://grpc.io/) client for Remote Procedure Calls (RPC) over HTTP/2. -| Class/Method | Description | -| ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | -| [Client](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client) | gRPC client used for making RPC calls to a gRPC Server. | -| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | -| [Client.connect(address [,params])](https://grafana.com/docs/k6/latest/javascript-api/k6-net-grpc/client/client-connect) | Connects to a given gRPC service. | -| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6/latest/javascript-api/k6-net-grpc/client/client-invoke) | Makes an unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response). | -| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-close) | Close the connection to the gRPC service. | -| [Params](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/params) | RPC Request specific options. | -| [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response) | Returned by RPC requests. | +| Class/Method | Description | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Client](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client) | gRPC client used for making RPC calls to a gRPC Server. | +| [Client.load(importPaths, ...protoFiles)](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-load) | Loads and parses the given protocol buffer definitions to be made available for RPC requests. | +| [Client.connect(address [,params])](https://grafana.com/docs/k6/latest/javascript-api/k6-net-grpc/client/client-connect) | Connects to a given gRPC service. | +| [Client.invoke(url, request [,params])](https://grafana.com/docs/k6/latest/javascript-api/k6-net-grpc/client/client-invoke) | Makes an unary RPC for the given service/method and returns a [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response). | +| [Client.close()](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/client/client-close) | Close the connection to the gRPC service. | +| [Params](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/params) | RPC Request specific options. | +| [Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response) | Returned by RPC requests. | | [Constants](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/constants) | Define constants to distinguish between [gRPC Response](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/response) statuses. | ## k6/ws The ws module provides a [WebSocket](https://en.wikipedia.org/wiki/WebSocket) client implementing the [WebSocket protocol](http://www.rfc-editor.org/rfc/rfc6455.txt). -| Function | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Function | Description | +| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [connect( url, params, callback )](https://grafana.com/docs/k6//javascript-api/k6-ws/connect) | Create a WebSocket connection, and provides a [Socket](https://grafana.com/docs/k6//javascript-api/k6-ws/socket) client to interact with the service. The method blocks the test finalization until the connection is closed. | -| Class/Method | Description | -| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Class/Method | Description | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [Params](https://grafana.com/docs/k6//javascript-api/k6-ws/params) | Used for setting various WebSocket connection parameters such as headers, cookie jar, compression, etc. | | [Socket](https://grafana.com/docs/k6//javascript-api/k6-ws/socket) | WebSocket client used to interact with a WS connection. | | [Socket.close()](https://grafana.com/docs/k6//javascript-api/k6-ws/socket/socket-close) | Close the WebSocket connection. | diff --git a/docs/sources/v0.47.x/javascript-api/init-context/_index.md b/docs/sources/v0.47.x/javascript-api/init-context/_index.md index 34a753881d..3b205073b7 100644 --- a/docs/sources/v0.47.x/javascript-api/init-context/_index.md +++ b/docs/sources/v0.47.x/javascript-api/init-context/_index.md @@ -1,5 +1,5 @@ --- -title: "Init context" +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.' weight: 01 --- @@ -10,6 +10,6 @@ Before the k6 starts the test logic, code in the _init context_ prepares the scr A few functions are available only in init context. For details about the runtime, refer to the [Test lifecycle](https://grafana.com/docs/k6//using-k6/test-lifecycle). -| Function | Description | -| ------------------------------------------------------------- | ---------------------------------------------------- | +| Function | Description | +| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | | [open( filePath, [mode] )](https://grafana.com/docs/k6//javascript-api/init-context/open) | Opens a file and reads all the contents into memory. | diff --git a/docs/sources/v0.47.x/javascript-api/jslib/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/_index.md index 7fdedbe390..d15fbc3d6b 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/_index.md @@ -1,6 +1,6 @@ --- -title: "jslib" -excerpt: "External JavaScript libraries for k6" +title: 'jslib' +excerpt: 'External JavaScript libraries for k6' weight: 15 --- @@ -8,8 +8,8 @@ weight: 15 The [jslib.k6.io](https://jslib.k6.io/) is a collection of external JavaScript libraries that can be [directly imported](https://grafana.com/docs/k6//using-k6/modules#remote-http-s-modules) in k6 scripts. -| Library | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| Library | Description | +| ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | [aws](https://grafana.com/docs/k6//javascript-api/jslib/aws) | Library allowing to interact with Amazon AWS services | | [httpx](https://grafana.com/docs/k6//javascript-api/jslib/httpx) | Wrapper around [k6/http](https://k6.io/docs/javascript-api/#k6-http) to simplify session handling | | [k6chaijs](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs) | BDD assertion style | diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/_index.md index 9bddff291a..4baf7b9f8f 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/_index.md @@ -16,8 +16,8 @@ Both the dedicated `event-bridge.js` jslib bundle and the all-encompassing `aws. ### Methods -| Function | Description | -| :------------------------------------------------------------------------------------------------------------------- | :---------------------------------------- | +| Function | Description | +| :---------------------------------------------------------------------------------------------------------------- | :---------------------------------------- | | [putEvents(input)](https://grafana.com/docs/k6//javascript-api/jslib/aws/eventbridgeclient/putevents) | Send custom events to Amazon EventBridge. | ### Throws diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/_index.md index af4643d9a2..b837917125 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/_index.md @@ -15,8 +15,8 @@ Both the dedicated `ssm.js` jslib bundle and the all-encompassing `aws.js` bundl ### Methods -| Function | Description | -| :------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------- | +| Function | Description | +| :--------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------- | | [getParameter](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerclient-getparameter) | Retrieves a parameter from Amazon Systems Manager. | ### Throws @@ -63,7 +63,10 @@ export default async function () { // Let's get the secret value with decryption // destructure the parameter object to get to the values you want - const { value: encryptedParameterValue } = await systemsManager.getParameter(testParameterSecretName, true); + const { value: encryptedParameterValue } = await systemsManager.getParameter( + testParameterSecretName, + true + ); if (encryptedParameterValue !== testParameterSecretValue) { exec.test.abort('encrypted test parameter not found'); } diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/_index.md index 155ce8329e..08de073c20 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/_index.md @@ -27,27 +27,27 @@ This library is stable enough to be useful, but pay attention to the new version This documentation is for the only last version only. If you discover that some of the following doesn't work, you might be using an older version. - {{% /admonition %}} +{{% /admonition %}} ### Methods -| Function | Description | -| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | -| [asyncRequest(method, url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/asyncrequest) | Generic method for making arbitrary, asynchronous HTTP requests. | -| [request(method, url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/request) | Generic method for making arbitrary HTTP requests. | -| [get(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/get) | Makes GET request | -| [post(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/post) | Makes POST request | -| [put(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/put) | Makes PUT request | -| [patch(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/patch) | Makes PATCH request | -| [delete(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/delete) | Makes DELETE request | -| [batch(requests)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/batch) | Batches multiple HTTP requests together to issue them in parallel. | -| [setBaseUrl(url)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/setbaseurl) | Sets the base URL for the session | -| [addHeader(key, value)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addheader) | Adds a header to the session | -| [addHeaders(object)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addheaders) | Adds multiple headers to the session | -| [clearHeader(name)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/clearheader) | Removes header from the session | -| [addTag(key, value)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addtag) | Adds a tag to the session | -| [addTags(object)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addtags) | Adds multiple tags to the session | -| [clearTag(name)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/cleartag) | Removes tag from the session | +| Function | Description | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | +| [asyncRequest(method, url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/asyncrequest) | Generic method for making arbitrary, asynchronous HTTP requests. | +| [request(method, url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/request) | Generic method for making arbitrary HTTP requests. | +| [get(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/get) | Makes GET request | +| [post(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/post) | Makes POST request | +| [put(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/put) | Makes PUT request | +| [patch(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/patch) | Makes PATCH request | +| [delete(url, [body], [params])](https://grafana.com/docs/k6//javascript-api/jslib/httpx/delete) | Makes DELETE request | +| [batch(requests)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/batch) | Batches multiple HTTP requests together to issue them in parallel. | +| [setBaseUrl(url)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/setbaseurl) | Sets the base URL for the session | +| [addHeader(key, value)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addheader) | Adds a header to the session | +| [addHeaders(object)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addheaders) | Adds multiple headers to the session | +| [clearHeader(name)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/clearheader) | Removes header from the session | +| [addTag(key, value)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addtag) | Adds a tag to the session | +| [addTags(object)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/addtags) | Adds multiple tags to the session | +| [clearTag(name)](https://grafana.com/docs/k6//javascript-api/jslib/httpx/cleartag) | Removes tag from the session | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/addheaders.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/addheaders.md index 3cd332bf6b..2c2cde85d8 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/addheaders.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/addheaders.md @@ -21,7 +21,7 @@ import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js'; const session = new Httpx(); session.addHeaders({ - Authorization: 'token1', + 'Authorization': 'token1', 'User-Agent': 'My custom user agent', 'Content-Type': 'application/x-www-form-urlencoded', }); diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/asyncrequest.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/asyncrequest.md index b17f882af8..02aca8486d 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/asyncrequest.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/asyncrequest.md @@ -11,17 +11,17 @@ weight: 08 Generic method for making arbitrary asynchronous HTTP requests. Note, this method returns a Promise. You must use the `await` keyword to resolve it. -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| method | string | HTTP method. Must be uppercase (GET, POST, PUT, PATCH, OPTIONS, HEAD, etc) | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| method | string | HTTP method. Must be uppercase (GET, POST, PUT, PATCH, OPTIONS, HEAD, etc) | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| --------------------- | ------------------------------------------------------------------------------------------------- | | Promise with Response | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/batch.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/batch.md index cfb8915c00..7dd42f72d7 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/batch.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/batch.md @@ -17,8 +17,8 @@ Batch multiple HTTP requests together, to issue them in parallel over multiple T ### Returns -| Type | Description | -| ----- | ------------------------------------------------------------------------------------------------- | +| Type | Description | +| ----- | ----------------------------------------------------------------------------------------------------------------- | | array | An array containing [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) objects. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/delete.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/delete.md index 6520d674bd..96f8479d61 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/delete.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/delete.md @@ -9,16 +9,16 @@ weight: 14 `session.delete(url, body, params)` makes a DELETE request. Only the first parameter is required. Body is discouraged. -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/get.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/get.md index 7f1c638111..7bd5fa76a2 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/get.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/get.md @@ -9,16 +9,16 @@ weight: 10 `session.get(url, body, params)` makes a GET request. Only the URL parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/head.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/head.md index 0fab749aee..2997a97578 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/head.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/head.md @@ -9,16 +9,16 @@ weight: 16 `session.head(url, body, params)` makes a HEAD request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/options.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/options.md index 9bc8058c08..8a0555e0a2 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/options.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/options.md @@ -9,16 +9,16 @@ weight: 15 `session.options(url, body, params)` makes an OPTIONS request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit the body, set to `null`. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit the body, set to `null`. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/patch.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/patch.md index 216b08a32d..6cabfc4a89 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/patch.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/patch.md @@ -10,16 +10,16 @@ weight: 13 `session.patch(url, body, params)` makes a PATCH request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null` . | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null` . | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/post.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/post.md index 8010f9ebab..e7e838fccb 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/post.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/post.md @@ -8,16 +8,16 @@ weight: 11 # post(url, [body], [params]) -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null` . | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null` . | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/put.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/put.md index 6d719cf844..bda59a976e 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/put.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/put.md @@ -10,16 +10,16 @@ weight: 12 `session.put(url, body, params)` makes a PUT request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null`. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null`. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/request.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/request.md index 0b8deafb2d..dfdf30730a 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/request.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/request.md @@ -12,17 +12,17 @@ Generic method for making arbitrary HTTP requests. Consider using specific methods for making common requests [get](https://grafana.com/docs/k6//javascript-api/jslib/httpx/get), [post](https://grafana.com/docs/k6//javascript-api/jslib/httpx/post), [put](https://grafana.com/docs/k6//javascript-api/jslib/httpx/put), [patch](https://grafana.com/docs/k6//javascript-api/jslib/httpx/patch). -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| method | string | HTTP method. Must be uppercase (GET, POST, PUT, PATCH, OPTIONS, HEAD, etc) | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null`. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| method | string | HTTP method. Must be uppercase (GET, POST, PUT, PATCH, OPTIONS, HEAD, etc) | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects are `x-www-form-urlencoded`. To omit body, set to `null`. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/httpx/trace.md b/docs/sources/v0.47.x/javascript-api/jslib/httpx/trace.md index 9f5adc2711..bea377d816 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/httpx/trace.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/httpx/trace.md @@ -9,16 +9,16 @@ weight: 17 `session.trace(url, body, params)` makes a TRACE request. Only the first parameter is required -| Parameter | Type | Description | -| ----------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| url | string | HTTP URL. If baseURL is set, provide only path. | -| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | -| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | +| Parameter | Type | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| url | string | HTTP URL. If baseURL is set, provide only path. | +| body (optional) | null / string / object / ArrayBuffer / [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | Request body; objects will be `x-www-form-urlencoded`. Set to `null` to omit the body. | +| params (optional) | null or object {} | Additional [parameters](https://grafana.com/docs/k6//javascript-api/k6-http/params) for this specific request. | ### Returns -| Type | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | | [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) | HTTP [Response](https://grafana.com/docs/k6//javascript-api/k6-http/response) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/k6chaijs/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/k6chaijs/_index.md index 53c625b104..11fac09276 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/k6chaijs/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/k6chaijs/_index.md @@ -14,7 +14,7 @@ With this library, you get the following: - BDD style of assertions for more expressive language - chainable assertions - more powerful assertions functions such as: `deep`, `nested`, `ordered`, etc. -- automatic assertion messages +- automatic assertion messages - [exception handling](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/error-handling) for better test stability ## Installation @@ -67,9 +67,9 @@ If you are familiar with k6, the result is the same as using [check](https://gra ## API -| API | Description | -| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [config](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/config) | Options to change `k6chaijs` behaviour. | +| API | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [config](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/config) | Options to change `k6chaijs` behaviour. | | [describe](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/describe) | A wrapper of [group](https://grafana.com/docs/k6//javascript-api/k6/group) that catches exceptions to allow continuing the test execution. It returns a boolean to indicate the success of all its `k6chaijs` assertions. | | [expect](https://grafana.com/docs/k6//javascript-api/jslib/k6chaijs/expect) | A wrapper of [check](https://grafana.com/docs/k6//javascript-api/k6/check) that provides BDD style of assertions. | diff --git a/docs/sources/v0.47.x/javascript-api/jslib/utils/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/utils/_index.md index 58f4136d0c..bfeccbcfcb 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/utils/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/utils/_index.md @@ -1,6 +1,6 @@ --- -title: "utils" -excerpt: "A collection of small utility functions useful during load testing with k6. " +title: 'utils' +excerpt: 'A collection of small utility functions useful during load testing with k6. ' weight: 04 --- @@ -11,17 +11,17 @@ The `utils` module contains number of small utility functions useful in every da > ⭐️ Source code available on [GitHub](https://github.com/k6io/k6-jslib-utils). > Please request features and report bugs through [GitHub issues](https://github.com/k6io/k6-jslib-utils/issues). -| Function | Description | -| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [randomIntBetween(min, max)](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomintbetween) | Random integer in a given range | -| [randomItem(array)](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomitem) | Random item from a given array | -| [randomString(length, [charset])](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomstring) | Random string of a given length, optionally selected from a custom character set | -| [uuidv4()](https://grafana.com/docs/k6//javascript-api/jslib/utils/uuidv4) | Random UUID v4 in a string representation | -| [findBetween(content, left, right, [repeat])](https://grafana.com/docs/k6//javascript-api/jslib/utils/findbetween) | Extract a string between two surrounding strings | -| [normalDistributionStages(maxVUs, durationSeconds, [numberOfStages])](https://grafana.com/docs/k6//javascript-api/jslib/utils/normaldistributionstages) | Creates [stages](https://grafana.com/docs/k6//using-k6/k6-options#stages) which will produce a normal distribution (bell-curve) of VUs for a test | -| getCurrentStageIndex | Get the index of the running stage as defined in the `stages` array options. It can be used only with the executors that support the `stages` option as [ramping-vus](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-vus) or [ramping-arrival-rate](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-arrival-rate). | -| tagWithCurrentStageIndex | Tag all the generated metrics in the iteration with the index of the current running stage. | -| tagWithCurrentStageProfile | Tag all the generated metrics in the iteration with the computed profile for the current running stage. | +| Function | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [randomIntBetween(min, max)](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomintbetween) | Random integer in a given range | +| [randomItem(array)](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomitem) | Random item from a given array | +| [randomString(length, [charset])](https://grafana.com/docs/k6//javascript-api/jslib/utils/randomstring) | Random string of a given length, optionally selected from a custom character set | +| [uuidv4()](https://grafana.com/docs/k6//javascript-api/jslib/utils/uuidv4) | Random UUID v4 in a string representation | +| [findBetween(content, left, right, [repeat])](https://grafana.com/docs/k6//javascript-api/jslib/utils/findbetween) | Extract a string between two surrounding strings | +| [normalDistributionStages(maxVUs, durationSeconds, [numberOfStages])](https://grafana.com/docs/k6//javascript-api/jslib/utils/normaldistributionstages) | Creates [stages](https://grafana.com/docs/k6//using-k6/k6-options#stages) which will produce a normal distribution (bell-curve) of VUs for a test | +| getCurrentStageIndex | Get the index of the running stage as defined in the `stages` array options. It can be used only with the executors that support the `stages` option as [ramping-vus](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-vus) or [ramping-arrival-rate](https://grafana.com/docs/k6//using-k6/scenarios/executors/ramping-arrival-rate). | +| tagWithCurrentStageIndex | Tag all the generated metrics in the iteration with the index of the current running stage. | +| tagWithCurrentStageProfile | Tag all the generated metrics in the iteration with the computed profile for the current running stage. | ## Simple example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/utils/findbetween.md b/docs/sources/v0.47.x/javascript-api/jslib/utils/findbetween.md index 60ef68b80a..d19d37b92f 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/utils/findbetween.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/utils/findbetween.md @@ -8,12 +8,12 @@ weight: 45 Function that returns a string from between two other strings. -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------- | +| Parameter | Type | Description | +| ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | content | string | The string to search through (e.g. [Response.body](https://grafana.com/docs/k6//javascript-api/k6-http/response)) | -| left | string | The string immediately before the value to be extracted | -| right | string | The string immediately after the value to be extracted | -| repeat (optional) | boolean | If `true`, the result will be a string array containing all occurrences | +| left | string | The string immediately before the value to be extracted | +| right | string | The string immediately after the value to be extracted | +| repeat (optional) | boolean | If `true`, the result will be a string array containing all occurrences | ### Returns diff --git a/docs/sources/v0.47.x/javascript-api/k6-crypto/_index.md b/docs/sources/v0.47.x/javascript-api/k6-crypto/_index.md index a74bf922df..7e2ae07094 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-crypto/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-crypto/_index.md @@ -1,6 +1,6 @@ --- -title: "k6/crypto" -excerpt: "The k6/crypto module provides common hashing functionality available in the GoLang crypto." +title: 'k6/crypto' +excerpt: 'The k6/crypto module provides common hashing functionality available in the GoLang crypto.' weight: 03 --- @@ -10,8 +10,8 @@ weight: 03 The k6/crypto `module` provides common hashing functionality available in the GoLang [crypto](https://golang.org/pkg/crypto/) package. -| Function | Description | -| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| Function | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | [createHash(algorithm)](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhash) | Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way. | | [createHMAC(algorithm, secret)](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhmac) | Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way. | | [hmac(algorithm, secret, data, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/hmac) | Use HMAC to sign an input string. | @@ -26,6 +26,6 @@ The k6/crypto `module` provides common hashing functionality available in the Go | [sha512_224(input, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/sha512_224) | Use SHA-512/224 to hash an input string. | | [sha512_256(input, outputEncoding)](https://grafana.com/docs/k6//javascript-api/k6-crypto/sha512_256) | Use SHA-512/256 to hash an input string. | -| Class | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Class | Description | +| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [Hasher](https://grafana.com/docs/k6//javascript-api/k6-crypto/hasher) | Object returned by [crypto.createHash()](https://grafana.com/docs/k6//javascript-api/k6-crypto/createhash). It allows adding more data to be hashed and to extract digests along the way. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-crypto/createhash.md b/docs/sources/v0.47.x/javascript-api/k6-crypto/createhash.md index 157adb4309..1435a7a728 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-crypto/createhash.md +++ b/docs/sources/v0.47.x/javascript-api/k6-crypto/createhash.md @@ -17,8 +17,8 @@ Creates a hashing object that can then be fed with data repeatedly, and from whi ### Returns -| Type | Description | -| ------ | ---------------------------------------------------------------------------- | +| Type | Description | +| ------ | -------------------------------------------------------------------------------------------- | | object | A [Hasher](https://grafana.com/docs/k6//javascript-api/k6-crypto/hasher) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-crypto/createhmac.md b/docs/sources/v0.47.x/javascript-api/k6-crypto/createhmac.md index 793b25722a..dcbc4ee4e2 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-crypto/createhmac.md +++ b/docs/sources/v0.47.x/javascript-api/k6-crypto/createhmac.md @@ -18,8 +18,8 @@ Creates a HMAC hashing object that can then be fed with data repeatedly, and fro ### Returns -| Type | Description | -| ------ | :--------------------------------------------------------------------------- | +| Type | Description | +| ------ | :------------------------------------------------------------------------------------------- | | object | A [Hasher](https://grafana.com/docs/k6//javascript-api/k6-crypto/hasher) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-data/_index.md b/docs/sources/v0.47.x/javascript-api/k6-data/_index.md index 3f399bb43b..e8c9c497b1 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-data/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-data/_index.md @@ -1,6 +1,6 @@ --- -title: "k6/data" -excerpt: "k6 data API" +title: 'k6/data' +excerpt: 'k6 data API' weight: 04 --- @@ -8,6 +8,6 @@ weight: 04 The data module provides helpers to work with data. -| Class/Method | Description | -| --------------------------------------------------------------------------- | ------------------------------------------------------------- | +| Class/Method | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------- | | [SharedArray](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) | read-only array like structure that shares memory between VUs | diff --git a/docs/sources/v0.47.x/javascript-api/k6-data/sharedarray.md b/docs/sources/v0.47.x/javascript-api/k6-data/sharedarray.md index aa4a4b3d45..bf5414eecf 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-data/sharedarray.md +++ b/docs/sources/v0.47.x/javascript-api/k6-data/sharedarray.md @@ -43,7 +43,7 @@ Attempting to instantiate a `SharedArray` outside of the [init context](https:// This limitation will eventually be removed, but for now, the implication is that you can use `SharedArray` to populate test data only at the very beginning of your test and not as a result of receiving data from a response (for example). - {{% /admonition %}} +{{% /admonition %}} ## Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-encoding/_index.md b/docs/sources/v0.47.x/javascript-api/k6-encoding/_index.md index 7e9deeec58..3f0b5b38e8 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-encoding/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-encoding/_index.md @@ -1,5 +1,5 @@ --- -title: "k6/encoding" +title: 'k6/encoding' excerpt: 'The encoding module provides base64 encoding/decoding as defined by RFC4648.' weight: 05 --- @@ -9,7 +9,7 @@ weight: 05 The encoding module provides [base64](https://en.wikipedia.org/wiki/Base64) encoding/decoding as defined by [RFC4648](https://tools.ietf.org/html/rfc4648). -| Function | Description | -| -------------------------------------------------------------------------------- | ----------------------- | +| Function | Description | +| ------------------------------------------------------------------------------------------------------------------------ | ----------------------- | | [b64decode(input, [encoding], [format])](https://grafana.com/docs/k6//javascript-api/k6-encoding/b64decode/) | Base64 decode a string. | | [b64encode(input, [encoding])](https://grafana.com/docs/k6//javascript-api/k6-encoding/b64encode/) | Base64 encode a string. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-execution.md b/docs/sources/v0.47.x/javascript-api/k6-execution.md index b1910c312b..c7b1cd083e 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-execution.md +++ b/docs/sources/v0.47.x/javascript-api/k6-execution.md @@ -60,7 +60,7 @@ Meta information and execution details about the current running [scenario](http | Property | Type | Description | | ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | name | string | The assigned name of the running scenario. | -| executor | string | The name of the running [Executor](https://grafana.com/docs/k6//using-k6/scenarios#executors) type. | +| executor | string | The name of the running [Executor](https://grafana.com/docs/k6//using-k6/scenarios#executors) type. | | startTime | integer | The Unix timestamp in milliseconds when the scenario started. | | progress | float | Percentage in a 0 to 1 interval of the scenario progress. | | iterationInInstance | integer | The unique and zero-based sequential number of the current iteration in the scenario, across the current instance. | @@ -70,23 +70,23 @@ Meta information and execution details about the current running [scenario](http Control the test execution. -| Property | Type | Description | -| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| abort([String]) | function | It aborts the test run with the exit code `108`, and an optional string parameter can provide an error message. Aborting the test will not prevent the `teardown()` execution. | +| Property | Type | Description | +| --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| abort([String]) | function | It aborts the test run with the exit code `108`, and an optional string parameter can provide an error message. Aborting the test will not prevent the `teardown()` execution. | | options | Object | It returns an object with all the test options as properties. The options' values are consolidated following the [order of precedence](https://grafana.com/docs/k6//using-k6/k6-options/how-to#order-of-precedence) and derived if shortcuts have been used. It returns `null` for properties where the relative option hasn't been defined. | ### vu Meta information and execution details about the current vu. -| Property | Type | Description | -| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| iterationInInstance | integer | The identifier of the iteration in the current instance for this VU. This is only unique for current VU and this instance (if multiple instances). This keeps being aggregated if a given VU is reused between multiple scenarios. | -| iterationInScenario | integer | The identifier of the iteration in the current scenario for this VU. This is only unique for current VU and scenario it is currently executing. | -| idInInstance | integer | The identifier of the VU across the instance. Not unique across multiple instances. | -| idInTest | integer | The globally unique (across the whole test run) identifier of the VU. | +| Property | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| iterationInInstance | integer | The identifier of the iteration in the current instance for this VU. This is only unique for current VU and this instance (if multiple instances). This keeps being aggregated if a given VU is reused between multiple scenarios. | +| iterationInScenario | integer | The identifier of the iteration in the current scenario for this VU. This is only unique for current VU and scenario it is currently executing. | +| idInInstance | integer | The identifier of the VU across the instance. Not unique across multiple instances. | +| idInTest | integer | The globally unique (across the whole test run) identifier of the VU. | | metrics.tags | object | The map that gives control over [VU's Tags](https://grafana.com/docs/k6//using-k6/tags-and-groups#tags). The Tags will be included in every metric emitted by the VU and the Tags' state is maintained across different iterations of the same Scenario while the VU exists. Check how to use it in the [example](#tags) below. | -| metrics.metadata | object | The map that gives control over VU's Metadata. The Metadata will be included in every metric emitted by the VU and the Metadata's state is maintained across different iterations of the same Scenario while the VU exists. Check how to use it in the [example](#metadata) below. | +| metrics.metadata | object | The map that gives control over VU's Metadata. The Metadata will be included in every metric emitted by the VU and the Metadata's state is maintained across different iterations of the same Scenario while the VU exists. Check how to use it in the [example](#metadata) below. | {{< collapse title="Setting vu.metrics.tags" >}} diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/_index.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/_index.md index 2928de50cb..88e199fe5f 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/_index.md @@ -1,6 +1,6 @@ --- -title: "k6/experimental" -excerpt: "k6 experimental APIs" +title: 'k6/experimental' +excerpt: 'k6 experimental APIs' weight: 07 --- @@ -8,8 +8,8 @@ weight: 07 {{< docs/shared source="k6" lookup="experimental-module.md" version="" >}} -| Modules | Description | -| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| Modules | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | | [browser](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) | Provides browser-level APIs to interact with browsers and collect frontend performance metrics as part of your k6 tests. | | [redis](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis) | Functionality to interact with [Redis](https://redis.io/). | | [timers](https://grafana.com/docs/k6//javascript-api/k6-experimental/timers) | `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/_index.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/_index.md index da2d3de84c..79585f2320 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/_index.md @@ -18,7 +18,7 @@ You can find examples of using [the browser module API](#browser-module-api) in To work with the browser module, make sure you are using the latest [k6 version](https://github.com/grafana/k6/releases). - {{% /admonition %}} +{{% /admonition %}} ## Properties @@ -36,13 +36,13 @@ The browser module is the entry point for all your tests, and it is what interac - [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) which is where you can set a variety of attributes to control the behavior of pages; - and [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) which is where your rendered site is displayed. -| Method | Description | -| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [browser.context()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/context) | Returns the current [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext). | -| [browser.isConnected](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/isconnected) | Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. | -| [browser.newContext([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/newcontext/) | Creates and returns a new [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext). | -| [browser.newPage([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/newpage) | Creates a new [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) in a new [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) and returns the page. Pages that have been opened ought to be closed using [`Page.close`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close). Pages left open could potentially distort the results of Web Vital metrics. | -| [browser.version()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/version) | Returns the browser application's version. | +| Method | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [browser.context()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/context) | Returns the current [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext). | +| [browser.isConnected](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/isconnected) | Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. | +| [browser.newContext([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/newcontext/) | Creates and returns a new [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext). | +| [browser.newPage([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/newpage) | Creates a new [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) in a new [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) and returns the page. Pages that have been opened ought to be closed using [`Page.close`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close). Pages left open could potentially distort the results of Web Vital metrics. | +| [browser.version()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/version) | Returns the browser application's version. | ### Example @@ -83,6 +83,7 @@ export default async function () { Then, you can run the test with this command. Also, see the [browser module options](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser#browser-module-options) for customizing the browser module's behavior using environment variables. {{< code >}} + ```bash $ k6 run script.js ``` @@ -108,24 +109,25 @@ C:\k6> k6 run script.js ```windows-powershell PS C:\k6> k6 run script.js ``` + {{< /code >}} ## Browser-level APIs -| k6 Class | Description | -| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| k6 Class | Description | +| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) | Enables independent browser sessions with separate [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page)s, cache, and cookies. | -| [ElementHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/elementhandle) | Represents an in-page DOM element. | +| [ElementHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/elementhandle) | Represents an in-page DOM element. | | [Frame](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/frame) | Access and interact with the [`Page`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page).'s `Frame`s. | -| [JSHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/jshandle) | Represents an in-page JavaScript object. | +| [JSHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/jshandle) | Represents an in-page JavaScript object. | | [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard) | Used to simulate the keyboard interactions with the associated [`Page`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page). | -| [Locator](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator) | The Locator API makes it easier to work with dynamically changing elements. | +| [Locator](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator) | The Locator API makes it easier to work with dynamically changing elements. | | [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse) | Used to simulate the mouse interactions with the associated [`Page`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page). | -| [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) | Provides methods to interact with a single tab in a browser. | +| [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) | Provides methods to interact with a single tab in a browser. | | [Request](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/request) | Used to keep track of the request the [`Page`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) makes. | | [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/response) | Represents the response received by the [`Page`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page). | | [Touchscreen](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/touchscreen) | Used to simulate touch interactions with the associated [`Page`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page). | -| [Worker](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/worker) | Represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). | +| [Worker](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/worker) | Represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). | ## Browser Module Options @@ -143,6 +145,7 @@ You can customize the behavior of the browser module by providing browser option The following command passes the [browser module options](#browser-module-options) as environment variables to launch a headful browser with custom arguments. {{< code >}} + ```bash $ K6_BROWSER_HEADLESS=false K6_BROWSER_ARGS='show-property-changed-rects' k6 run script.js ``` @@ -168,6 +171,7 @@ C:\k6> set "K6_BROWSER_HEADLESS=false" && set "K6_BROWSER_ARGS='show-property-ch ```windows-powershell PS C:\k6> $env:K6_BROWSER_HEADLESS="false" ; $env:K6_BROWSER_ARGS='show-property-changed-rects' ; k6 run script.js ``` + {{< /code >}} ## Default arguments @@ -178,7 +182,7 @@ List of default arguments included when launching the browser process. You can p The starting '--' have been omitted from the argument names in these lists. - {{% /admonition %}} +{{% /admonition %}} | Argument | Value | Description | | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/_index.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/_index.md index 19f55be7d3..776cd26bca 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/_index.md @@ -13,18 +13,18 @@ The [browser module API](https://grafana.com/docs/k6//javascript-api If a [page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's `BrowserContext`. -| Method | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | -| [BrowserContext.addCookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/addcookies) | Adds [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) into the `BrowserContext`. | -| [BrowserContext.clearCookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/clearcookies) | Clear the `BrowserContext`'s [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie). | -| [BrowserContext.clearPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/clearpermissions) | Clears all permission overrides for the `BrowserContext`. | -| [BrowserContext.cookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookies) | Returns a list of [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) from the `BrowserContext`. | -| [BrowserContext.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close) | Close the `BrowserContext` and all its [page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page)s. | -| [BrowserContext.grantPermissions(permissions[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) | Grants specified permissions to the `BrowserContext`. | -| [BrowserContext.newPage()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/newpage) | Uses the `BrowserContext` to create a new [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) and returns it. | -| [BrowserContext.pages()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/pages) | Returns a list of [page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page)s that belongs to the `BrowserContext`. | -| [BrowserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout) | Sets the default navigation timeout in milliseconds. | -| [BrowserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout) | Sets the default maximum timeout for all methods accepting a timeout option in milliseconds. | -| [BrowserContext.setGeolocation(geolocation)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setgeolocation) | Sets the `BrowserContext`'s geolocation. | -| [BrowserContext.setOffline(offline)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setoffline) | Toggles the `BrowserContext`'s connectivity on/off. | -| [BrowserContext.waitForEvent(event[, optionsOrPredicate])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/waitforevent) | Waits for the event to fire and passes its value into the predicate function. | +| Method | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [BrowserContext.addCookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/addcookies) | Adds [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) into the `BrowserContext`. | +| [BrowserContext.clearCookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/clearcookies) | Clear the `BrowserContext`'s [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie). | +| [BrowserContext.clearPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/clearpermissions) | Clears all permission overrides for the `BrowserContext`. | +| [BrowserContext.cookies()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookies) | Returns a list of [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) from the `BrowserContext`. | +| [BrowserContext.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close) | Close the `BrowserContext` and all its [page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page)s. | +| [BrowserContext.grantPermissions(permissions[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) | Grants specified permissions to the `BrowserContext`. | +| [BrowserContext.newPage()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/newpage) | Uses the `BrowserContext` to create a new [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page) and returns it. | +| [BrowserContext.pages()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/pages) | Returns a list of [page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page)s that belongs to the `BrowserContext`. | +| [BrowserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout) | Sets the default navigation timeout in milliseconds. | +| [BrowserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout) | Sets the default maximum timeout for all methods accepting a timeout option in milliseconds. | +| [BrowserContext.setGeolocation(geolocation)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setgeolocation) | Sets the `BrowserContext`'s geolocation. | +| [BrowserContext.setOffline(offline)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setoffline) | Toggles the `BrowserContext`'s connectivity on/off. | +| [BrowserContext.waitForEvent(event[, optionsOrPredicate])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/waitforevent) | Waits for the event to fire and passes its value into the predicate function. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/addcookies.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/addcookies.md index 97396bbcd5..35354e799b 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/addcookies.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/addcookies.md @@ -11,7 +11,7 @@ Adds a list of [cookies](https://grafana.com/docs/k6//javascript-api If a [cookie](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie)'s `url` property is not provided, both `domain` and `path` properties must be specified. - {{% /admonition %}} +{{% /admonition %}} ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/clearpermissions.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/clearpermissions.md index c4f0b8e192..19fb49db21 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/clearpermissions.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/clearpermissions.md @@ -10,7 +10,7 @@ excerpt: 'Clears all permission overrides for the BrowserContext.' This feature has known issues. For details, refer to [issue #443](https://github.com/grafana/xk6-browser/issues/443). - {{% /admonition %}} +{{% /admonition %}} Clears all permission overrides for the `BrowserContext`. diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/cookies.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/cookies.md index f0fe715b3f..fc8df5759d 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/cookies.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/cookies.md @@ -7,21 +7,21 @@ excerpt: 'Retrieves context cookies.' Returns a list of [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) from the [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) filtered by the provided `urls`. If no `urls` are provided, all cookies are returned. -| Parameter | Type | Description | -| --------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Parameter | Type | Description | +| --------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | urls | array | A string array of URLs to filter the [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) in the [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext). | ### Returns -| Type | Description | -| ----- | ----------------------------------------------------------------------------------- | +| Type | Description | +| ----- | --------------------------------------------------------------------------------------------------------------------------- | | array | A list of [cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie). | {{% admonition type="note" %}} [Cookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/cookie) can be added with [BrowserContext.addCookies](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/addcookies/). - {{% /admonition %}} +{{% /admonition %}} ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/newpage.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/newpage.md index dac29e2412..03474414e5 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/newpage.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/newpage.md @@ -9,8 +9,8 @@ Uses the `BrowserContext` to create a new [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/) object. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/pages.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/pages.md index 6dcbcb6014..d453ae39ef 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/pages.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/pages.md @@ -10,7 +10,7 @@ excerpt: 'Returns a list of pages inside this BrowserContext.' This feature has **known issues**. For details, refer to [#444](https://github.com/grafana/xk6-browser/issues/444). - {{% /admonition %}} +{{% /admonition %}} Returns all open [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/)s in the `BrowserContext`. diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/setgeolocation.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/setgeolocation.md index d112cab4e4..cf63302591 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/setgeolocation.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/setgeolocation.md @@ -10,7 +10,7 @@ excerpt: "Sets the BrowserContext's geolocation." This feature has **known issues**. For details, refer to [#435](https://github.com/grafana/xk6-browser/issues/435). - {{% /admonition %}} +{{% /admonition %}} Sets the context's geolocation. diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/waitforevent.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/waitforevent.md index fead13c617..4f5811f8fb 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/waitforevent.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/browsercontext/waitforevent.md @@ -13,7 +13,7 @@ Refer to #447 fo Consider using the sync methods `Page.waitForNavigation()` and `Page.waitForSelector()` instead. - {{% /admonition %}} +{{% /admonition %}} Waits for the event to fire and passes its value into the predicate function. Returns the event data value when the predicate returns `true`. @@ -30,6 +30,6 @@ Waits for the event to fire and passes its value into the predicate function. Re ### Returns -| Type | Description | -| ------ | ------------------------------------------------------------ | +| Type | Description | +| ------ | ---------------------------------------------------------------------------------------------------- | | object | [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/) object | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/context.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/context.md index 9dbaeff5ae..61c207af0a 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/context.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/context.md @@ -11,12 +11,12 @@ Returns the current [BrowserContext](https://grafana.com/docs/k6//ja A 1-to-1 mapping between [Browser](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) and `BrowserContext` means you cannot run `BrowserContexts` concurrently. If you wish to create a new `BrowserContext` while one already exists, you will need to [close](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close) the current one, and create a new one with either [newContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/newcontext/) or [newPage](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/newpage). All resources associated to the closed `BrowserContext` will also be closed and cleaned up (such as [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/)s). - {{% /admonition %}} +{{% /admonition %}} ### Returns -| Type | Description | -| -------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | object \| null | The current [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) if one has been created, otherwise `null`. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/isconnected.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/isconnected.md index 20200e7dba..9ed1f4a50d 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/isconnected.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/isconnected.md @@ -10,14 +10,14 @@ excerpt: 'Browser module: isConnected method' This feature has **known issues**. For details, refer to [#453](https://github.com/grafana/xk6-browser/issues/453). - {{% /admonition %}} +{{% /admonition %}} Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. ### Returns -| Type | Description | -| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | boolean | Returns `true` if the [browser module](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) is connected to the browser application. Otherwise, returns `false`. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/_index.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/_index.md index 121b7dd26f..52bade88bd 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/_index.md @@ -16,8 +16,8 @@ The Locator API makes it easier to work with dynamically changing elements. Some Locator can be created with the [page.locator(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator) method. -| Method | Description | -| ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| Method | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | [locator.check([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/check) | Select the input checkbox. | | [locator.click([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/click) | Mouse click on the chosen element. | | [locator.dblclick([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/dblclick) | Mouse double click on the chosen element. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/check.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/check.md index f4185abfde..406d1b0349 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/check.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/check.md @@ -10,22 +10,22 @@ excerpt: 'Browser module: locator.check method' This feature has known issues. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471) and [#475](https://github.com/grafana/xk6-browser/issues/475). - {{% /admonition %}} +{{% /admonition %}} Use this method to select an `input` checkbox. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/click.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/click.md index fd56713602..4587545a9f 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/click.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/click.md @@ -9,26 +9,26 @@ excerpt: 'Browser module: locator.click method' This method has **known issues**. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471) and [#474](https://github.com/grafana/xk6-browser/issues/474). - {{% /admonition %}} +{{% /admonition %}} Mouse click on the chosen element. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | -| options.clickCount | number | `1` | The number of times the action is performed. | -| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | +| options.clickCount | number | `1` | The number of times the action is performed. | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/dblclick.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/dblclick.md index 743e955671..42118a034b 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/dblclick.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/dblclick.md @@ -10,25 +10,25 @@ excerpt: 'Browser module: locator.dblclick method' This feature has known issues. For details, refer to [#469](https://github.com/grafana/xk6-browser/issues/469) and [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Mouse double click on the chosen element. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | -| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/fill.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/fill.md index 9ca478f1d3..c4d4e17dd1 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/fill.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/fill.md @@ -9,12 +9,12 @@ Fill an `input`, `textarea` or `contenteditable` element with the provided value -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| value | string | `''` | Value to set for the `input`, `textarea` or `contenteditable` element. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| value | string | `''` | Value to set for the `input`, `textarea` or `contenteditable` element. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/focus.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/focus.md index ba969005cf..94ead4ecad 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/focus.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/focus.md @@ -9,9 +9,9 @@ Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/getattribute.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/getattribute.md index 766f8c059a..15638ce022 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/getattribute.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/getattribute.md @@ -9,10 +9,10 @@ Returns the element attribute value for the given attribute name. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | string | `''` | Attribute name to get the value for. | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | `''` | Attribute name to get the value for. | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/hover.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/hover.md index 7f156f7e0c..32ab601a5f 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/hover.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/hover.md @@ -10,23 +10,23 @@ excerpt: 'Browser module: locator.hover method' This feature has known issues. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Hovers over the element. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/innerhtml.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/innerhtml.md index f0796e7171..c3e52e15a2 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/innerhtml.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/innerhtml.md @@ -9,9 +9,9 @@ Returns the `element.innerHTML`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/innertext.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/innertext.md index f65c3aa7e8..d9920a04ff 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/innertext.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/innertext.md @@ -9,9 +9,9 @@ Returns the `element.innerText`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/inputvalue.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/inputvalue.md index 4dba89813e..50946548a3 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/inputvalue.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/inputvalue.md @@ -9,9 +9,9 @@ Returns `input.value` for the selected `input`, `textarea` or `select` element. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/ischecked.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/ischecked.md index d4de7e32df..d4b180ff95 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/ischecked.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/ischecked.md @@ -9,9 +9,9 @@ Checks to see if the `checkbox` `input` type is selected or not. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isdisabled.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isdisabled.md index dad78280b1..863a0fe8b4 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isdisabled.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isdisabled.md @@ -9,9 +9,9 @@ Checks if the element is `disabled`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/iseditable.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/iseditable.md index 6ca7b1a99c..91c67889fe 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/iseditable.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/iseditable.md @@ -9,9 +9,9 @@ Checks if the element is `editable`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isenabled.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isenabled.md index e11d9d3c56..414ce552ed 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isenabled.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isenabled.md @@ -9,9 +9,9 @@ Checks if the element is `enabled`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/ishidden.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/ishidden.md index 7227021ab3..35d9e398f6 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/ishidden.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/ishidden.md @@ -9,9 +9,9 @@ Checks if the element is `hidden`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isvisible.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isvisible.md index 440b123e20..5fc7b5e727 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isvisible.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/isvisible.md @@ -9,9 +9,9 @@ Checks if the element is `visible`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/press.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/press.md index 421a40c4ac..5bb951d316 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/press.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/press.md @@ -9,12 +9,12 @@ Press a single key on the keyboard or a combination of keys. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). | -| options | object | `null` | | -| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). | +| options | object | `null` | | +| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/selectoption.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/selectoption.md index b958f97d42..700415ad40 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/selectoption.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/selectoption.md @@ -10,18 +10,18 @@ excerpt: 'Browser module: locator.selectOption method' This feature has **known issues**. For details, refer to [#470](https://github.com/grafana/xk6-browser/issues/470) and [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Select one or more options which match the values. -| Parameter | Type | Default | Description | -| ------------------- | ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| values | string or string[] or object | `''` | If the `select` has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. Object can be made up of keys with `value`, `label` or `index`. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| Parameter | Type | Default | Description | +| ------------------- | ---------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| values | string or string[] or object | `''` | If the `select` has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. Object can be made up of keys with `value`, `label` or `index`. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/tap.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/tap.md index 5f9cea7114..7d1e6816da 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/tap.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/tap.md @@ -10,23 +10,23 @@ excerpt: 'Browser module: locator.tap method' This feature has **known issues**. For details, refer to [#436](https://github.com/grafana/xk6-browser/issues/436) and [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Tap on the chosen element. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/textcontent.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/textcontent.md index aa711f8702..0f07b2fdc6 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/textcontent.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/textcontent.md @@ -9,9 +9,9 @@ Returns the `element.textContent`. -| Parameter | Type | Default | Description | -| --------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| --------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/type.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/type.md index e5aaa4a5f5..fded8ae7b2 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/type.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/type.md @@ -9,12 +9,12 @@ Type in the text into the input field. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| text | string | `''` | A text to type into a focused element. | -| options | object | `null` | | -| options.delay | number | `0` | Milliseconds to wait between key presses. Defaults to `0`. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| text | string | `''` | A text to type into a focused element. | +| options | object | `null` | | +| options.delay | number | `0` | Milliseconds to wait between key presses. Defaults to `0`. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/uncheck.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/uncheck.md index dcd8b20e82..cd95861268 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/uncheck.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/uncheck.md @@ -10,22 +10,22 @@ excerpt: 'Browser module: locator.uncheck method' This feature has **known issues**. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471). - {{% /admonition %}} +{{% /admonition %}} Unselect the `input` checkbox. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/waitfor.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/waitfor.md index 171f083034..15bd14d182 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/waitfor.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/locator/waitfor.md @@ -10,16 +10,16 @@ excerpt: 'Browser module: locator.waitFor method' This feature has **known issues**. For details, refer to [#472](https://github.com/grafana/xk6-browser/issues/472). - {{% /admonition %}} +{{% /admonition %}} Wait for the element to be in a particular state e.g. `visible`. -| Parameter | Type | Default | Description | -| --------------- | ------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | object | `null` | | -| options.state | string | `visible` | Can be `attached`, `detached`, `visible` or `hidden`. | +| Parameter | Type | Default | Description | +| --------------- | ------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.state | string | `visible` | Can be `attached`, `detached`, `visible` or `hidden`. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/newcontext.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/newcontext.md index 70e3515d15..27ebecc8ff 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/newcontext.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/newcontext.md @@ -11,47 +11,47 @@ Creates and returns a new [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) and `BrowserContext` means you cannot run `BrowserContexts` concurrently. Due to this restriction, if one already exists, it must be [close](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close)d first before creating a new one. - {{% /admonition %}} +{{% /admonition %}} -| Parameter | Type | Default | Description | -| ------------------------------------------- | ------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| options | object | `null` | | -| options.bypassCSP | boolean | `false` | Whether to bypass a page's Content-Security-Policy. | -| options.colorScheme | string | `'light'` | Whether to display a page in dark or light mode by emulating the 'prefers-colors-scheme' media feature. It can be one of `'light'`, `'dark'`, `'no-preference'`. | -| options.deviceScaleFactor | number | `1` | Sets the resolution ratio in physical pixels to the resolution in CSS pixels i.e. if set higher than `1`, then images will look sharper on high pixel density screens. See an [example](#devicescalefactor-example) below. | -| options.extraHTTPHeaders | object | `null` | Contains additional HTTP headers to be sent with every request, where the keys are HTTP headers and values are HTTP header values. | -| options.geolocation | object | `null` | Sets the user's geographical location. | -| options.geolocation.latitude | number | `0` | Latitude should be between `-90` and `90`. | -| options.geolocation.longitude | number | `0` | Longitude should be between `-180` and `180`. | -| options.geolocation.accuracy | number | `0` | Accuracy should only be a non-negative number. Defaults to `0`. | -| options.hasTouch | boolean | `false` | Whether to simulate a device with touch events. | -| options.httpCredentials | object | `null` | Sets the credentials for HTTP authentication using Basic Auth. | -| options.httpCredentials.username | string | `''` | Username to pass to the web browser for Basic HTTP Authentication. | -| options.httpCredentials.password | string | `''` | Password to pass to the web browser for Basic HTTP Authentication. | -| options.ignoreHTTPSErrors | boolean | `false` | Whether to ignore HTTPS errors that may be caused by invalid certificates. | -| options.isMobile | boolean | `false` | Whether to simulate a mobile device. | -| options.javaScriptEnabled | boolean | `true` | Whether to activate JavaScript support for the context. | -| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. | -| options.offline | boolean | `false` | Whether to emulate an offline network. | -| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) for the options. | +| Parameter | Type | Default | Description | +| ------------------------------------------- | ------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.bypassCSP | boolean | `false` | Whether to bypass a page's Content-Security-Policy. | +| options.colorScheme | string | `'light'` | Whether to display a page in dark or light mode by emulating the 'prefers-colors-scheme' media feature. It can be one of `'light'`, `'dark'`, `'no-preference'`. | +| options.deviceScaleFactor | number | `1` | Sets the resolution ratio in physical pixels to the resolution in CSS pixels i.e. if set higher than `1`, then images will look sharper on high pixel density screens. See an [example](#devicescalefactor-example) below. | +| options.extraHTTPHeaders | object | `null` | Contains additional HTTP headers to be sent with every request, where the keys are HTTP headers and values are HTTP header values. | +| options.geolocation | object | `null` | Sets the user's geographical location. | +| options.geolocation.latitude | number | `0` | Latitude should be between `-90` and `90`. | +| options.geolocation.longitude | number | `0` | Longitude should be between `-180` and `180`. | +| options.geolocation.accuracy | number | `0` | Accuracy should only be a non-negative number. Defaults to `0`. | +| options.hasTouch | boolean | `false` | Whether to simulate a device with touch events. | +| options.httpCredentials | object | `null` | Sets the credentials for HTTP authentication using Basic Auth. | +| options.httpCredentials.username | string | `''` | Username to pass to the web browser for Basic HTTP Authentication. | +| options.httpCredentials.password | string | `''` | Password to pass to the web browser for Basic HTTP Authentication. | +| options.ignoreHTTPSErrors | boolean | `false` | Whether to ignore HTTPS errors that may be caused by invalid certificates. | +| options.isMobile | boolean | `false` | Whether to simulate a mobile device. | +| options.javaScriptEnabled | boolean | `true` | Whether to activate JavaScript support for the context. | +| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. | +| options.offline | boolean | `false` | Whether to emulate an offline network. | +| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) for the options. | | options.reducedMotion | string | `'no-preference'` | Minimizes the amount of motion by emulating the 'prefers-reduced-motion' media feature. It can be one of `'reduce'` and `'no-preference'`. See [page.emulateMedia()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatemedia) for the options. | -| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. | -| options.screen.width | number | `1280` | Page width in pixels. | -| options.screen.height | number | `720` | Page height in pixels. | -| options.timezoneID | string | system | Changes the context's timezone. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. | -| options.userAgent | string | browser | Specifies the user agent to use in the context. | -| options.viewport | object | `{'width': 1280, 'height': 720}` | Sets a viewport size for all pages in the context. `null` disables the default viewport. | -| options.viewport.width | number | `1280` | Page width in pixels. | -| options.viewport.height | number | `720` | Page height in pixels. | +| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. | +| options.screen.width | number | `1280` | Page width in pixels. | +| options.screen.height | number | `720` | Page height in pixels. | +| options.timezoneID | string | system | Changes the context's timezone. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. | +| options.userAgent | string | browser | Specifies the user agent to use in the context. | +| options.viewport | object | `{'width': 1280, 'height': 720}` | Sets a viewport size for all pages in the context. `null` disables the default viewport. | +| options.viewport.width | number | `1280` | Page width in pixels. | +| options.viewport.height | number | `720` | Page height in pixels. | ### Returns -| Type | Description | -| ------ | -------------------------------------------------------------------------------- | +| Type | Description | +| ------ | ------------------------------------------------------------------------------------------------------------------------ | | object | [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) object | ### deviceScaleFactor example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/newpage.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/newpage.md index 6df1775965..4703247ec2 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/newpage.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/newpage.md @@ -11,53 +11,53 @@ Creates and returns a new [Page](https://grafana.com/docs/k6//javasc A 1-to-1 mapping between [Browser](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser) and `BrowserContext` means you cannot run `BrowserContexts` concurrently. Due to this restriction, if one already exists, it must be [retrieved](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/context) and [close](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/close)d first before creating a new one. - {{% /admonition %}} +{{% /admonition %}} {{% admonition type="caution" %}} Pages that have been opened ought to be closed using [`Page.close`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close/). Pages left open could potentially distort the results of Web Vital metrics. - {{% /admonition %}} +{{% /admonition %}} -| Parameter | Type | Default | Description | -| ------------------------------------------- | ------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| options | object | `null` | | -| options.bypassCSP | boolean | `false` | Whether to bypass a page's Content-Security-Policy. | -| options.colorScheme | string | `'light'` | Whether to display a page in dark or light mode by emulating the 'prefers-colors-scheme' media feature. It can be one of `'light'`, `'dark'`, `'no-preference'`. | -| options.deviceScaleFactor | number | `1` | Sets the resolution ratio in physical pixels to the resolution in CSS pixels i.e. if set higher than `1`, then images will look sharper on high pixel density screens. See an [example](#devicescalefactor-example) below. | -| options.extraHTTPHeaders | object | `null` | Contains additional HTTP headers to be sent with every request, where the keys are HTTP headers and values are HTTP header values. | -| options.geolocation | object | `null` | Sets the user's geographical location. | -| options.geolocation.latitude | number | `0` | Latitude should be between `-90` and `90`. | -| options.geolocation.longitude | number | `0` | Longitude should be between `-180` and `180`. | -| options.geolocation.accuracy | number | `0` | Accuracy should only be a non-negative number. Defaults to `0`. | -| options.hasTouch | boolean | `false` | Whether to simulate a device with touch events. | -| options.httpCredentials | object | `null` | Sets the credentials for HTTP authentication using Basic Auth. | -| options.httpCredentials.username | string | `''` | Username to pass to the web browser for Basic HTTP Authentication. | -| options.httpCredentials.password | string | `''` | Password to pass to the web browser for Basic HTTP Authentication. | -| options.ignoreHTTPSErrors | boolean | `false` | Whether to ignore HTTPS errors that may be caused by invalid certificates. | -| options.isMobile | boolean | `false` | Whether to simulate a mobile device. | -| options.javaScriptEnabled | boolean | `true` | Whether to activate JavaScript support for the context. | -| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. | -| options.offline | boolean | `false` | Whether to emulate an offline network. | -| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) for the options. | +| Parameter | Type | Default | Description | +| ------------------------------------------- | ------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | +| options.bypassCSP | boolean | `false` | Whether to bypass a page's Content-Security-Policy. | +| options.colorScheme | string | `'light'` | Whether to display a page in dark or light mode by emulating the 'prefers-colors-scheme' media feature. It can be one of `'light'`, `'dark'`, `'no-preference'`. | +| options.deviceScaleFactor | number | `1` | Sets the resolution ratio in physical pixels to the resolution in CSS pixels i.e. if set higher than `1`, then images will look sharper on high pixel density screens. See an [example](#devicescalefactor-example) below. | +| options.extraHTTPHeaders | object | `null` | Contains additional HTTP headers to be sent with every request, where the keys are HTTP headers and values are HTTP header values. | +| options.geolocation | object | `null` | Sets the user's geographical location. | +| options.geolocation.latitude | number | `0` | Latitude should be between `-90` and `90`. | +| options.geolocation.longitude | number | `0` | Longitude should be between `-180` and `180`. | +| options.geolocation.accuracy | number | `0` | Accuracy should only be a non-negative number. Defaults to `0`. | +| options.hasTouch | boolean | `false` | Whether to simulate a device with touch events. | +| options.httpCredentials | object | `null` | Sets the credentials for HTTP authentication using Basic Auth. | +| options.httpCredentials.username | string | `''` | Username to pass to the web browser for Basic HTTP Authentication. | +| options.httpCredentials.password | string | `''` | Password to pass to the web browser for Basic HTTP Authentication. | +| options.ignoreHTTPSErrors | boolean | `false` | Whether to ignore HTTPS errors that may be caused by invalid certificates. | +| options.isMobile | boolean | `false` | Whether to simulate a mobile device. | +| options.javaScriptEnabled | boolean | `true` | Whether to activate JavaScript support for the context. | +| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. | +| options.offline | boolean | `false` | Whether to emulate an offline network. | +| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/grantpermissions) for the options. | | options.reducedMotion | string | `'no-preference'` | Minimizes the amount of motion by emulating the 'prefers-reduced-motion' media feature. It can be one of `'reduce'` and `'no-preference'`. See [page.emulateMedia()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatemedia) for the options. | -| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. | -| options.screen.width | number | `1280` | Page width in pixels. | -| options.screen.height | number | `720` | Page height in pixels. | -| options.timezoneID | string | system | Changes the context's timezone. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. | -| options.userAgent | string | browser | Specifies the user agent to use in the context. | -| options.viewport | object | `{'width': 1280, 'height': 720}` | Sets a viewport size for all pages in the context. `null` disables the default viewport. | -| options.viewport.width | number | `1280` | Page width in pixels. | -| options.viewport.height | number | `720` | Page height in pixels. | +| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. | +| options.screen.width | number | `1280` | Page width in pixels. | +| options.screen.height | number | `720` | Page height in pixels. | +| options.timezoneID | string | system | Changes the context's timezone. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. | +| options.userAgent | string | browser | Specifies the user agent to use in the context. | +| options.viewport | object | `{'width': 1280, 'height': 720}` | Sets a viewport size for all pages in the context. `null` disables the default viewport. | +| options.viewport.width | number | `1280` | Page width in pixels. | +| options.viewport.height | number | `720` | Page height in pixels. | ### Returns -| Type | Description | -| ------ | ------------------------------------------------------------ | +| Type | Description | +| ------ | ---------------------------------------------------------------------------------------------------- | | object | [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/) object | ### deviceScaleFactor example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/_index.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/_index.md index 0eccbdab1c..9c630183c4 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/_index.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/_index.md @@ -1,6 +1,6 @@ --- -title: "Page" -excerpt: "Browser module: Page Class" +title: 'Page' +excerpt: 'Browser module: Page Class' weight: 10 --- @@ -8,64 +8,64 @@ weight: 10 Page provides methods to interact with a single tab in a running web browser. A single [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) can have many `pages`. -| Method | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [page.bringToFront()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/bringtofront) | Activates a browser tab. | -| [page.check(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/check/) | Select the input checkbox. | -| [page.click(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/click/) | Clicks on an element matching a `selector`. | -| [page.close()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close) | Closes a tab that the `page` is associated with. | -| [page.content()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/content) | Gets the HTML contents of the page. | -| [page.context()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/context) | Gets the [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext) that the page belongs to. | -| [page.dblclick(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/dblclick/) | With the [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse), double click on an element matching the provided `selector`. | -| [page.dispatchEvent(selector, type, eventInit[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/dispatchevent/) | Dispatches HTML DOM event types e.g. `'click'` | -| [page.$(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/page-dollar) | Finds an element matching the specified `selector` within the page. | -| [page.$$(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/page-doubledollar) | Finds all elements matching the specified `selector` within the page. | -| [page.emulateMedia([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatemedia/) | Changes the CSS media type and the color scheme feature. | -| [page.emulateVisionDeficiency(type)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/emulatevisiondeficiency) | Emulates your website with the specified vision deficiency `type`. | -| [page.evaluate(pageFunction[, arg])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/evaluate/) | Returns the value of the `pageFunction` invocation. | -| [page.evaluateHandle(pageFunction[, arg])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/evaluatehandle/) | Returns the value of the `pageFunction` invocation as a [JSHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/jshandle). | -| [page.fill(selector, value[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/fill/) | Fill an `input`, `textarea` or `contenteditable` element with the provided value. | -| [page.focus(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/focus/) | Fetches an element with `selector` and focuses on it. | -| [page.frames()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/frames) | Returns an array of frames on the page. | -| [page.getAttribute(selector, name[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/getattribute/) | Returns the element attribute value for the given attribute name. | -| [page.goto(url[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/goto/) | Navigates to the specified `url`. | -| [page.hover(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/hover/) | Hovers over an element matching `selector`. | -| [page.innerHTML(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/innerhtml/) | Returns the `element.innerHTML`. | -| [page.innerText(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/innertext/) | Returns the `element.innerText`. | -| [page.inputValue(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/inputvalue/) | Returns `input.value` for the selected `input`, `textarea` or `select` element. | -| [page.isChecked(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/ischecked/) | Checks to see if the `checkbox` `input` type is selected or not. | -| [page.isClosed()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isclosed) | Checks if the page has been closed. | -| [page.isDisabled(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isdisabled/) | Checks if the element is `disabled`. | -| [page.isEditable(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/iseditable/) | Checks if the element is `editable`. | -| [page.isEnabled(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isenabled/) | Checks if the element is `enabled`. | -| [page.isHidden(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/ishidden/) | Checks if the element is `hidden`. | -| [page.isVisible(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/isvisible/) | Checks if the element is `visible`. | -| [page.keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/keyboard) | Returns the [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard) instance to interact with a virtual keyboard on the page. | -| [page.locator(selector)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator) | Returns a [Locator](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator) for the given `selector`. | -| [page.mainFrame()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/mainframe) | Returns the page's main [Frame](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/frame). | -| [page.mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/mouse) | Returns the [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse) instance to interact with a virtual mouse on the page. | -| [page.on(event, handler)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/on) | Registers a handler to be called whenever the specified event occurs. | -| [page.opener()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/opener) | Returns the `page` that opened the current `page`. | -| [page.press(selector, key[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/press/) | Focuses the element, and then presses the given `key` on the [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard). | -| [page.reload([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/reload/) | Reloads the current page. | -| [page.screenshot([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/screenshot/) | Returns a buffer with the captured screenshot from the web browser. | -| [page.selectOption(selector, values[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/selectoption/) | Selects one or more options which match the values from a `` element. | +| [page.setContent(html[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setcontent/) | Sets the supplied HTML string to the current page. | +| [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout) | Changes the navigation timeout for [page.goto(url[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/goto/), [page.reload([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/reload/), [page.setContent(html[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setcontent/), and [page.waitForNavigation([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfornavigation/) | +| [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaulttimeout) | Changes the timeout for all the methods accepting a `timeout` option. | +| [page.setExtraHTTPHeaders(headers)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setextrahttpheaders) | Sets extra HTTP headers which will be sent with subsequent HTTP requests. | +| [page.setViewportSize(viewportSize)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setviewportsize) | Updates the `page`'s width and height. | +| [page.tap(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/tap/) | Taps the first element that matches the `selector`. | +| [page.textContent(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/textcontent/) | Returns the `element.textContent`. | +| [page.title()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/title) | Returns the `page`'s title. | +| [page.type(selector, text[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/type/) | Types the `text` in the first element found that matches the `selector`. | +| [page.touchScreen](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/touchscreen) | Returns the [Touchscreen](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/touchscreen) instance to interact with a virtual touchscreen on the page. | +| [page.uncheck(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/uncheck/) | Unselects an input `checkbox` element. | +| [page.url()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/url) | Returns the `page`'s URL. | +| [page.viewportSize()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/viewportsize) | Returns the `page`'s size (width and height). | +| [page.waitForFunction(pageFunction, arg[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforfunction/) | Returns when the `pageFunction` returns a truthy value. | +| [page.waitForLoadState(state[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforloadstate/) | Waits for the given load `state` to be reached. | +| [page.waitForNavigation([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfornavigation/) | Waits for the given navigation lifecycle event to occur and returns the main resource response. | +| [page.waitForSelector(selector[, options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitforselector/) | Returns when element specified by selector satisfies `state` option. | +| [page.waitForTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/waitfortimeout) | Waits for the given `timeout` in milliseconds. | +| [page.workers()](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/workers) | Returns an array of the dedicated [WebWorkers](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/worker) associated with the page. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/check.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/check.md index 14cf0dfbee..11139c99e5 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/check.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/check.md @@ -9,24 +9,24 @@ excerpt: 'Browser module: page.check(selector[, options]) method' Use locator-based [`locator.check([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/check/) instead. - {{% /admonition %}} +{{% /admonition %}} This method is used to select an input checkbox. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/click.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/click.md index 2792c83966..81902bb8bd 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/click.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/click.md @@ -9,28 +9,28 @@ excerpt: 'Browser module: page.click(selector[, options]) method' Use locator-based [`locator.click([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/click/) instead. - {{% /admonition %}} +{{% /admonition %}} This method clicks on an element matching a `selector`. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | -| options.clickCount | number | `1` | The number of times the action is performed. | -| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | +| options.clickCount | number | `1` | The number of times the action is performed. | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. Useful to wait until the element is ready for the action without performing it. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. Useful to wait until the element is ready for the action without performing it. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/context.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/context.md index 89f9077485..011e7c2708 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/context.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/context.md @@ -9,8 +9,8 @@ Gets the [BrowserContext](https://grafana.com/docs/k6//javascript-ap ### Returns -| Type | Description | -| ------------------------------------------------------------------------- | ---------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | | [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) | The `BrowserContext` that the page belongs to. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dblclick.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dblclick.md index d07219c0ce..6c702ba267 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dblclick.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dblclick.md @@ -9,27 +9,27 @@ excerpt: 'Browser module: page.dblclick(selector[, options]) method' Use locator-based [`locator.dblclick([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/dblclick/) instead. - {{% /admonition %}} +{{% /admonition %}} Mouse double clicks an element matching provided selector. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | -| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dispatchevent.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dispatchevent.md index d0a55d12b6..a026d1d839 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dispatchevent.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dispatchevent.md @@ -9,19 +9,19 @@ excerpt: 'Browser module: page.dispatchEvent(selector, type, eventInit[, options Use locator-based [`locator.dispatchEvent(type, eventInit[, options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/dispatchevent/) instead. - {{% /admonition %}} +{{% /admonition %}} Dispatches HTML DOM event types e.g. `'click'`. -| Parameter | Type | Defaults | Description | -| --------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| type | string | `''` | DOM event type e.g. `'click'`. | -| eventInit | object | `null` | Optional event specific properties. See [eventInit](#eventinit) for more details. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Defaults | Description | +| --------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| type | string | `''` | DOM event type e.g. `'click'`. | +| eventInit | object | `null` | Optional event specific properties. See [eventInit](#eventinit) for more details. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dollar.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dollar.md index 58456c8534..9a0eb9fe1a 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dollar.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/dollar.md @@ -10,14 +10,14 @@ excerpt: 'Browser module: page.$(selector) method' Use locator-based [`page.locator(selector)`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator/) instead. - {{% /admonition %}} +{{% /admonition %}} The method finds an element matching the specified selector within the page. If no elements match the selector, the return value resolves to `null`. To wait for an element on the page, use [locator.waitFor([options])](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/waitfor/). ### Returns -| Type | Description | -| ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | null \| [ElementHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/elementhandle/) | Returns `ElementHandle` when a matching element is found. Else, it returns `null`. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/doubledollar.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/doubledollar.md index a7c31361cb..c28dc77956 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/doubledollar.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/doubledollar.md @@ -10,14 +10,14 @@ excerpt: 'Browser module: page.$$(selector) method' Use locator-based [`page.locator(selector)`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/locator/) instead. - {{% /admonition %}} +{{% /admonition %}} The method finds all elements matching the specified selector within the page. If no elements match the selector, the return value resolves to `[]`. ### Returns -| Type | Description | -| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | | null \| [ElementHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/elementhandle/)[] | Returns an array of `ElementHandle` when multiple elements are found. Else, it returns `null`. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/evaluatehandle.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/evaluatehandle.md index c6ade0106b..fb7b2215a8 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/evaluatehandle.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/evaluatehandle.md @@ -20,8 +20,8 @@ The only difference between `page.evaluate()` and `page.evaluateHandle()` is tha ### Returns -| Type | Description | -| ------------------------------------------------------------- | ------------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------- | | [JSHandle](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/jshandle/) | The `JSHandle` instance associated with the page. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/fill.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/fill.md index 0687c53351..2d87bd4f06 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/fill.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/fill.md @@ -9,20 +9,20 @@ excerpt: 'Browser module: page.fill(selector, value[, options]) method' Use locator-based [`locator.fill(value[, options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/fill/) instead. - {{% /admonition %}} +{{% /admonition %}} Fill an `input`, `textarea` or `contenteditable` element with the provided value. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| value | string | `''` | Value to fill out for the `input`, `textarea` or `contenteditable` element. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| value | string | `''` | Value to fill out for the `input`, `textarea` or `contenteditable` element. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/focus.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/focus.md index bdfb7152c2..e392cacad7 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/focus.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/focus.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.focus(selector[, options]) method' Use locator-based [`locator.focus([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/focus/) instead. - {{% /admonition %}} +{{% /admonition %}} This method fetches an element with `selector` and focuses it. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/frames.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/frames.md index c2e68eb0c3..d9164da0ed 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/frames.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/frames.md @@ -9,8 +9,8 @@ Returns an array of [Frames](https://grafana.com/docs/k6//javascript ### Returns -| Type | Description | -| ---------------------------------------------------------- | ---------------------------------------------- | +| Type | Description | +| -------------------------------------------------------------------------------------------------- | ---------------------------------------------- | | [Frames](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/frame/)[] | An array of `Frames` associated with the page. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/getattribute.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/getattribute.md index 522efbc70c..50ff501020 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/getattribute.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/getattribute.md @@ -9,18 +9,18 @@ excerpt: 'Browser module: page.getAttribute(selector, name[, options]) method' Use locator-based [`locator.getAttribute()`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/getattribute/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns the element attribute value for the given attribute name. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| name | string | `''` | Attribute name to get the value for. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| name | string | `''` | Attribute name to get the value for. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/goto.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/goto.md index a3178489ac..301203c1e6 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/goto.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/goto.md @@ -11,23 +11,23 @@ Navigating to `about:blank` or navigation to the same URL with a different hash, -| Parameter | Type | Default | Description | -| ----------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| url | string | `''` | URL to navigate page to. The url should include scheme, e.g. `https://`. | -| options | object | `null` | | -| options.referer | string | `''` | Referer header value. | +| Parameter | Type | Default | Description | +| ----------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | `''` | URL to navigate page to. The url should include scheme, e.g. `https://`. | +| options | object | `null` | | +| options.referer | string | `''` | Referer header value. | | options.timeout | number | `30000` | Maximum operation time in milliseconds. Pass `0` to disable the timeout. The default value can be changed via the [browserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout/), [browserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout/), [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout/) or [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaulttimeout/) methods. Setting the value to `0` will disable the timeout. | -| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | +| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | ### Events - {{% admonition type="caution" %}} +{{% admonition type="caution" %}} `networkidle` is DISCOURAGED. Don't use this method for testing especially with chatty websites where the event may never fire, rely on web assertions to assess readiness instead. - {{% /admonition %}} +{{% /admonition %}} Events can be either: @@ -37,8 +37,8 @@ Events can be either: ### Returns -| Type | Description | -| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | +| Type | Description | +| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | Promise/javascript-api/k6-experimental/browser/response/)> | The `Response` instance associated with the page. Else, it returns `null`. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/hover.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/hover.md index fcd8706dd8..e11c5c042a 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/hover.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/hover.md @@ -9,25 +9,25 @@ excerpt: 'Browser module: page.hover(selector[, options]) method' Use locator-based [`locator.hover([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/hover/) instead. - {{% /admonition %}} +{{% /admonition %}} This method hovers over an element matching `selector`. -| Parameter | Type | Default | Description | -| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | -| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | -| options.position.x | number | `0` | The x coordinate. | -| options.position.y | number | `0` | The y coordinate. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | +| options.position.x | number | `0` | The x coordinate. | +| options.position.y | number | `0` | The y coordinate. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | -| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/innerhtml.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/innerhtml.md index 87ec5d8474..6775c3c7d9 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/innerhtml.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/innerhtml.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.innerHTML(selector[, options]) method' Use locator-based [`locator.innerHTML([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/innerhtml/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns the `element.innerHTML`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/innertext.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/innertext.md index 8888e05540..0594ad0c3f 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/innertext.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/innertext.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.innerText(selector[, options]) method' Use locator-based [`locator.innerText([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/innertext/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns the `element.innerText`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/inputvalue.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/inputvalue.md index 9e9495fba9..48a03ffb48 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/inputvalue.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/inputvalue.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.inputValue(selector[, options]) method' Use locator-based [`locator.inputValue([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/inputvalue/) instead. - {{% /admonition %}} +{{% /admonition %}} Returns `input.value` for the selected `input`, `textarea` or `select` element. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/ischecked.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/ischecked.md index 234d4a6059..54e63c3a98 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/ischecked.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/ischecked.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isChecked(selector[, options]) method' Use locator-based [`locator.isChecked([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/ischecked/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks to see if the `checkbox` `input` type is selected or not. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isclosed.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isclosed.md index bf23018606..e5c5a5883f 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isclosed.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isclosed.md @@ -9,7 +9,7 @@ excerpt: 'Browser module: page.isClosed() method' This method has **known issues**. For details, refer to [#878](https://github.com/grafana/xk6-browser/issues/878). - {{% /admonition %}} +{{% /admonition %}} Checks if the page has been closed. diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isdisabled.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isdisabled.md index 7c985d17c1..06eee65ca3 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isdisabled.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isdisabled.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isDisabled(selector[, options]) method' Use locator-based [`locator.isDisabled([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/isdisabled/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `disabled`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/iseditable.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/iseditable.md index 0a0c85de9b..6a66d7bf6b 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/iseditable.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/iseditable.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isEditable(selector[, options]) method' Use locator-based [`locator.isEditable([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/iseditable/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `editable`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isenabled.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isenabled.md index ffa864db62..cb54978aa3 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isenabled.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isenabled.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isEnabled(selector[, options]) method' Use locator-based [`locator.isEnabled([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/isenabled/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `enabled`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/ishidden.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/ishidden.md index 4006705274..e4870d16f0 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/ishidden.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/ishidden.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isHidden(selector[, options) method' Use locator-based [`locator.isHidden([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/ishidden/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `hidden`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isvisible.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isvisible.md index 9e5217e6fb..5925f00f57 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isvisible.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/isvisible.md @@ -9,17 +9,17 @@ excerpt: 'Browser module: page.isVisible(selector[, options]) method' Use locator-based [`locator.isVisible([options])`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/isvisible/) instead. - {{% /admonition %}} +{{% /admonition %}} Checks if the element is `visible`. -| Parameter | Type | Default | Description | -| --------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| options | object | `null` | | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| options | object | `null` | | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/keyboard.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/keyboard.md index e4f99bf69e..5cd98eec9e 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/keyboard.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/keyboard.md @@ -9,8 +9,8 @@ Returns the [Keyboard](https://grafana.com/docs/k6//javascript-api/k ### Returns -| Type | Description | -| ------------------------------------------------------------- | ------------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------- | | [Keyboard](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/keyboard/) | The `Keyboard` instance associated with the page. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/locator.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/locator.md index 5ab63d2cdf..48c458037a 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/locator.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/locator.md @@ -13,8 +13,8 @@ The method returns an element [Locator](https://grafana.com/docs/k6/ ### Returns -| Type | Description | -| ----------------------------------------------------------- | ----------------------------------------------- | +| Type | Description | +| --------------------------------------------------------------------------------------------------- | ----------------------------------------------- | | [Locator](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/) | The element `Locator` associated with the page. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/mainframe.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/mainframe.md index 1d4239d735..5724a35ebb 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/mainframe.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/mainframe.md @@ -9,8 +9,8 @@ The page's main frame. Page is made up of frames in a hierarchical. At the top i ### Returns -| Type | Description | -| ------------------------------------------------------- | ---------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------- | ---------------------- | | [Frame](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/frame/) | The page's main frame. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/mouse.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/mouse.md index c0ad7c53c0..a80ce8c058 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/mouse.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/mouse.md @@ -9,8 +9,8 @@ Returns the [Mouse](https://grafana.com/docs/k6//javascript-api/k6-e ### Returns -| Type | Description | -| ------------------------------------------------------- | ---------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------- | ---------------------------------------------- | | [Mouse](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/mouse/) | The `Mouse` instance associated with the page. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/on.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/on.md index 7c86503b9a..89b59ae199 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/on.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/on.md @@ -16,12 +16,12 @@ Registers a handler to be called whenever the specified event occurs. When using the `page.on` method, the page has to be explicitly [closed](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/close/) for the iteration to be able to finish. - {{% /admonition %}} +{{% /admonition %}} ### Events -| Event | Description | -| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Event | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `console` | Emitted every time the console API methods are called from within the page JavaScript context. The arguments passed into the handler are defined by the [`ConsoleMessage`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/consolemessage) class. | ### Example @@ -58,7 +58,8 @@ export default async function () { check(msg, { assertConsoleMessageType: (msg) => msg.type() == 'log', assertConsoleMessageText: (msg) => msg.text() == 'this is a console.log message 42', - assertConsoleMessageArgs0: (msg) => msg.args()[0].jsonValue() == 'this is a console.log message', + assertConsoleMessageArgs0: (msg) => + msg.args()[0].jsonValue() == 'this is a console.log message', assertConsoleMessageArgs1: (msg) => msg.args()[1].jsonValue() == 42, }); }); diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/opener.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/opener.md index 6b10b45e58..8dabea93bd 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/opener.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/opener.md @@ -9,8 +9,8 @@ Returns the page that opened the current page. The first page that is navigated ### Returns -| Type | Description | -| ------------------------------------------------------------- | --------------------------------------------- | +| Type | Description | +| ----------------------------------------------------------------------------------------------------- | --------------------------------------------- | | null or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/) | The `Page` instance. Else, it returns `null`. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/press.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/press.md index 03229c74d8..5639246862 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/press.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/press.md @@ -9,7 +9,7 @@ excerpt: 'Browser module: page.press(selector, key[, options]) method' Use locator-based [`locator.press()`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/press/) instead. - {{% /admonition %}} +{{% /admonition %}} Focuses the element, and then uses `keyboard.down(key)` and `keyboard.up(key)`. @@ -24,14 +24,14 @@ If `key` is a single character, it is case-sensitive, so the values `a` and `A` Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed. -| Parameter | Type | Default | Description | -| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | -| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). | -| options | object | `null` | | -| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. | -| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | -| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | +| Parameter | Type | Default | Description | +| ------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. | +| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). | +| options | object | `null` | | +| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | +| options.strict | boolean | `false` | When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. | | options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/). | diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/reload.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/reload.md index 4f062f0427..9a11354350 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/reload.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/reload.md @@ -9,21 +9,21 @@ This reloads the current page and returns the main resource response. -| Parameter | Type | Default | Description | -| ----------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| options | object | `null` | | +| Parameter | Type | Default | Description | +| ----------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| options | object | `null` | | | options.timeout | number | `30000` | Maximum operation time in milliseconds. Pass `0` to disable the timeout. The default value can be changed via the [browserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout/), [browserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout/), [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout/) or [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/page/setdefaulttimeout/) methods. Setting the value to `0` will disable the timeout. | -| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | +| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. | ### Events - {{% admonition type="caution" %}} +{{% admonition type="caution" %}} `networkidle` is DISCOURAGED. Don't use this method for testing especially with chatty websites where the event may never fire, rely on web assertions to assess readiness instead. - {{% /admonition %}} +{{% /admonition %}} Events can be either: @@ -33,8 +33,8 @@ Events can be either: ### Returns -| Type | Description | -| --------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| Type | Description | +| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | null or [Response](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/response/) | The `Response` instance associated with the page. Else, it returns `null`. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/selectoption.md b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/selectoption.md index fe0f29f507..513150731d 100644 --- a/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/selectoption.md +++ b/docs/sources/v0.47.x/javascript-api/k6-experimental/browser/page/selectoption.md @@ -9,20 +9,20 @@ excerpt: 'Browser module: page.selectOption(selector, values[, options]) method' Use locator-based [`locator.selectOption()`](https://grafana.com/docs/k6//javascript-api/k6-experimental/browser/locator/selectoption/) instead. - {{% /admonition %}} +{{% /admonition %}} Selects one or more options which match the values from a `