Skip to content

Conversation

@renovate-sh-app
Copy link
Contributor

Note: This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
go.k6.io/k6 v0.49.0 -> v0.59.0 age confidence

Release Notes

grafana/k6 (go.k6.io/k6)

v0.59.0

Compare Source

The v0.59.0 release mirrors the previous v1.0.0-rc2 release to allow automation tools to recognize it as the latest version.
For example, Homebrew's k6 formulae and pkg.go.dev do not automatically fetch unstable versions such as v1.0.0-rc2, which is legitimately the expected behavior for these tools.

However, this has been the default for all previous v0.* releases, where they were considered the latest stable version—even if they were under a version typically associated with unstable releases. To address this, we will continue releasing mirrored versions under v0.* for necessary release candidates.

This practice will end once the official stable v1.0.0 release is available, after which we will follow the standard SemVer lifecycle to simplify the workflow for everyone.

The release notes for v1.0.0-rc2 provide a detailed look at all the changes that have been implemented since v1.0.0-rc1/v0.58.0 and are now part of this version.

v0.58.0

Compare Source

The v0.58.0 release mirrors the previous v1.0.0-rc1 release to allow automation tools to recognize it as the latest version.
For example, Homebrew's k6 formulae and pkg.go.dev do not automatically fetch unstable versions such as v1.0.0-rc1, which is legitimately the expected behavior for these tools.

However, this has been the default for all previous v0.* releases, where they were considered the latest stable version—even if they were under a version typically associated with unstable releases. To address this, we will continue releasing mirrored versions under v0.* for necessary release candidates.

This practice will end once the official stable v1.0.0 release is available, after which we will follow the standard SemVer lifecycle to simplify the workflow for everyone.

The release notes for v1.0.0-rc1 provide a detailed look at all the changes that have been implemented since v0.57.0 and are now part of this version.

v0.57.0

Compare Source

k6 v0.57.0 is here 🎉! This release includes:

  • Introducing helpers for functional testing.
  • The k6 new command now supports templates and ProjectIDs.
  • The k6/experimental/csv module gets a new asObjects option.
  • We no longer support the k6/experimental/browser module, in favor of k6/browser.
  • Moving most of non-public APIs to the internal package.

Breaking changes

  • #​4161 Drops k6/experimental/browser. If you're still using it, follow the instructions to move to the graduated and stable k6/browser module.
  • #​4133 Moves all not publicly used APIs in internal package. This was based on the publicly available extensions for k6 and may break private ones. More APIs will likely be removed or updated in follow-up releases after this more mechanical change.
  • #​4292 TypeScript is automatically supported and recognized if the script files use the .ts extension. It also deprecates experimental_enhanced compatibility mode as it is no longer necessary.

New features

New functional testing focused official jslib k6-testing

The k6 team has been developing a new official jslib dedicated to functional testing. While it is still under active development and will potentially see breaking changes, the set of APIs and behaviors it offers are meant to make their way into k6 eventually, and it is now available for early feedback.

k6-testing is a k6 JavaScript library that offers a seamless way to write functional tests in k6, using a Playwright-compatible assertions API. It exposes an expect function, with which assertions can be performed using specific matchers that reflect the expected results.
Unlike current k6's check when expects assertions fail, the test will immediately fail with a clear error message, including the expected and actual values in a similar fashion to what users would observe when using Playwright assertions.

There are many generic matchers (and more to come), such as toEqual, toBe, or toBeTruthy, to only name a few, that can be used to assert conditions during a k6 test.

import { expect } from 'https://jslib.k6.io/k6-testing/0.2.0/index.js';

export default function () {
    const response = http.get('https://test.k6.io');
    expect(response.status).toEqual(200);
    expect(response.body).toBeTruthy();
    expect(response.json()).toEqual(JSON.stringify({ message: 'Hello, world!' }));
}

k6-jslib-testing also includes browser-specific async matchers that wait until the expected condition is met such as toBeVisible, toBeDisabled, or toBeChecked, to name a few.

import { expect } from "https://jslib.k6.io/k6-testing/0.2.0/index.js";
import { browser } from "k6/browser";

export const options = {
  scenarios: {
    ui: {
      executor: "shared-iterations",
      options: {
        browser: {
          type: "chromium",
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();

  try {
    // Navigate to the page
    await page.goto("https://test.k6.io/my_messages.php");

    // Type into the login input field: 'testlogin'
    const loc = await page.locator('input[name="login"]');
    await loc.type("testlogin");

    // Assert that the login input field is visible
    await expect(page.locator('input[name="login"]')).toBeVisible();

    // Expecting this to fail as we have typed 'testlogin' into the input instead of 'foo'
    await expect(page.locator('input[name="login"]')).toHaveValue("foo");
  } finally {
    await page.close();
  }
}

It is currently available as part of the jslib.k6.io repository and is available to use in your k6 tests by adding the following import:

import { expect } from "https://jslib.k6.io/k6-testing/0.2.0/index.js";

Try it out and give us feedback or contribute to the project on the k6-jslib-testing repository!

--template and --project-id flags for k6 new command #​4153

The k6 new command has been revamped to provide an improved experience when scaffolding new k6 tests. It now supports a --template flag with options such as minimal, protocol, and browser, letting you generate a script tailored to your specific use case.

The command also now accepts a --project-id flag, which allows you to easily parameterize the test's Grafana Cloud configuration.

### Create a new k6 script using the 'protocol' template
$ k6 new --template protocol

### Create a Grafana k6 cloud-ready script with a specific project ID
$ k6 new --project-id 12345
New asObjects option in k6/experimental/csv module #​4295

The CSV module's parsing operations now support the asObjects option, which enables parsing CSV data into JavaScript objects instead of arrays of strings (the default behavior).

When asObjects is set to true, the module parses CSV data into objects where:

  • Column names from the header row become object keys.
  • Column values become the corresponding object values.
  • An error is thrown if no header row exists or if options modify the parsing start point.

With the option set to true,

import http from 'k6/http';
import csv from 'k6/experimental/csv';

const csvData = csv.parse('data.csv', { asObjects: true });

the following CSV file:

name,age,city
John,30,New York
Jane,25,Los Angeles

will be parsed into the following JavaScript objects:

[
  { name: 'John', age: '30', city: 'New York' },
  { name: 'Jane', age: '25', city: 'Los Angeles' },
]

Refer to the CSV module's documentation for more information.

UX improvements and enhancements

  • #​4176 Warns on using shorthand options when that override scenarios.
  • #​4293 Renames browser data directory name prefix from xk6-browser-data- to k6browser-data-.
  • #​4513 Adds support for file scheme URLs across file loading APIs - open, k6/experimental/fs.open and k6/net/grpc.Client#load.
  • #​4517 Switches from the legacy examples to quickpizza.grafana.com.

Bug fixes

Maintenance and internal improvements

  • #​4184 Fixes some browser Windows tests.
  • #​4131 Moves experimental WebSocket code into the k6 codebase.
  • #​4143 Fixes for k6packager workflow building image to do k6 releases.
  • #​4172 Drops Slack URL from the README.
  • #​4173 Updates dependencies in gRPC example server.
  • #​4187 Removes packaging folder from browser module - not needed after it was moved to the k6 codebase.
  • #​4188, #​4190 Merge xk6-webcrypto extension code into k6.
  • #​4189 Uses modulestest to make experimental streams test simpler.
  • #​4191 Removes BaseEventEmitter from components that don't work with it.
  • #​4201 Tracks more dependencies to dependabot.
  • #​4212 Fixes gRPC tests after update to golang internal test certificates.
  • #​4213 Updates k6-taskqueue-lib to v0.1.3.
  • #​4271 Runs dependabot weekly instead of daily.
  • #​4275 Fixes the browser module working with reused VUs that originally weren't used in browser scenarios.
  • #​4276 REST API stays on while outputs are flushing, only stopping after that.
  • #​4294 TestStreamLogsToLogger: increase wait time to get less flakiness.
  • #​4209, #​4208, #​4196, #​4195, #​4193, #​4177, #​4163, #​4151, #​4213 Update direct dependencies.
  • #​4198 Adds a multiple forward-slash test case. Thanks, @​apatruni, for the contribution!
  • #​4504, #​4506 Update the golangci-lint version.
  • #​4298 Adds test coverage for configuration file's operations.

v0.56.0

Compare Source

k6 v0.56.0 is here 🎉! This release includes:

  • We've merged xk6-browser into k6.
  • Many small improvements, bug fixes and internal refactors.

Breaking changes

  • browser#1541 Removes accessibility-events from a test, which is no longer a valid permission that can be granted by the latest version of Chromium/Chrome.
  • #​4093 Unexports lib/consts.FullVersion from the k6's Golang API.

New features

Merge browser code in k6 codebase #​4056

While the browser module has been stabilized, the codebase was not moved inside of k6.

As part of the stabilization this is now also merged in the k6 codebase. In the following months we would move issues from the xk6-browser repo and then archive it.

UX improvements and enhancements

  • browser#1536 Removes Headless from the user agent to prevent test traffic from being blocked.
  • browser#1553 Reduces logging noise produced by the browser module.
  • #​4093 Introduces a --json flag to a k6 version sub-command, which switches an output to a JSON format.
  • #​4140 Tags browser module metrics with a resource_type tag which can be one of these values: "Document", "Stylesheet", "Image", "Media", "Font", "Script", "TextTrack", "XHR", "Fetch", "Prefetch", "EventSource", "WebSocket", "Manifest", "SignedExchange", "Ping", "CSPViolationReport", "Preflight", "Other", or "Unknown".
  • #​4092 Populates __ENV.K6_CLOUDRUN_TEST_RUN_ID with the corresponding value for local executions streaming results to the Cloud: k6 cloud run --local-execution.

Bug fixes

  • browser#1507 Fixes the Geolocation.Accuracy field.
  • browser#1515 Fixes Sobek Object.Get(key) by returning *[]any instead of []any.
  • browser#1534 Fixes locator APIs to wait during a navigation without erroring out.
  • browser#1538 Fixes frame.title.
  • browser#1542 Fixes a panic which can occur when a frame navigates.
  • browser#1547 Fixes a panic due to events associated to stale frames.
  • browser#1552 Fixes a panic for locator.selectOption when value is an object.
  • browser#1559 Fixes a panic for page.screenshot.
  • browser#1544 Fixes a nil pointer dereference when calling evaluate or evaluateHandle with an invalid page function.
  • #​4058 Fixes the namespaced object export when default is the only one available.
  • #​4132 Returns an error when a page is null during the creation of a page.

Maintenance and internal improvements

Roadmap

Removal of deprecated k6/experimental/browser module

Since v0.52.0 we have had a non experimental version of the browser module (k6/browser). We urge you to migrate your scripts over to the non experimental browser module as we will be removing the experimental version of it in the next release (v0.57.0).

v0.55.2

Compare Source

k6 v0.55.2 is a patch release that fixes packaging issue.

There are no functional changes in k6 compared to v0.55.1.

v0.55.1

Compare Source

k6 v0.55.1 is here 🎉! This release includes:

  • Dependency updates for golang.org/x/net.

Maintenance and internal improvements

v0.55.0

Compare Source

k6 v0.55.0 is here 🎉! This release includes:

  • ⚠️ The deprecated StatsD output has been removed.
  • ⚠️ The experimental k6/experimental/tracing module has been removed.
  • 🆕 URL grouping support in the browser module.
  • 🆕 Top-level await support.
  • 🔐 Complete RSA support for k6/experimental/webcrypto.

Breaking changes

k6/experimental/tracing module removed #3855

The experimental k6/experimental/tracing module has been removed, in favor of a replacement jslib polyfill, please consult our guide on how to migrate, #3855.

StatsD output removed #3849

The StatsD output was deprecated in k6 v0.47.0 and is now removed. You could still output results to StatsD using the community xk6 extension LeonAdato/xk6-output-statsd. Thanks, @​LeonAdato for taking over the extension!

open will have a breaking change in the future.

Currently, open opens relative files based on an unusual root, similar to how require behaved before it was updated for ESM compatibility. To make k6 more consistent, open and other functions like it will start handling relative paths in the same way as imports and require.
For a more in-depth explanation, please refer to the related issue.

With this version, k6 will start emitting warnings when it detects that in the future, this will break. We recommend using import.meta.resolve() as a way to make your scripts future proof.

http.file#data now truly has the same type as the provided data #4009

Previously http.file#data was always a slice of byte ([]byte) - which was very likely a bug and a leftover from years past.

The original aim (also documented) was to have the same type as the data provided when creating the http.file object, and it is now effectively the case.

New features

Top-level await support 4007

After the initial native support for ECMAScript modules, k6 can now load those modules asynchronously which also allows await to be used in the top-level of a module. That is you can write await someFunc() directly in the top most level of a module instead of having to make an async function that you call that can than use await.

Until now, you had to wrap your code in an async function to use await in the top-level of a module. For example, the following code:

import { open } from 'k6/experimental/fs'
import csv from 'k6/experimental/csv'

let file;
let parser;
(async function () {
	file = await open('data.csv');
	parser = new csv.Parser(file);
})();

Can now be written as:

import { open } from 'k6/experimental/fs'
import csv from 'k6/experimental/csv'

const file = await open('data.csv');
const parser = new csv.Parser(file);

This should make using the increasing number of async APIs in k6 easier in the init context.

This is not allowed in case of using the CommonJS modules, only ECMAScript modules, as CommonJS modules are synchronous by definition.

Complete1 RSA support for k6/experimental/webcrypto #4025

This update includes support for the RSA family of algorithms, including RSA-OAEP, RSA-PSS and RSASSA-PKCS1-v1_5. You can use these algorithms with the crypto.subtle API in the same way as the other algorithms, precisely for generateKey, importKey, exportKey, encrypt, decrypt, sign, and verify operations.

By implementing RSA support, we make our WebCrypto API implementation more complete and useful for a broader range of use cases.

Example usage
Expand to see an example of generation RSA-PSS key pair.
import { crypto } from "k6/experimental/webcrypto";

export default async function () {
  const keyPair = await crypto.subtle.generateKey(
    {
      name: "RSA-PSS",
      modulusLength: 2048,
      publicExponent: new Uint8Array([1, 0, 1]),
      hash: { name: "SHA-1" },
    },
    true,
    ["sign", "verify"]
  );

  console.log(JSON.stringify(keyPair));
}
page.on('metric) to group urls browser#371, browser#1487

Modern websites are complex and make a high number of requests to function as intended by their developers. These requests no longer serve only content for display to the end user but also retrieve insights, analytics, advertisements, and for cache-busting purposes. Such requests are usually generated dynamically and may contain frequently changing IDs, posing challenges when correlating and analyzing your k6 test results.

When load testing a website using the k6 browser module, these dynamic requests can result in a high number of similar-looking requests, making it difficult to correlate them and extract valuable insights. This can also lead to test errors, such as a "too-many-metrics" error, due to high cardinality from metrics tagged with similar but dynamically changing URLs.

This issue also affects synthetic tests. While you may not encounter the "too-many-metrics" error, you may end up with a large amount of uncorrelated metric data that cannot be tracked effectively over time.

To address this in the browser module, we have implemented page.on('metric'), which allows you to define URL patterns using regex for matching. When a match is found, the URL and name tags for the metric are replaced with the new name.

Example usage
Expand to see an example of working with `page.on('metric')`.
import { browser } from 'k6/browser';

export const options = {
  scenarios: {
    ui: {
      executor: 'shared-iterations',
      options: {
        browser: {
            type: 'chromium',
        },
      },
    },
  },
}

export default async function() {
  const page = await browser.newPage();

  // Here, we set up an event listener using page.on('metric').
  // You can call page.on('metric') multiple times, and each callback function
  // will be executed in the order that page.on was called.
  page.on('metric', (metric) => {
    // Currently, metric.tag is the only available method on the metric object.
    // It enables matching on the URL tag using a specified regex pattern.
    // You can call metric.tag multiple times within the callback function.
    metric.tag({
      // This is the new name assigned to any metric that matches the defined
      // URL pattern below.
      name: 'test',
      // Provide one or more match patterns here. Any metrics that match a pattern
      // will use the new name specified above.
      matches: [
        // Each match pattern can include a URL and an optional method.
        // When a method is specified, the metric must match both the URL pattern
        // and the method. If no method is provided, the pattern will match all
        // HTTP methods.
        {url: /^https:\/\/test\.k6\.io\/\?q=[0-9a-z]+$/, method: 'GET'},
      ]
    });
  });

  try {
    // The following lines are for demonstration purposes.
    // Visiting URLs with different query parameters (q) to illustrate matching.
    await page.goto('https://test.k6.io/?q=abc123');
    await page.goto('https://test.k6.io/?q=def456');
  } finally {
    // Ensure the page is closed after testing.
    await page.close();
  }
}
ControlOrMeta support in the keyboard browser#1457

This approach enables tests to be written for all platforms, accommodating either Control or Meta for keyboard actions. For example, Control+click on Windows and Meta+clickon Mac to open a link in a new window.

Example usage
Expand to see an example usage of `ControlOrMeta`
  await page.keyboard.down('ControlOrMeta');

  // Open the link in a new tab.
  // Wait for the new page to be created.
  const browserContext = browser.context();
  const [newTab] = await Promise.all([
    browserContext.waitForEvent('page'),
    await page.locator('a[href="/my_messages.php"]').click()
  ]);

  await page.keyboard.up('ControlOrMeta');

UX improvements and enhancements

  • browser#1462 Enhances waitForSelector error message to better reflect why a selector doesn't resolve to an element.
  • #​4028 Adds support of SigV4 signing for the experimental-prometheus-rw output. This allows users to authenticate with AWS services that require SigV4 signing. Thanks, @​obanby for the contribution!
  • #​4026 Allows setting of service.name from the OTEL_SERVICE_NAME environment variable for the experimental-opentelemetry output. This aligns better with standard OTEL practices. Thanks, @​TimotejKovacka for the contribution!
  • browser#1426 Instruments page.waitForTimeout with tracing which will allow it to be displayed in the timeline.

Bug fixes

  • browser#1452 Fixes a possible deadlock when working with page.on.
  • browser#1469 Fixes locator.waitFor so it waits between navigations and doesn't throw an error.
  • browser#1488, browser#1493 Fixes memory leaks.
  • #​4017 Fixes a bug where k6 would not stop when a test was aborted right after an await statement.

Maintenance and internal improvements

v0.54.0

Compare Source

k6 v0.54.0 is here 🎉! This release includes:

  • A new experimental CSV module
  • New k6 cloud commands for local execution and uploading script files
  • New ECMAScript features
  • Updated logo and branding

Breaking changes

  • #​3913 changes the mapping of Golang's math/big.Int type to bigint type in k6.
  • #​3922 removes lib.Min and lib.Max from k6's Go API, which could affect custom extensions that rely on these functions.
  • #​3838 removes k6/experimental/timers - they are now available globally and no import is needed.
  • #​3944 updates to k6/experimental/websockets, which makes the binaryType default value equal to "blob". With this change, k6/experimental/websockets is now compliant with the specification.

New features

Branding changes and logo #3946, #3953, #3969

As part of joining Grafana Labs in 2021, k6 was renamed to Grafana k6. The original k6 logo and branding was purple, which didn't fit very well next to the Grafana Labs orange logo and all its other products.

In this release, we have a new logo in a new color, and the terminal banner has been redesigned to match the current branding more closely.

Grafana k6 logo

New experimental CSV module for efficient CSV data handling #3743

We’ve added a new experimental CSV module to k6 for more efficient and convenient CSV parsing and streaming, addressing the limitations of preexisting JavaScript-based solutions like papaparse.

What is it?

The CSV module offers two key features:

  • csv.parse(): This function parses a CSV file into a SharedArray at once using Go-based processing for faster parsing and lower memory usage compared to JavaScript alternatives.
  • csv.Parser: This class provides a streaming parser to read CSV files line-by-line, minimizing memory consumption and offering more control over parsing through a stream-like API. This is ideal for scenarios where memory optimization or fine-grained control of the parsing process is crucial.
Benefits for users
  • Faster Parsing: csv.parse bypasses most of the JavaScript runtime, offering significant speed improvements for large files.
  • Lower Memory Usage: Both solutions support shared memory across virtual users (VUs) with the fs.open function.
  • Flexibility: Choose between full-file parsing with csv.parse() or memory-efficient streaming with csv.Parser.
Tradeoffs
  • csv.Parse: Parses the entire file in the initialization phase of the test, which can increase startup time and memory usage for large files. Best suited for scenarios where performance is prioritized over memory consumption.
  • csv.Parser: Reads the file line-by-line, making it more memory-efficient but potentially slower due to reading overhead for each line. Ideal for scenarios where memory usage is a concern or where fine-grained control over parsing is needed.
Example usage
Expand to see an example of Parsing a full CSV file into a SharedArray.
import { open } from 'k6/experimental/fs'
import csv from 'k6/experimental/csv'
import { scenario } from 'k6/execution'

export const options = {
    iterations: 10,
}

let file;
let csvRecords;
(async function () {
    file = await open('data.csv');

    // The `csv.parse` function consumes the entire file at once, and returns
    // the parsed records as a SharedArray object.
    csvRecords = await csv.parse(file, {delimiter: ','})
})();

export default async function() {
    // The csvRecords a SharedArray. Each element is a record from the CSV file, represented as an array
    // where each element is a field from the CSV record.
    //
    // Thus, `csvRecords[scenario.iterationInTest]` will give us the record for the current iteration.
    console.log(csvRecords[scenario.iterationInTest])
}
Expand to see an example of streaming a CSV file line-by-line.
import { open } from 'k6/experimental/fs'
import csv from 'k6/experimental/csv'

export const options = {
    iterations: 10,
}

let file;
let parser;
(async function () {
    file = await open('data.csv');
    parser = new csv.Parser(file);
})();

export default async function() {
    // The parser `next` method attempts to read the next row from the CSV file.
    //
    // It returns an iterator-like object with a `done` property that indicates whether
    // there are more rows to read, and a `value` property that contains the row fields
    // as an array.
    const {done, value} = await parser.next();
    if (done) {
        throw new Error("No more rows to read");
    }

    // We expect the `value` property to be an array of strings, where each string is a field
    // from the CSV record.
    console.log(done, value);
}
New k6 cloud run --local-execution flag for local execution of cloud tests #3904, and #​3931

This release introduces the --local-execution flag for the k6 cloud run command, allowing you to run test executions locally while sending metrics to Grafana Cloud k6.

k6 cloud run --local-execution script.js

By default, using the --local-execution flag uploads the test archive to Grafana Cloud k6. If you want to disable this upload, use the --no-archive-upload flag.

The --local-execution flag currently functions similarly to the k6 run -o cloud command, which is now considered deprecated (though it is not planned to be removed). Future updates will enhance --local-execution with additional capabilities that the k6 run -o cloud command does not offer.

New k6 cloud upload command for uploading test files to the cloud #3906

We continue to refine and improve the cloud service to improve how we handle uploading test files, so we've added a new k6 cloud upload command that replaces the k6 cloud --upload-only flag, which is now considered deprecated.

gRPC module updates driven by contributors
New discardResponseMessage option

#​3877 and #​3820 add a new option for the gRPC module discardResponseMessage, which allows users to discard the messages received from the server.

const resp = client.invoke('main.RouteGuide/GetFeature', req, {discardResponseMessage: true});

This reduces the amount of memory required and the amount of garbage collection, which reduces the load on the testing machine and can help produce more reliable test results.

Thank you, @​lzakharov!

New argument meta for gRPC's stream callbacks

#​3801 adds a new argument meta to gRPC's stream callback, which handles the timestamp of the original event (for example, when a message has been received).

let stream = new grpc.Stream(client, "main.FeatureExplorer/ListFeatures")
stream.on('data', function (data, meta) {
    // will print the timestamp when message has been received
    call(meta.ts);
});

Thank you, @​cchamplin!

Allow missing file descriptors for gRPC reflection

#​3871 allows missing file descriptors for gRPC reflection.

Thank you, @​Lordnibbler!

Sobek updates brings support of new ECMAScript features into k6 #3899, #3925, #3913

With this release, we've updated Sobek (the ECMAScript implementation in Go) which contains the new ECMAScript features that are now available in k6.

This includes support for numeric literal separators:

const billion = 1_000_000_000

Support for BigInt, the values which are too large to be represented by the number primitive:

const huge = BigInt(9007199254740991);

Note: Before k6 version v0.54, Golang's type math/big.Int mapped to another type, so this might be a breaking change for some extensions or users.

RegExp dotAll support, where you can match newline characters with .:

const str1 = "bar\nexample foo example";

const regex1 = /bar.example/s;

console.log(regex1.dotAll); // true

Support for ES2023 Array methods: with, toSpliced, toReversed and toSorted.

Thank you @​shiroyk for adding both the new array methods and BitInt 🙇.

New setChecked method for the browser module browser#1403

Previously, users could check or uncheck checkbox and radio button elements using the check and uncheck methods. Now, we've added a setChecked method that allows users to set a checkbox or radio button to either the checked or unchecked state with a single method and a boolean argument.

await page.setChecked('#checkbox', true);   // check the checkbox
await page.setChecked('#checkbox', false);  // uncheck the checkbox

Page, Frame, ElementHandle, and Locator now support the new setChecked method.

Async check function utility k6-utils#13

Writing concise code can be difficult when using the k6 check function with async code since it doesn't support async APIs. A solution that we have suggested so far is to declare a temporary variable, wait for the value that is to be checked, and then check the result later. However, this approach can clutter the code with single-use declarations and unnecessary variable names, for example:

const checked = await p.locator('.checked').isChecked();

check(checked, {
    'checked': c => c,
});

To address this limitation, we've added a version of the check function to jslib.k6.io that makes working with async/await simpler. The check function is a drop-in replacement for the built-in check, with added support for async code. Any Promises will be awaited, and the result is reported once the operation has been completed:

// Import the new check function from jslib.k6.io/k6-utils
import { check } from 'https://jslib.k6.io/k6-utils/1.5.0/index.js';

// ...

// Use the new check function with async code
check(page, {
    'checked': async p => p.locator('.checked').isChecked(),
});

Check out the check utility function's documentation for more information on how to use it.

k6/experimnetal/websockets updates towards WebSockets API compatibility
Support ArrayBufferViews in send for k6/experimental/websockets #​3944

As part of making k6/experimental/websockets compliant with the WebSocket API, it now supports Uint8Array and other ArrayBufferViews directly as arguments to send, instead of having to specifically provide their buffer.

This should make the module more compliant with libraries that use the WebSocket API.

Thanks to @​pixeldrew for reporting this. 🙇

readyState actually being a number #​3972

Due to goja/Sobek internal workings, readyState wasn't exactly a number in JavaScript code. This had some abnormal behavior, which limited interoperability with libraries.

This has been fixed, and readyState is a regular number from the JavaScript perspective.

Thanks to @​dougw-bc for reporting this. 🙇

Rework of how usage is being collected internally and additional counters #3917 and #3951

As part of working on k6 over the years, we have often wondered if users use certain features or if they see a strange corner case behavior.

We have usually made guesses or tried to extrapolate from experience on issues we see. Unfortunately, this isn't always easy or possible, and it's definitely very skewed. As such, we usually also add warning messages to things we intend to break to inform people and ask them to report problems. But we usually see very little activity, especially before we make changes.

This also only works for things we want to remove, and it doesn't help us know if people use new functionality at all or if there are patterns we don't expect.

While k6 has been collecting usage for a while, they're surface-level things, such as how many VUs were run, the k6 version, or which internal modules were loaded. The system for this was also very rigid, requiring a lot of work to add simple things, such as if someone used the require function.

This process has been reworked to make things easier, and a few new usage reports have been added:

  • When Grafana Cloud is used, it will also tell us which test run it is. We already have most of the information reported through metrics and from the test being executed in the cloud. But this will help us filter cloud test runs from local runs and potentially warn cloud users if they're using experimental modules that will be removed.
  • The number of files parsed, as well as the number of .ts files parsed. This will help us understand if people use small or big projects and if TypeScript support is being used.
  • Usage of require. Now that we have ESM native support, using require and CommonJS adds complexity. It's interesting to us whether removing this in the future - likely years, given its support in other runtimes, is feasible.
  • Usage of global. This will help us decide if we can drop compatibility-mode differences or even the whole concept.

UX improvements and enhancements

  • #​3898 adds SetupTimeout option validation. Thank you, @​tsukasaI!
  • #​3930 adds token validation for k6 cloud login, so now you get immediate feedback right after logging in.
  • #​3876, #​3923 adjusts the process' exit code for cloud test runs where thresholds have failed.
  • #​3765 stops using the confusing and for Rate metrics, and instead uses the form: {x} out of {y}.

Bug fixes

  • #​3947 fixes panic when options is nil (e.g. exported from a module where it isn't really exported).
  • #​3901 fixes the cloud command not being display in the k6 command's help text.
  • browser#1406 fixes panic on iframe attach when iframe didn't contain any UI elements.
  • browser#1420 uses the VU context to control the iterations lifecycle which helps k6 shutdown in a timely manner when a test is aborted.
  • browser#1421 fixes the navigation span by starting when the page starts to load so that it's a better representation of how long the test was on a page.
  • browser#1408, browser#1422 fixes the page.reload API so handles null responses without exceptions.
  • browser#1435 fixes an NPD when performing a click action.
  • browser#1438 fixes a goroutine that waits indefinitely when writing to a channel.
  • #​3968 fixes an issue with the event system where it was dropping events which led to it hanging indefinitely.
  • browser#1442 fixes browser.close to abort the cdp close request when the browser process has already exited.

Maintenance and internal improvements

  • #​3915 switches go.mod to the go1.21, introduces toolchain.
  • #​3938 updates k6's CI workflows to go 1.23.
  • #​3939 updates Dockerfile to use go 1.23 and alpine 3.20.
  • #​3909 fixes ExitCode description typo. Thank you, @​eltociear!
  • #​3926 documents maintenance of tc39 tests.
  • #​3881 adds top-level roadmap link.
  • #​3945 updates the endpoint where usage reports are sent to.
  • browser#1419, browser#1423 add a new remote file upload protocol.
  • #​3900, #​3902 update golangci-lint to 1.60.1 and add fatcontext and cononicalheader as linters.
  • #​3908 drops NetTrail internal type to simplify internal implementation on emitting iteration and data transmission metric.
  • #​3933 adds a testutils.MakeMemMapFs test helper facilitating simulating a file system in tests.
  • #​3943 raises TestStreamLogsToLogger log sending delay to improve the reliability of tests.
  • #​3935 refactors some js tests to remove repeated setup code.
  • #​3903, #​3912, [#&#82

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

Need help?

You can ask for more help in the following Slack channel: #proj-renovate-self-hosted. In that channel you can also find ADR and FAQ docs in the Resources section.

Footnotes

  1. Since under the hood we do fully rely on the Golang's SDK, our implementation doesn't support zero salt lengths for the RSA-PSS sign/verify operations.

@renovate-sh-app
Copy link
Contributor Author

renovate-sh-app bot commented Dec 2, 2025

ℹ Artifact update notice

File name: go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 23 additional dependencies were updated

Details:

Package Change
github.com/stretchr/testify v1.8.4 -> v1.10.0
github.com/cenkalti/backoff/v4 v4.2.1 -> v4.3.0
github.com/fatih/color v1.16.0 -> v1.18.0
github.com/go-logr/logr v1.3.0 -> v1.4.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 -> v2.26.1
github.com/mailru/easyjson v0.7.7 -> v0.9.0
github.com/mattn/go-colorable v0.1.13 -> v0.1.14
go.opentelemetry.io/otel v1.21.0 -> v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 -> v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 -> v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 -> v1.35.0
go.opentelemetry.io/otel/metric v1.21.0 -> v1.35.0
go.opentelemetry.io/otel/sdk v1.21.0 -> v1.35.0
go.opentelemetry.io/otel/trace v1.21.0 -> v1.35.0
go.opentelemetry.io/proto/otlp v1.0.0 -> v1.5.0
golang.org/x/net v0.38.0 -> v0.39.0
golang.org/x/sys v0.31.0 -> v0.32.0
golang.org/x/text v0.23.0 -> v0.24.0
golang.org/x/time v0.5.0 -> v0.11.0
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 -> v0.0.0-20250218202821-56aae31c358a
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 -> v0.0.0-20250218202821-56aae31c358a
google.golang.org/grpc v1.60.0 -> v1.71.1
google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1 -> v1.36.6

| datasource | package     | from    | to      |
| ---------- | ----------- | ------- | ------- |
| go         | go.k6.io/k6 | v0.49.0 | v0.59.0 |


Signed-off-by: renovate-sh-app[bot] <219655108+renovate-sh-app[bot]@users.noreply.github.com>
@renovate-sh-app renovate-sh-app bot force-pushed the renovate/go.k6.io-k6-0.x branch from 2143566 to e097088 Compare December 2, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants