Tag Archives: automation

Nemo.js: PayPal’s open source node.js automation framework


Nemo.js came about as a response to the adoption of krakenjs within PayPal. Writing automation in JavaScript made sense for a variety of reasons: involving web application engineers in the automation process, executing tests in a common context, utilizing the task and test frameworks already in place. Nothing in the node.js ecosystem met the extensive requirements of automation tests at PayPal, so Nemo.js was born.

Nemo.js wraps around the ubiquitous Selenium WebDriver, and as such, allows control of virtually any browser on any operating system. Nemo.js is built with a plugin architecture. This allows the core module to be very small. It allows users to customize their testing environment, without including features they do not need. It allows an easy interface for authoring new plugins that can then be shared with others. It also allows the user their choice of test runner and task runner.

Nemo setup

Nemo was designed to reduce cruft in spec files, as well as offer maximum flexibility. The basic setup pattern is:

var Nemo = require('nemo');
var nemo = {};
var plugins = require('../config/nemo-plugins.json');
var setup = require('../config/setups').fooSpec;

(new Nemo(plugins)).setup(setup).then(function (_nemo) {
  nemo = _nemo;
   * nemo.wd is a reference to selenium-webdriver commonjs module
   * nemo.driver is a reference to the active WebDriver instance
   * nemo.view will contain views and addView method (if using nemo-view)
   * nemo.props contains any properties defined in the nemoData ENV variable

Combine this pattern with a test runner like Mocha.js and a task runner like Grunt.js and you’ve got an incredibly powerful and configurable automation environment. You can easily run and organize tests in both development and continuous integration environments, against multiple browser/OS/device combinations.

Nemo-view plugin

Using the nemo-view plugin, verbose Selenium syntax becomes much more readable

driver.wait(function () {
  return driver.isElementPresent(By.id('email'));
}, 10000, 'cannot find email input');
driver.findElement(By.css('form#signup button[type=submit]')).click();
  then(function(present) {
    if (present) {

To this:

var signup = nemo.view.addView('signup');

signup.emailTextInputWait(10000, 'cannot find email input');
then(function(present) {
  if (present) {

The nemo-view plugin builds its methods from a JSON locator file like signup.json, used in the above example:

  emailTextInput: {
    locator: 'email',
    type: 'id'
  showSignupButton: {
    locator: 'form#signup button[type=submit]',
    type: 'css'
  passwordTextInput: {
    locator: 'password',
    type: 'id'
… and so on

Also, if you have locators which may differ by country, nemo and nemo-view handle that easily. Simply set a locale property, and modify your locator file:

  termsLinkText: {
    FR: {
      locator: 'termes et conditions',
      type: 'partialLinkText'
    DE: {
      locator: 'Geschäftsbedingungen',
      type: 'partialLinkText'
    default: {
      locator: 'Terms and Conditions',
      type: 'partialLinkText'

Other Plugins

Folks within PayPal have been authoring plugins to access our development databases and services. They aren’t publicly available due to their lack of applicability outside of PayPal. There is a small but growing list of publicly available plugins though, and we hope to see more from the open source community.

The generator-nemo yeoman generator

Layering Nemo onto a krakenjs application couldn’t be easier. Just run the following from within your project’s home directory:

$ npm install -g generator-nemo
$ yo nemo

As long as you have a webdriver binary to match your desired testing browser (see driver setup in the nemo-docs) you are ready to get started with Nemo.

You can also get some popcorn and just watch a screencast of me using generator-nemo:

using generator-nemo from Matt Edelman on Vimeo.

The future of Nemo.js

The future is bright. Strong adoption within PayPal, and a team ramping up to take over support and roadmap from the original author, means we are poised to support our internal as well as external customers well into the future. Of course, being an open source software, the community at-large is welcome to guide the direction of Nemo.js and contribute plugins, etc.

Get started!

Nemo.js home page: Includes several screencasts on how to get started with Nemo.js and its core features

Nemo.js documents repository: How to setup your driver binaries, author plugins, and much more.

Nemo.js example application: An exemplar implementation of Nemo.js + Mocha.js + Grunt.js

Nemo.js yeoman generator: Add Nemo.js to an existing kraken 1.0 application, create views, install plugins