assaf /zombie

Insanely fast, full-stack, headless browser testing using node.js

★ 5,621⑂ 506👁 3⑃ 348● 881▤ 1
JavaScriptMITCreated 2010-12-05zombie.js.org/
Download: 6.1.4zombie-6.1.4 ↓6.1.42018-11-27
+0
Daily
5,621
stars
506
forks
3
watchers
348
prs
881
issues
1
releases

README

Zombie.js
 Insanely fast, headless full-stack testing using Node.js









 The Bite

If you're going to write an insanely fast, headless browser, how can you not
call it Zombie?  Zombie it is.

Zombie.js is a lightweight framework for testing client-side JavaScript code in
a simulated environment.  No browser required.

Let's try to sign up to a page and see what happens:

js
const Browser = require('zombie');

// We're going to make requests to http://example.com/signup
// Which will be routed to our test server localhost:3000
Browser.localhost('example.com', 3000);

describe('User visits signup page', function() {

  const browser = new Browser();

  before(function(done) {
    browser.visit('/signup', done);
  });

  describe('submits form', function() {

    before(function(done) {
      browser.fill('email', '[email protected]')
      .then(() = browser.fill('password', 'eat-the-living'))
      .then(() = browser.pressButton('Sign Me Up!', done));
    });

    it('should be successful', function() {
      browser.assert.success();
    });

    it('should see welcome page', function() {
      browser.assert.text('title', 'Welcome To Brains Depot');
    });
  });
});


This example uses the Mocha testing
framework, but Zombie will work with other testing frameworks.  Since Mocha
supports promises, we can also write the test like this:

js
const Browser = require('zombie');

// We're going to make requests to http://example.com/signup
// Which will be routed to our test server localhost:3000
Browser.localhost('example.com', 3000);

describe('User visits signup page', function() {

  const browser = new Browser();

  before(function() {
    return browser.visit('/signup');
  });

  describe('submits form', function() {

    before(function() {
      return browser.fill('email', '[email protected]')
      .then(() = browser.fill('password', 'eat-the-living'))
      .then(() = browser.pressButton('Sign Me Up!'));
    });

    it('should be successful', function() {
      browser.assert.success();
    });

    it('should see welcome page', function() {
      browser.assert.text('title', 'Welcome To Brains Depot');
    });
  });

});


Well, that was easy.


WARNING:  Crawling untrusted web pages with Zombie.js is not safe.


 Table of Contents

 Installing
 Browser
 Assertions
 Cookies
 Tabs
 Debugging
 Events
 Resources
 Pipeline




 Installing

To install Zombie.js you will need Node.js:

bash
$ npm install zombie --save-dev




 Browser

 browser.assert

Methods for making assertions against the browser, such as
browser.assert.element('.foo').

See Assertions for detailed discussion.

 browser.referer

You can use this to set the HTTP Referer header.

 browser.resources

Access to history of retrieved resources.  See Resources for
detailed discussion.

 browser.pipeline

Access to the pipeline for making requests and processing responses.  Use this
to add new request/response handlers the pipeline for a single browser instance,
or 

Top issues

Latest release

6.1.4 6.1.4 2018-11-27
Updated dependencies

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON