The primary goal for the new version of WebdriverIO was to transition from CommonJS to ESM in order to continue with important dependency updates and avoid security issues. Furthermore, we cleaned up some code, implemented a new Action API interface and streamlined the way WebdriverIO deals with global objects using the test runner.
Read the WebdriverIO blog post to see which changes you will need to make to upgrade to v8, but in most cases no updates are necessary.
Here we’ll outline the changes in this new version.
While you can continue using Node.js v14, we recommend updating to Node.js v16 or v18 directly. See how to update in the WebdriverIO blog.
This transition required updates to all module imports, transitioning from Jest to Vitest as a unit test framework and rewriting of various parts within the code base. While this affected all files, it should not affect your work, as CommonJS is still supported.
The new browser runner allows you to load and execute tests within the browser rather than in Node.js. This will allow you to enable a more realistic user interaction with your components compared to emitting them through JavaScript.
Read the WebdriverIO blog to learn how you can use the Testing Library for rendering and fetching elements while using WebdriverIO for interacting with components.
With this latest release, there is a new interface that makes executing various actions much easier. Two new browser commands–action and actions–make it much simpler and type-safe to run the right action.
Since WebdriverIO is based on the WebDriver protocol–a web standard for automating browsers–you can run tests in browsers that are used by your users rather than in a browser engine.
With this release, users can access the new protocol features as they become available in browsers.
For more information on browser development to ensure features work as expected using a lean user interface, watch my talk on The Evolution of Browser Automation.
Attaching objects to the global scope is not a best practice and can cause side effects when other modules do the same. Therefore with v8, it’s now up to the user whether they want to continue to attach these objects and methods to the global scope or import them directly.
The documentation has been improved and new API docs have been introduced. Additionally, the config property was removed from the browser object and the behavior of relative spec and exclude paths has been fixed, and support for tsconfig-paths was removed.
To see all of the details of this latest release, visit the WebdriverIO blog.
This post was first published in December 2022.