casperjs
Version:
A navigation scripting & testing utility for PhantomJS and SlimerJS
21 lines (15 loc) • 775 B
text/coffeescript
"A small subset of the run.js written in coffeescript"
steps = 0
casper.options.onStepComplete = -> steps++
casper.test.begin "writing async tests in coffeescript", 4, (test) ->
casper.start "tests/site/index.html", ->
test.assertTitle "CasperJS test index", "Casper.start() casper can start itself an open an url"
test.assertEquals ("ul li"), "onetwothree", "Casper.fetchText() can retrieves text contents"
"a[href=\"test.html\"]"
casper.then ->
test.assertTitle "CasperJS test target", "Casper.click() casper can click on a text link"
"a[href=\"form.html\"]"
casper.run ->
test.assertEquals steps, 3, "Casper.options.onStepComplete() is called on step complete"
.onStepComplete = null
.done()