fix(deps): update module go.k6.io/k6 to v1.2.1 #64
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:
v1.1.0->v1.2.1Release Notes
grafana/k6 (go.k6.io/k6)
v1.2.1Compare Source
k6 v1.2.1 is here 🎉! This release includes:
NaNandInfinityfloat values and easier health checkpage.route, all thepage.getBy*APIs,locator.all(), andpage.waitForURLNote: 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_EXTENSIONSenvironment variable.Note, Community extensions are only supported for local test executions (using
k6 runork6 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
NaNorInfinitywere 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 manualinvokecalls, 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
expectfunction 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.getByRoleAPI #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-labelattribute, 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 theirtitleattribute. This is particularly useful for finding tooltips, buttons, or any other elements that use thetitleattribute 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-testidattribute. This is particularly useful for creating resilient tests that are not affected by changes to the UI, sincedata-testidattributes 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
routeobject 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
waitForURLinframeandpage#4917, #4920The browser module now includes the
waitForURLmethod for bothpageandframeobjects.As a prerequiste to this enhancement,
waitForNavigationnow accepts aurloption. This also allows you to wait for a specific URL during navigation. It is advised that you work withwaitForURLinstead.The
waitForURLmethod 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
waitForURLprovides 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.selectOptionin the browser module.authoritypseudo 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
BrowserContextis requested before creating aPagein the browser module.waitForNavigationnow blocking the iteration from ending ifpage.closeis not called.Maintenance and internal improvements
waitForNavigationcomplexity.v1.2.0Compare Source
k6 v1.2.0 is here 🎉! This release includes:
NaNandInfinityfloat values and easier health checkpage.route, all thepage.getBy*APIs,locator.all(), andpage.waitForURLBreaking 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_EXTENSIONSenvironment variable.Note, Community extensions are only supported for local test executions (using
k6 runork6 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
NaNorInfinitywere 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 manualinvokecalls, 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
expectfunction 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.getByRoleAPI #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-labelattribute, 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 theirtitleattribute. This is particularly useful for finding tooltips, buttons, or any other elements that use thetitleattribute 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-testidattribute. This is particularly useful for creating resilient tests that are not affected by changes to the UI, sincedata-testidattributes 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
routeobject 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
waitForURLinframeandpage#4917, #4920The browser module now includes the
waitForURLmethod for bothpageandframeobjects.As a prerequiste to this enhancement,
waitForNavigationnow accepts aurloption. This also allows you to wait for a specific URL during navigation. It is advised that you work withwaitForURLinstead.The
waitForURLmethod 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
waitForURLprovides 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.selectOptionin the browser module.authoritypseudo 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
BrowserContextis requested before creating aPagein the browser module.waitForNavigationnow blocking the iteration from ending ifpage.closeis not called.Maintenance and internal improvements
waitForNavigationcomplexity.Configuration
📅 Schedule: Branch creation - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday ( * 0-4,22-23 * * 1-5 ), Only on Sunday and Saturday ( * * * * 0,6 ) in timezone Asia/Tokyo, Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.