Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

MongoHQ/beheaded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Beheaded

Travis CI

What is it?

Headless browser testing tool for node.js using PhantomJS.

  • Promises everywhere (they're neat)
  • PhantomJS (higher fidelity with a browser)

Usage

npm install beheaded

It's recommended you use mocha-as-promised and chai-as-promised since the asynchronous nature of PhantomJS makes the tests look a bit funky.

Example

Feel free to look at the tests

var Browser = require("beheaded");
var server = require("./helpers/server"); // You probably need some server to test.
var assert = require("assert")

describe("Browser", function(){

  var browser = null;
  before(function(){
    browser = new Browser();
  });
  before(server.ready);

  describe("visit", function(){
    before(function(done){
      browser.visit("/", done)
    });

    // The browser instance holds the current page's status
    it("succeeds", function(){
      assert.equal(200, browser.status);
    });

    // `browser.location` returns a promise, everything is async
    it("is on the correct page", function(done){
      browser.location().then(function(location){
        assert.equal(location.href, "http://localhost:3001/");
        done();
      }).fail(done);
    });
  });
});

About

Headless testing for node.js via phantomjs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors