satisfy.js
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.
How to use
Mocha
With the mocha test framework:
var satisfy = ; ;
Then run it:
$ mocha -t 0 test.js
Features
- Fast. The default adaptor is the fastest available.
- Test-framework agnostic, but best with the wonderful mocha
- No APIs to learn. Only based on CSS selectors.
- Extended CSS selectors thanks to Sizzle like
:contains
for text matching. - Adaptor based
- webkit-server (headless webkit)
- soda (selenium)
Examples
Following a link
Filling a form
// override expect timeout
Options
You can pass options to specific satisfy instances:
adaptor
Stringwebkit-server
orsoda
(selenium/sauce labs).- Defaults to
webkit-server
timeout
Number- Timeout after which we considered the test failed if a CSS selector expectation is not met.
- Strings like
'2m'
or'10s'
are supported. - Defaults to
10000
webkit-server
Object- Hash of options for the webkit-server adaptor.
- Options
poll
Number|String- How often we poll the DOM for a certain selector match.
- Only applies for the
webkit-server
mode. - Strings like
'2m'
or'10s'
are supported. - Defaults to
50
soda
Object- Hash of options for the soda adaptor.
- Options
sauce
Boolean- Whether to use sauce labs.
- Defaults to
false
host
String- Selenium host.
- Defaults to
localhost
port
Number- Selenium port
- Defaults to
4444
browser
String- Browser to test on.
- Defaults to
firefox
.
autorun
Boolean- If
run
is not called, it calls it automatically for you - Defaults to
true
- If
Global options
If you wanted to pass options to all instances, you can implement that in userland easily by defining your own helper method:
{ return ;}