Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
zombiejs example
var vows = require('vows')
var zombie = require('zombie')
var assert = require('assert')
vows.describe('TEST').addBatch({
'access homepage' : {
topic: function() {
zombie.visit('http://www.example.com/', this.callback)
},
'title: Example': function(browser) {
assert.equal(browser.evaluate('document.title'), 'Example')
},
'login': {
topic: function(browser) {
browser.fill('user_id', 'testuser')
.fill('user_password', 'testpassword')
.pressButton('Login', this.callback)
},
'redirected': function(browser) {
assert.equal(browser.redirected, true)
},
'URL: /top': function(browser) {
assert.match(browser.location._url.href, 'http://www.example.com/top')
},
'title: Top Page': function(browser) {
assert.equal(browser.evaluate('document.title'), 'Top Page')
},
'click test': {
topic: function(browser) {
browser.clickLink('TEST', this.callback)
},
'URL: /test': function(browser) {
assert.match(browser.location._url.href, 'http://www.example.com/test')
},
'title: TEST': function(browser) {
assert.equal(browser.evaluate('document.title'), 'TEST')
},
'click button': {
browser.fire('click', browser.query('Click Me'), this.callback)
},
'TEST link came out': function(browser) {
assert.equal(browser.text('a[href=http://test.example.com/]'), 'TEST')
}
}
}
}
}).export(module)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment