Insanely fast, headless full-stack testing using Node.js
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:
var zombie = require("zombie");
var assert = require("assert");
// Load the page from localhost
zombie.visit("http://localhost:3000/", function (err, browser, status) {
// Fill email, password and submit form
browser.
fill("email", "zombie@underworld.dead").
fill("password", "eat-the-living").
pressButton("Sign Me Up!", function(err, browser, status) {
// Form submitted, new page loaded.
assert.equal(browser.text("title"), "Welcome To Brains Depot");
})
});
Well, that was easy.