Skip to content

Latest commit

 

History

History
157 lines (110 loc) · 8.93 KB

v0.50.0.md

File metadata and controls

157 lines (110 loc) · 8.93 KB

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

  • (optional) <highlight of breaking changes>
  • <Summary of new features> (one or multiple bullets)

Breaking changes

  • #pr, <small_break_1>
  • websockets#60 allows manual set name tag, which also overwrites url tag with name value. This is aligning of the logic that was implemented in the k6 v0.41. Thanks, @mkadirtan for contributing!

(optional h3) <big_breaking_change> #pr

New features

Add support for uploading files from the browser module browser#1097, browser#1244

You can now upload files using the available input forms on the website under test. The new API is setInputFiles which can be called from a page, frame or elementHandle types. It can upload one or more files encoded in the test script. To upload files from the local file system, work with the experimental fs module.

Expand to see the examples.

For the following examples, we will use the HTML file:

<html>

<body>
    <form method="POST" action="/upload" enctype="multipart/form-data">
        <input type="file" name="upl" id="upload" multiple />
        <input type="submit" value="Send" />
    </form>
</body>

</html>

Uploading a file can be achieved with the following script:

// Import the k6 encoder module.
import encoding from 'k6/encoding';
...
export default async function () {
  const page = browser.newPage();

  await page.goto(url)

  // Encode and upload some data into a plain text file called test.txt.
  page.setInputFiles('input[id="upload"]', { name: 'test.txt', mimetype: 'text/plain', buffer: encoding.b64encode('Hello World') })
  
  // Click on the submit button on the form to upload the file.
  const submitButton = page.locator('input[type="submit"]')
  await Promise.all([page.waitForNavigation(), submitButton.click()])

  page.close();
}

Uploading multiple files can be done with the use of an array:

page.setInputFiles('input[id="upload"]',
    [{ name: 'test.txt', mimetype: 'text/plain', buffer: encoding.b64encode('Hello World') },
    { name: 'test.json', mimetype: 'text/json', buffer: encoding.b64encode('{"message": "Hello World"}') }])

Thanks to @bandorko! 🙇 🎉

Introducing options.cloud #3348, #3407

In this release, we introduce a new way of defining cloud options. From now on, you can use just use options.cloud instead of the options.ext.loadimpact.

To migrate to the new way, you can move the loadimpact object to the root of the options object and rename it to cloud. For example:

export let options = {
    ext: {
        loadimpact: {
            name: "Legacy way of defining cloud options",
            projectID: 12345,
        }
    }
};

export let options = {
    cloud: {
        name: "Current way of defining cloud options",
        projectID: 12345,
    }
};

All scripts with legacy options.ext.loadimpact will continue to function as before. There is no planned sunset date for the legacy options, but we highly encourage using options.cloud instead.

Timers API becomes part of the k6 core #3587

With this release, the timers API is no longer experimental and can be imported as k6/timers instead of as k6/experimental/timers. The later will be supported until v0.52.0.

If you want you can also comment on making the current exports of it globally available in #3589 or just giving it 👍.

JSON Web Key support in k6/experimental/webcrypto module webcrypto#61

The experimental webcrypto module got a support for JSON Web Key's (JWK) in importKey and exportKey operations.

This allows you to import and export keys in the JWK format for the supported algorithms.

const generatedKey = await crypto.subtle.generateKey({name: "AES-CBC", length: "256"}, true, [ "encrypt", "decrypt"]);

const exportedKey = await crypto.subtle.exportKey("jwk", generatedKey);

UX improvements and enhancements

Browser Context Isolation browser#1112

With this release, we have overhauled and (tremendously) improved the performance and stability of the browser module. It's now possible to run tests with a larger number of VUs concurrently without any performance issues. Previously, when running tests with multiple VUs concurrently, each VU's browser context would attach to the pages from the other VUS' browser contexts. This led to unexpected behavior and performance issues, and to an extent, reduced the modules capability to run multi VU tests.

Bug fixes

  • #3653 fixes a connectivity issue with non-lowercase options.hosts.
  • browser#1215 fixes a data race during logging that panics.
  • browser#1238 fixes fill functionality for textarea. Thanks @bandorko for the fix! 🙇 🎉
  • browser#1242 fixes XPath evaluation on DocumentFragment.

Maintenance and internal improvements

  • webcrypto#62 fixes display error message in the console and does minor maintenance.
  • webcrypto#60 leverages some of the k6 APIs to handle JavaScript operations.
  • webcrypto#59 makes newTestSetup rely on k6's modulestest.
  • webcrypto#58 addresses linter issues related to repeated static strings.
  • 3633 updates k6 dependencies.

Optional Roadmap

Discussion of future plans