Nightwatch 2.0 contains a wide range of new features and improvements for writing and running tests as well as full cross-browser testing support for W3C WebDriver compliant browsers.

We have reworked the underlying architecture, which communicates with the browsers, to build on top of the official Selenium-Webdriver Node.js library. It means that Nightwatch is now much better equipped for cross-browser integration and DOM element handling, and can deliver more stable and faster tests overall.

Since Nightwatch 2 builds on top of Selenium now, it is never behind any new WebDriver API.

Nightwatch 2.0.0-beta.1

New Features

  • New user actions API

    Nightwatch 2 brings support for working with the newer Actions API from Selenium WebDriver for performing complex user gestures.

  • Integrated test runner for CucumberJS

    Nightwatch 2 brings integrated support for using Cucumber.js directly as an alternative test runner. No other plugins are necessary, other than the Cucumber library itself (version 7.3 or higher).

  • Improved Mocha test runner

    We have upgraded the integrated Mocha runner to Mocha v9. We have also updated the implementation to match most of the features that Nightwatch offers in its own default test runner, such as the ability to use tags or global test hooks. You can now also use reporters such as Mochawesome.

  • Support for Chrome DevTools Protocol

    When using ChromeDriver or EdgeDriver it is now possible to execute commands via the Chrome DevTools protocol.

  • New .ensure assertions API

    The new .ensure API is a direct mapping to the existing until module from Selenium and provides an extra level of flexibility for performing assertions in tests.

  • New programmatic API

    A brand new programmatic API is available in Nightwatch 2, which makes it very easy to use Nightwatch externally, either by creating your custom runner or by using external test runners like Jest, Mocha, or Ava.

  • New element() global and support for using WebElements

    The newly added element() global object adds to Nightwatch 2 the commands from the Selenium WebElement instance.

New commands

Improvements

  • specify page commands as an ES6 class (details)
  • added enable_fail_fast setting and --fail-fast cli argument to abort the test runner after a failed test suite;
  • added support to use the config file as Promise
  • added support to use glob patterns in config for src_folders, page_object_path, custom_commands_path, custom_assertion_path options
  • browser is now available as a global; other globals: element(), by(), expect(), Keys
  • added support to use Selenium Capabilities objects in Nightwatch config

Breaking changes

We have tried to keep the breaking changes to a minimum, however some changes were unavoidable. See the migrate to v2 guide for details.

Release notes

Please refer to the release notes section for information about the latest changes. Releases Notes.

Improve this article