Skip to content

Instantly share code, notes, and snippets.

@rmurphey
Created July 3, 2012 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmurphey/3041365 to your computer and use it in GitHub Desktop.
Save rmurphey/3041365 to your computer and use it in GitHub Desktop.
QUnit testling
test = require 'testling'
test "qunit", (t) ->
t.createWindow "http://tunnel.browserling.com:xxxxx/", (window, $) ->
intervalId = setInterval ->
result = $ '#qunit-testresult'
tests = $ '#qunit-tests > li'
for test in tests
next if $(test).data 'recorded'
if test.className isnt 'running'
$(test).data 'recorded', true
t.equal test.className, 'pass', $(test).find('strong').text()
if result.text().match /completed/
clearTimeout timeoutId
clearInterval intervalId
failed = parseInt result.find('.failed').text()
t.equal failed, 0
t.end()
, 100
timeoutId = setTimeout ->
clearInterval intervalId
t.log $('body').text()
t.fail "Timeout"
t.end()
, 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment