Projects

WebdriverIO v8 Now Available


The WebdriverIO team is excited to announce the release of v8 today!

WebdriverIO v8 Now Available

The WebdriverIO team is excited to announce the release of v8 today! Get started here: https://webdriver.io/docs/gettingstarted 

The team’s goal for this update was to transition from CommonJS to ESM that will enable them to continue with important dependency updates and avoid security issues.

Here are some of the main updates for v8

  • CommonJS to ESM transition
  • Dropped Node.js v12, v13 and v14 support
  • New runner for unit and component testing in the browser
  • New action interface
  • WebDriver BiDi support
  • Optional globals

Keep reading to learn more about WebdriverIO v8, and make sure you check out the full blog by WebdriverIO Lead Maintainer, and Founding Engineer at Stateful, Inc., Christian Bromann.

CommonJS to ESM Transition

The transition to the new module system has been the biggest chunk of work related to this release. It required us to update all module imports, transitioning from Jest to Vitest as a unit test framework and rewrite various parts within the code base. While this affected every single file it “should” be unrecognizable to you. 

Dropped Node.js v12, v13 and v14 Support

We’ve dropped support for Node v12 and v14, the latter was moved into a maintenance LTS phase by the Node.js team in October 2021. While it is technically fine to continue using Node.js v14, we don’t see a reason why you shouldn’t update to Node.js v16 or ideally v18 directly. 

We recommend using NVM (Node Version Manager) to install and manage Node.js versions. You can find a detailed description of how to install NVM and update Node in their project readme.

A new Runner for Unit and Component Testing in the Browser

The new browser runner allows you to load and execute tests within the browser rather than in Node.js. This allows you to access all Web APIs to render web components or to run unit tests for your frontend modules. Under the hood it uses Vite to load all dependencies and make the integration seamless.

Running component tests through WebdriverIO allows you to use the WebdriverIO API seamlessly and enables real user interaction with your components through the WebDriver protocol. This makes those interactions more realistic compared to emitting them through JavaScript. It comes also with 1st class support for popular utility frameworks such as Testing Library and allows you to use both APIs interchangeably. 

New Action Interface

With v8 of WebdriverIO, we now ship a new interface that makes executing various actions much easier.

With two new browser commands: action and actions, it is now much simpler and type-safe to run the right action. Read more on the new action interface in the WebdriverIO API.

WebDriver BiDi Support

Users can start accessing these new protocol features as they become available in browsers. Over time more commands will transition to the new protocol under the hood while the interface remains the same. 

Optional Globals

When using the WebdriverIO test runner it would usually register the browser object or the $ and $$ command to the global scope as these are usually often used when writing tests. With v8, it is now up to the user whether they like to continue attaching these objects and methods to the global scope or prefer importing them directly.

Other Updates

Aside from these major updates, the team has spent time improving the documentation and introduced new API docs around WebdriverIO objects like browser, element and mock. We also removed the config property from the browser object. 

We also fixed the behavior of relative spec or exclude paths. Now, it will be always seen as relative to the config file and –spec arguments, relative from the working directory.

Lastly, we had to remove support for tsconfig-paths as we haven’t found a way to get it working within an ESM context. We believe this integration hasn’t been used much anyway and a lot of it is nowadays natively supported in TypeScript. Let us know if this assumption is wrong and you would like to see it being supported again.

Thank You

Thank you to all who have had a hand in this release! And a special shout out to Christian Bromann for leading this release and providing this blog.

To find out more and install now, see: https://webdriver.io/docs/gettingstarted