v0.3.0
xk6-browser v0.3.0 is here! 🎉
This is a minor release with some important bug fixes, a couple of new features, improvements and code refactoring!
New features
-
Implemented
Browser.on(event)
. (#268, #287)on('disconnected')
returns aPromise
you can wait on to get notified when the WebSocket connection to the browser is closed. See this example for details.This is the first async method in xk6-browser, using the newly released event loop support in k6, and marks the start of our transition to async APIs. 🎉
-
Exposed preconfigured mobile device emulation settings. (#289)
We maintain an internal list of popular devices with their viewport size, user agent and scaling factor, which is useful to test how a web site looks and behaves on different devices. See this example for details.
-
Made concealed elements clickable. (#264)
We've added an automatic retry mechanism to improve the reliability of element and pointer actions. We will further improve this in future releases - hence our users' experience.
Bugs fixed
-
Made concealed elements clickable. (#264)
Previously, interacting with an element obscured by another was failing with
wait for selector did not result in any nodes
. Now we properly detect this scenario and retry the action with different scroll positions. This affects allElement
andFrame
click()
,dblclick()
,hover()
,check()
,uncheck()
andtap()
actions. -
Fixed
waitForSelector()
flakiness by retrying once on failure. (#260) -
Fixed data race accessing
Frame.documentHandle
while switching execution contexts. (#263) -
Fixed keyboard press of special keys. (#283)
Previously pressing some keys like Backspace, Delete, ArrowLeft, and AltGraph would panic.
-
Fixed negative metric emission in certain rare scenarios. (#288)
-
Fixed
Page.waitForFunction()
. (#294)waitForFunction()
previously wasn't working. The fix is a rewrite of the feature that ensures all three polling variants work. Validpolling
options are:raf
(default): run the predicate function in arequestAnimationFrame
callback. This will run most frequently, up to 60 times a second.mutation
: run the predicate function on every DOM mutation.- number: run the predicate function at an interval, this many milliseconds apart.
Also note that this is now an async method that returns a
Promise
, so you must usethen()
to resolve it.See this example for details.
-
Fixed
Page.innerHTML()
,Page.innerText()
andPage.textContent()
panic. (#299) -
Fixed the
executablePath
option. (#246)Although you could fill this option out, it wasn't working before, and we were using a predefined path by default. We implemented the option code, and you can now run a Chrome browser of your choice by providing the file path.
Improvements
-
Improved detection of non-clickable elements. (#270)
We now properly detect elements obscured by another element and return an error instead of waiting. This enables the fix in #264.
-
Cleanly close the WebSocket connection when
Browser.close()
is called. (#268) -
Added lifecycle event validation to
Page.waitForLoadState()
. (#300) -
We have started updating our JavaScript API documentation, which we know how important it is to serve as a reference while writing your scripts. This is an ardous task that won't be possible in a couple of weeks, but rest assured we're prioritizing it in all upcoming development cycles, and will be releasing gradual changes as they're done.
-
We added a project roadmap to share our development goals with the community.
Internals
-
Refactored the
chromium
package to fix linter issues and improve code structure. (#246) -
Several code refactors to improve maintainability. (#269, #293)
-
All dependencies were updated to their latest versions. (#274)
Specifically, k6 was updated to v0.38.0, which required us to fix some breaking changes (#286, #302).