Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Commit

Permalink
migrated coffee tests to new testing format
Browse files Browse the repository at this point in the history
  • Loading branch information
n1k0 committed Dec 28, 2012
1 parent ccabfa8 commit 6611bc2
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/suites/coffee.coffee
Expand Up @@ -4,16 +4,17 @@ steps = 0

casper.options.onStepComplete = -> steps++

casper.start "tests/site/index.html", ->
@test.assertTitle "CasperJS test index", "Casper.start() casper can start itself an open an url"
@test.assertEquals @fetchText("ul li"), "onetwothree", "Casper.fetchText() can retrieves text contents"
@click "a[href=\"test.html\"]"
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 @fetchText("ul li"), "onetwothree", "Casper.fetchText() can retrieves text contents"
@click "a[href=\"test.html\"]"

casper.then ->
@test.assertTitle "CasperJS test target", "Casper.click() casper can click on a text link"
@click "a[href=\"form.html\"]"
casper.then ->
test.assertTitle "CasperJS test target", "Casper.click() casper can click on a text link"
@click "a[href=\"form.html\"]"

casper.run ->
@test.assertEquals steps, 3, "Casper.options.onStepComplete() is called on step complete"
@options.onStepComplete = null
@test.done(4)
casper.run ->
test.assertEquals steps, 3, "Casper.options.onStepComplete() is called on step complete"
@options.onStepComplete = null
@test.done()

0 comments on commit 6611bc2

Please sign in to comment.