Nightwatch.js

End-to-end testing, the easy way.

Browser Automation

Nightwatch.js is an integrated, easy to use End-to-End testing solution for web applications and websites, written in Node.js. It uses the W3C WebDriver API to drive browsers in order to perform commands and assertions on DOM elements.

  • Clean Syntax

    Simple but powerful syntax which enables you to write tests very quickly, using only Javascript (Node.js) and CSS or Xpath selectors.

  • Cloud Testing Support

    Comes with its own cloud testing platform – NightCloud.io (TBA). Works with other cloud testing providers, such as SauceLabs and BrowserStack.

  • Page Objects Support

    Fluent and easy to work with Page Object Model support to better organise elements and sections, with support for both CSS or Xpath selectors.

  • Easy to Extend

    Flexible command and assertion framework which makes it easy to extend to implement your application custom commands and assertions.

  • Built-in Test Runner

    Built-in command-line test runner which runs the tests either sequentially or in parallel, with retries and implicit waits. Also supports grouping of test suites and tags.

  • WebDriver Service

    Manages automatically Selenium or WebDriver services (ChromeDriver, GeckoDriver, Edge, Safari) in a separate child process.

  • Continuous Integration

    JUnit XML reporting is built-in so you can integrate your tests in your build process with systems such as Teamcity, Jenkins, Hudson etc.

Demo Test

The test below opens the search engine Ecosia.org and searches for "nightwatch", then verifies if the term first result is the Nightwatch.js website.


module.exports = {
  'Demo test Ecosia.org': function (browser) {
    browser
      .url('https://www.ecosia.org/')
      .waitForElementVisible('body')
      .assert.titleContains('Ecosia')
      .assert.visible('input[type=search]')
      .setValue('input[type=search]', 'nightwatch')
      .assert.visible('button[type=submit]')
      .click('button[type=submit]')
      .assert.containsText('.mainline-results', 'Nightwatch.js')
      .end();
  }
};

Ready in One Minute

A demo of how you'll be up & running in one minute with Nightwatch using Chrome and Firefox (assuming Node.js and NPM are installed).

npm install nightwatch geckodriver chromedriver --save-dev
npx nightwatch node_modules/nightwatch/examples/tests/ecosia.js

NightCloud.io

Run and manage your Nightwatch tests
with absolutely no hassle, no config, no nonsense.

Learn More