Nightwatch was published at the beginning of 2014 and was created as a complete and integrated framework which would enable engineers to write end-to-end tests quickly and without headaches. While writing it, we were guided by the belief that writing and running automated UI tests should be a straightforward and pleasant task, and should require as little configuration and maintenance as possible.
The task of interacting with browser internals was already handled by the Selenium project and working with the Selenium server via an HTTP based api was a straightforward task. And so Nightwatch was born by bringing together various existing tools and techniques into one easy-to-use integrated solution.
Seven years later, the open-source testing space for Node.js looks quite different. Several new frameworks appeared over the past few years, each of which is bringing their own set of capabilities to the table and their own interpretation over how automated testing should be done.
Meanwhile, the Selenium json-wire protocol has transition into the W3C Webdriver standard which is now implemented by all major browsers. As far as Nightwatch is concerned, the strategy hasn’t changed that much. In fact, I personally am even more confident to say that, as an open-source project, Nightwatch has now entered the next major phase in its development and maturity.
The strategy for Nightwatch still remains that we should build the solution using tried-and-tested existing tools and techniques in the automation space instead of going our separate way. The Selenium project (which also includes Webdriver) has been around for more than a decade and has consistently refined and evolved how browser automation works, both on local development environments but also at scale, on large distributed cloud infrastructures. That’s why working in collaboration with the Selenium ecosystem makes me confident to say that Nightwatch will not only deliver on its promises but will even surpass expectations.
Another important update perhaps is that we have stopped developing our own cloud testing platform – Nightcloud.io. We were supposed to launch an initial public beta last year, but we've pulled the plug on it I'm afraid. This is due to various reasons, but the main one I suppose is that we – the team at Pineview.io – didn't see enough demand for it to justify the investment. We decided to focus on Nightwatch alone and try and make it the most sophisticated and user-friendly open-source testing framework out there.
Which brings me to the most exciting part of this article I believe. Work is already under way for the next major update – Nightwatch v2, which should land in the public NPM channel by this fall. An alpha version will be available this August.
We are completely reworking the transport layer to use the official Selenium Webdriver bindings for Node.js, which means more seamless browser integration, better and more reliable DOM element handling, and overall more stable and faster tests. Nightwatch v1.x will still be supported and we’ll issue regular patch updates for critical issues. We’ll also try to make the upgrade from Nightwatch v1.5 or higher to v2 as smooth as possible and we’ll try to not introduce any major breaking changes.
Here’s some of the new features in v2 which you might find attractive:
The Actions api provides a more reliable method for generating complex user gestures and will be a built-in feature in Nightwatch (via the existing
In the current version, Nightwatch only supports retrying failed element retrieval operations, but in v2 it will also retry failed element commands (such as when click encounters errors like
element click intercepted).
Currently uploading files with Nightwatch can be cumbersome, but in v2 we’ll add a built-in command which works with the FileDetector api.
The primary way of defining capabilities will still be as part of the
nightwatch.conf.js config file, but in v2, all capabilities objects created with the Selenium Capabilities api will be also be supported by default.
Manipulating network conditions is a regularly needed feature when working with browser automation and we’ll be able to support it in v2 for Chrome and Edge initially.
The Chrome DevTools Protocol allows for tools to instrument, inspect, debug and profile Chromium-based browsers, such as Chrome and Edge, and we’ll add this capability in Nightwatch v2.
The new BiDirectional WebDriver Protocol is by far one of the most exciting recent developments in the Selenium project and it likely to deliver improvements in speed and stability that far outweigh expectations. As soon as it is available, it will become part of Nightwatch as well. You can follow the development on the Selenium website.
Nightwatch v2 will also bring a new
.ensure assert api which will mirror the Selenium until apis, global
browser objects which will enhance the experience of writing tests and provide more flexibility.
Nightwatch v2 will also bring some improvements to the test runner, like ability to re-run only failed tests and improved support for parallel test execution.
The list above is not exhaustive and it might change until the initial public release of version 2. You can also review the updates published in Nightwatch v1.7 in case you may have missed anything.
We are also considering other new features, APIs, and integration with other tools like Appium or Playwright. It would be very helpful if you’d take the time to fill in this short survey and tell us about features you are using or would like to see in the new version. Please do share it with your team.