Satisfy is a minimalistic browser testing utility designed to work with any test framework, oriented only around CSS selectors, designed for speed both of test writing and test execution.
For development, run the tests in a headless WebKit browser. For deployments, run them in the cloud in all browsers with Selenium.
It's the expect.js of browser / acceptance testing.
satisfy('localhost')
.click('li#home a')
.expect('h1:contains(Home)')
.click('li#test a')
.expect('h1:contains(Test)')
With the mocha test framework:
var satisfy = require('satisfy');
describe('learnboost homepage', function () {
it('should work', function (done) {
satisfy('http://learnboost.com')
.expect('a:contains(For Schools)')
.run(done)
});
});
Then run it:
$ mocha -t 0 test.js
:contains for text matching.satisfy('localhost')
.click('li#home a')
.expect('h1:contains(Home)')
satisfy('localhost')
.click('#add-classroom')
.expect('#add-classroom-dialog', 7000) // override expect timeout
.fill('input[name=classroom-name]', 'My classroom')
.fill({ 'textarea': 'Something' })
.click('#add-classroom input[type=submit]')
.expect('body:not(#add-classroom)')
You can pass options to specific satisfy instances:
satisfy('http://host.com:port/path', { options })
adaptor String
webkit-server or soda (selenium/sauce labs).webkit-servertimeout Number
'2m' or '10s' are supported.10000webkit-server Object
poll Number|String
webkit-server mode.'2m' or '10s' are supported.50soda Object
sauce Boolean
falsehost String
localhostport Number
4444browser String
firefox.autorun Boolean
run is not called, it calls it automatically for youtrueIf you wanted to pass options to all instances, you can implement that in userland easily by defining your own helper method:
function mytest (url) {
return satisfy(url, { default options });
}