Update module go.k6.io/k6 to v1 #85
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v0.56.0
->v1.2.3
Release Notes
grafana/k6 (go.k6.io/k6)
v1.2.3
Compare Source
k6 1.2.3 is a small patch with a couple of bug fixes
Bug fixes
k6
after a fix in v1.2.2.Any
.v1.2.2
Compare Source
k6 1.2.2 is a small patch release fixing a panic and two other smaller bugfixes.
Bug fixes
k6 login cloud
command. Thanks @indygriffiths for reporting it!v1.2.1
Compare Source
k6 v1.2.1 is here 🎉! This release includes:
NaN
andInfinity
float values and easier health checkpage.route
, all thepage.getBy*
APIs,locator.all()
, andpage.waitForURL
Note: An old xk6-browser repo v1.2.0 tag was pushed by mistake. It was left over on the machine since the merging of the two repos. As such it can not be used as a go module or installed with
go install
. For this reason v1.2.1 is released.Breaking changes
As per our stability guarantees,
breaking changes across minor releases are allowed only for experimental features.
Breaking changes for experimental modules
New features
Automatic extension resolution
k6 extensions allow you to add custom functionality to your tests, such as connecting to databases, message queues, or specialized networking protocols. Previously, using extensions required manual building of a custom k6 binary with the extensions compiled in. This new version introduces the Automatic Extension Resolution functionality, previously named Binary Provisioning, which is enabled by default and automatically detects when your script imports extensions and handles the complexity of provisioning the right k6 binary for you.
The previous experimental versions only supported official extensions. #4922 added the support to use any extension listed in the community list by setting the
K6_ENABLE_COMMUNITY_EXTENSIONS
environment variable.Note, Community extensions are only supported for local test executions (using
k6 run
ork6 cloud run --local-execution
). When running tests on Grafana Cloud k6, only official extensions are allowed.Check out the new extensions documentation for additional details.
Handling of NaN and Infinity float values in gRPC #4631
Previously, float values of
NaN
orInfinity
were marshalled asnull
. This has now changed to use their string representation, aligning with other gRPC APIs.There are no changes required in the scripts.
This is also the first contribution by @ariasmn. Thank you @ariasmn for taking the time to make the PR and answer all our questions.
Health check for gRPC APIs #4853
The k6 gRPC module now has a
client.healthCheck()
method that simplifies checking the status of a gRPC service. This method eliminates the need for manualinvoke
calls, making it particularly useful for readiness checks and service discovery.Before, you had to write boilerplate code to perform a health check:
Now, you can simplify this with the
healthCheck()
method:Check out the client.healthCheck documentation for additional details.
Thank you, @tbourrely, for contributing this feature.
Assertions Library (Preview) #4067
k6 now provides an assertions library to help you verify your application behaves as expected during testing.
The library introduces the
expect
function with a set of expressive matchers. Pass a value toexpect()
and chain it with a matcher that defines the expected outcome. The library caters to both protocol testing HTTP/API and browser testing scenarios.The API is inspired by Playwright's assertion syntax, offering a fluent interface for more readable and reliable tests.
Preview feature
This feature is ready to use, but still in preview:
We welcome your feedback, and invite you to share your suggestions and contributions on GitHub.
Add
page.getByRole
API #4843The browser module now supports
page.getByRole()
, which allows you to locate elements based on their ARIA roles. This provides a more semantic and accessible way to find elements, making your tests more robust and aligned with how users actually interact with web applications.ARIA roles represent the purpose or function of an element (like button, link, textbox, etc.), making them excellent selectors for testing since they're less likely to change when the UI is refactored compared to CSS classes or IDs.
Example usage:
Now, you can simplify this by using
getByAltText()
:Add
page.getByLabel
#4890The browser module now includes
page.getByLabel()
, which provides a convenient way to locate form elements and other interactive components by their associated label text. This method works with both explicit<label>
elements and elements that have anaria-label
attribute, making it particularly useful for finding form inputs, buttons, and other interactive elements.Previously, you would need to use XPath selectors to find elements by their label text, since CSS selectors cannot easily handle the relationship between labels and form elements:
Now, you can simplify this with
getByLabel()
:Add
page.getByPlaceholder
#4904The browser module now includes
page.getByPlaceholder()
, which provides a convenient way to locate form elements by their placeholder text. This is particularly useful for finding input fields, textareas, and other form controls that use placeholder text to guide user input.Previously, you would need to use CSS or XPath selectors to find elements by their placeholder attribute:
Now, you can simplify this with
getByPlaceholder()
:Add
page.getByTitle
#4910The browser module now includes
page.getByTitle()
, which provides a convenient way to locate elements by theirtitle
attribute. This is particularly useful for finding tooltips, buttons, or any other elements that use thetitle
attribute to provide extra information.Previously, you would need to use CSS or XPath selectors to find these elements:
Now, you can simplify this with
getByTitle()
:Add
page.getByTestId
#4911The browser module now includes
page.getByTestId()
, which provides a convenient way to locate elements by theirdata-testid
attribute. This is particularly useful for creating resilient tests that are not affected by changes to the UI, sincedata-testid
attributes are specifically added for testing purposes and are not expected to change.Previously, you would need to use CSS or XPath selectors to find these elements:
Now, you can simplify this with
getByTestId()
:Add
page.getByText
#4912The browser module now includes
page.getByText()
, which allows you to locate elements by their text content. This provides a convenient way to find elements like buttons, links, and other interactive components that are identified by their visible text.Previously, you would need to use XPath selectors to find elements by their text content, since CSS selectors cannot directly query the text of an element:
Now, you can simplify this with
getByText()
:Add
page.route
#4953 #4961, #4971, #4985The browser module now supports
page.route()
, which allows you to intercept and handle network requests before they are sent. This is particularly useful for testing scenarios where you need to mock API responses, block certain resources, or modify request behavior.The route handler receives a
route
object that provides methods toabort()
,continue()
, orfulfill()
the request.You can use
page.route()
to:abort()
.fulfill()
.continue()
.Add
locator.all()
#4899The browser module now supports the
locator.all()
method, which returns an array of locators for all elements matching the selector. This is particularly useful when you need to interact with multiple similar elements on a page, such as items in a list or multiple buttons with the same styling.Example usage:
Add
waitForURL
inframe
andpage
#4917, #4920The browser module now includes the
waitForURL
method for bothpage
andframe
objects.As a prerequiste to this enhancement,
waitForNavigation
now accepts aurl
option. This also allows you to wait for a specific URL during navigation. It is advised that you work withwaitForURL
instead.The
waitForURL
method first checks if the current page URL already matches the expected pattern. If it does, it waits for the load state to complete. Otherwise, it waits for a navigation to the specified URL. This approach prevents race conditions where a page might complete navigation before the wait condition is set up, which is particularly useful when dealing with pages that perform multiple redirects. It supports both string patterns and regular expressions:While
waitForURL
provides a convenient way to wait for specific URLs, we still recommend using element-based waiting strategies or the locator API with its built-in auto-waiting capabilities for more reliable tests.UX improvements and enhancements
locator.selectOption
in the browser module.authority
pseudo header to the gRPC module. Thank you @Oursin for the changes.page.url()
now doesn't make a call to the browser but instead uses a cached version. Making it a lot faster and aligned with playwright.expect()
syntax in script templates.Bug fixes
BrowserContext
is requested before creating aPage
in the browser module.waitForNavigation
now blocking the iteration from ending ifpage.close
is not called.Maintenance and internal improvements
waitForNavigation
complexity.v1.2.0
Compare Source
k6 v1.2.0 is here 🎉! This release includes:
NaN
andInfinity
float values and easier health checkpage.route
, all thepage.getBy*
APIs,locator.all()
, andpage.waitForURL
Breaking changes
As per our stability guarantees,
breaking changes across minor releases are allowed only for experimental features.
Breaking changes for experimental modules
New features
Automatic extension resolution
k6 extensions allow you to add custom functionality to your tests, such as connecting to databases, message queues, or specialized networking protocols. Previously, using extensions required manual building of a custom k6 binary with the extensions compiled in. This new version introduces the Automatic Extension Resolution functionality, previously named Binary Provisioning, which is enabled by default and automatically detects when your script imports extensions and handles the complexity of provisioning the right k6 binary for you.
The previous experimental versions only supported official extensions. #4922 added the support to use any extension listed in the community list by setting the
K6_ENABLE_COMMUNITY_EXTENSIONS
environment variable.Note, Community extensions are only supported for local test executions (using
k6 run
ork6 cloud run --local-execution
). When running tests on Grafana Cloud k6, only official extensions are allowed.Check out the new extensions documentation for additional details.
Handling of NaN and Infinity float values in gRPC #4631
Previously, float values of
NaN
orInfinity
were marshalled asnull
. This has now changed to use their string representation, aligning with other gRPC APIs.There are no changes required in the scripts.
This is also the first contribution by @ariasmn. Thank you @ariasmn for taking the time to make the PR and answer all our questions.
Health check for gRPC APIs #4853
The k6 gRPC module now has a
client.healthCheck()
method that simplifies checking the status of a gRPC service. This method eliminates the need for manualinvoke
calls, making it particularly useful for readiness checks and service discovery.Before, you had to write boilerplate code to perform a health check:
Now, you can simplify this with the
healthCheck()
method:Check out the client.healthCheck documentation for additional details.
Thank you, @tbourrely, for contributing this feature.
Assertions Library (Preview) #4067
k6 now provides an assertions library to help you verify your application behaves as expected during testing.
The library introduces the
expect
function with a set of expressive matchers. Pass a value toexpect()
and chain it with a matcher that defines the expected outcome. The library caters to both protocol testing HTTP/API and browser testing scenarios.The API is inspired by Playwright's assertion syntax, offering a fluent interface for more readable and reliable tests.
Preview feature
This feature is ready to use, but still in preview:
We welcome your feedback, and invite you to share your suggestions and contributions on GitHub.
Add
page.getByRole
API #4843The browser module now supports
page.getByRole()
, which allows you to locate elements based on their ARIA roles. This provides a more semantic and accessible way to find elements, making your tests more robust and aligned with how users actually interact with web applications.ARIA roles represent the purpose or function of an element (like button, link, textbox, etc.), making them excellent selectors for testing since they're less likely to change when the UI is refactored compared to CSS classes or IDs.
Example usage:
Now, you can simplify this by using
getByAltText()
:Add
page.getByLabel
#4890The browser module now includes
page.getByLabel()
, which provides a convenient way to locate form elements and other interactive components by their associated label text. This method works with both explicit<label>
elements and elements that have anaria-label
attribute, making it particularly useful for finding form inputs, buttons, and other interactive elements.Previously, you would need to use XPath selectors to find elements by their label text, since CSS selectors cannot easily handle the relationship between labels and form elements:
Now, you can simplify this with
getByLabel()
:Add
page.getByPlaceholder
#4904The browser module now includes
page.getByPlaceholder()
, which provides a convenient way to locate form elements by their placeholder text. This is particularly useful for finding input fields, textareas, and other form controls that use placeholder text to guide user input.Previously, you would need to use CSS or XPath selectors to find elements by their placeholder attribute:
Now, you can simplify this with
getByPlaceholder()
:Add
page.getByTitle
#4910The browser module now includes
page.getByTitle()
, which provides a convenient way to locate elements by theirtitle
attribute. This is particularly useful for finding tooltips, buttons, or any other elements that use thetitle
attribute to provide extra information.Previously, you would need to use CSS or XPath selectors to find these elements:
Now, you can simplify this with
getByTitle()
:Add
page.getByTestId
#4911The browser module now includes
page.getByTestId()
, which provides a convenient way to locate elements by theirdata-testid
attribute. This is particularly useful for creating resilient tests that are not affected by changes to the UI, sincedata-testid
attributes are specifically added for testing purposes and are not expected to change.Previously, you would need to use CSS or XPath selectors to find these elements:
Now, you can simplify this with
getByTestId()
:Add
page.getByText
#4912The browser module now includes
page.getByText()
, which allows you to locate elements by their text content. This provides a convenient way to find elements like buttons, links, and other interactive components that are identified by their visible text.Previously, you would need to use XPath selectors to find elements by their text content, since CSS selectors cannot directly query the text of an element:
Now, you can simplify this with
getByText()
:Add
page.route
#4953 #4961, #4971, #4985The browser module now supports
page.route()
, which allows you to intercept and handle network requests before they are sent. This is particularly useful for testing scenarios where you need to mock API responses, block certain resources, or modify request behavior.The route handler receives a
route
object that provides methods toabort()
,continue()
, orfulfill()
the request.You can use
page.route()
to:abort()
.fulfill()
.continue()
.Add
locator.all()
#4899The browser module now supports the
locator.all()
method, which returns an array of locators for all elements matching the selector. This is particularly useful when you need to interact with multiple similar elements on a page, such as items in a list or multiple buttons with the same styling.Example usage:
Add
waitForURL
inframe
andpage
#4917, #4920The browser module now includes the
waitForURL
method for bothpage
andframe
objects.As a prerequiste to this enhancement,
waitForNavigation
now accepts aurl
option. This also allows you to wait for a specific URL during navigation. It is advised that you work withwaitForURL
instead.The
waitForURL
method first checks if the current page URL already matches the expected pattern. If it does, it waits for the load state to complete. Otherwise, it waits for a navigation to the specified URL. This approach prevents race conditions where a page might complete navigation before the wait condition is set up, which is particularly useful when dealing with pages that perform multiple redirects. It supports both string patterns and regular expressions:While
waitForURL
provides a convenient way to wait for specific URLs, we still recommend using element-based waiting strategies or the locator API with its built-in auto-waiting capabilities for more reliable tests.UX improvements and enhancements
locator.selectOption
in the browser module.authority
pseudo header to the gRPC module. Thank you @Oursin for the changes.page.url()
now doesn't make a call to the browser but instead uses a cached version. Making it a lot faster and aligned with playwright.expect()
syntax in script templates.Bug fixes
BrowserContext
is requested before creating aPage
in the browser module.waitForNavigation
now blocking the iteration from ending ifpage.close
is not called.Maintenance and internal improvements
waitForNavigation
complexity.v1.1.0
Compare Source
k6
v1.1.0
is here 🎉! This release includes:count
,nth
,first
, andlast
methods for the browser module's Locator API #4797, #4825k6/experimental/webcrypto
module has been removed as its functionality is available globally.full
end-of-test summary are now sorted as in code and properly indented.Breaking changes
As per our stability guarantees,
breaking changes across minor releases are allowed only for experimental features.
Breaking changes for experimental modules
Remove experimental
k6/experimental/webcrypto
module #4851The WebCrypto API has been available globally since
v1.0.0-rc1
(orv0.58.0
), and now the experimental import (k6/experimental/webcrypto
) is no longer available.The required change for users is to remove the
import
; the rest of the code should work.New features
New
count
method for the browser module's Locator API #4797The new
locator.Count
method returns the number of elements matching thelocator
. Unlike other Locator API methods,locator.Count
returns the result immediately and doesn't wait for the elements to be visible.New
nth
,first
andlast
methods for the browser module's Locator API #4825The new Locator API methods,
nth
,first
, andlast
, can select a single element from multiple elements matched by alocator
. For example, selecting a single item from a catalogue of items on an e-commerce website. Because items in this catalogue generally change often and selecting an exact element may fail in future test runs, the new methods help to prevent flaky tests, leading to more reliable tests.UX improvements and enhancements
full
end-of-test summary group results as in code and fixes the indentation. Thanks, @the-it, for the contribution!Bug fixes
k6/browser
.locator.fill
method when used on react based websites.12345
instead ofk6
to avoid having to work withrunAsUser
in the pod manifest file.click
is called.Maintenance and internal improvements
k6/browser
performance improvements.chromedp/cdproto
dependency and adjusts the Browser module accordingly.examples/grpc_server
and updates its dependencies.CODECOV_TOKEN
variable for GH Workflows from Vault.ubuntu-24.04-arm
). Thanks, @nadiamoe, for the contribution!Roadmap
Official Testing/Assertions Module
We're working to integrate a built-in testing and assertions module that's compatible with Playwright's in k6. You can try the current implementation using the k6 testing jslib, which serves as our work-in-progress implementation for what will become the official
k6/test
module (final name TBD). We'd love your feedback on issue #4805.Enhanced Machine-Readable Test Results
We're developing the next version of k6's end-of-test summary to make it easier to integrate test results into CI/CD pipelines and automated workflows. This new format will be officially supported, versioned, and designed specifically for programmatic use. Follow our progress, and provide us with feedback on issue #4803.
v1.0.0
Compare Source
Grafana k6 v1.0 is here! 🎉
After 9 years of iteration and countless community contributions, we're thrilled to announce Grafana k6 v1.0.
While many features and capabilities in this release were introduced gradually in previous versions, k6 v1.0 marks a turning point: a commitment to stability, formal support guarantees, and transparency in how we evolve and develop the project from here. This milestone is more than a version number; it's about trust, reliability, and empowering you to test confidently.
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.
This PR has been generated by Renovate Bot.