Nightmare: High level wrapper for Phantomjs that provides a streamlined API

Nightmare logo

http://www.nightmarejs.org/

Raw PhantomJS

phantom.create(function (ph) {
  ph.createPage(function (page) {
    page.open('http://yahoo.com', function (status) {
      page.evaluate(function () {
        var el =
          document.querySelector('input[title="Search"]');
        el.value = 'github nightmare';
      }, function (result) {
        page.evaluate(function () {
          var el = document.querySelector('.searchsubmit');
          var event = document.createEvent('MouseEvent');
          event.initEvent('click', true, false);
          el.dispatchEvent(event);
        }, function (result) {
          ph.exit();
        });
      });
    });
  });
});

With Nightmare

new Nightmare()
  .goto('http://yahoo.com')
  .type('input[title="Search"]', 'github nightmare')
  .click('.searchsubmit')
  .run();

Nightwatch.js: Automated browser testing using tests written in Node.js running against a Selenium server

Nightwatch.js logo

From the Nightwatch.js website:

Nightwatch.js is an easy to use Node.js based End-to-End (E2E) testing solution for browser based apps and websites.

It uses the powerful Selenium WebDriver API to perform commands and assertions on DOM elements.

Features

  • Simple but powerful syntax which enables you to write tests very quickly, using
    only Javascript and CSS selectors. No need to initialize other objects and
    classes, you only need to write the test specs.

  • Built-in command-line test runner which enables you to run the tests either
    altogether, by group or single.

  • Manages the Selenium server automatically; can be disabled if Selenium runs on
    another machine.

  • Continous Integration support: JUnit XML reporting is built-in so you can
    integrate your tests in your build process with systems suchs as Hudson or
    Teamcity.

  • Use CSS selectors or Xpath to locate and verify elements on the page or execute
    commands.

  • Easy to extend if you need to implement your own commands specific to your
    application.