Created
July 3, 2012 17:52
-
-
Save rmurphey/3041365 to your computer and use it in GitHub Desktop.
QUnit testling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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