Sha256: 4e86796c4d2c36edabbbb46bed374316129c32cccaea51f296b8767376744cf8
Contents?: true
Size: 1.15 KB
Versions: 11
Compression:
Stored size: 1.15 KB
Contents
var page = new WebPage() , url = "http://localhost:3000/tests/index.html" var fs = require("fs"); function waitFor(testFx, onReady, timeOutMillis) { var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 10000 , start = new Date().getTime() , condition = false , interval = setInterval(function() { var diff = new Date().getTime() - start if ( (diff < maxtimeOutMillis) && !condition ) { condition = testFx() } else { if (!condition) { console.log("'waitFor()' timeout") phantom.exit(1) } else { console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms"); onReady() clearInterval(interval) } } }, 250) } page.open(url, function (status) { waitFor(function() { var result = page.evaluate(function () { return document.querySelectorAll('.sink-pass').length }) var result2 = page.evaluate(function () { return document.querySelectorAll('.pass').length }) return !!result } , function() { console.log("qwery tests have passed") phantom.exit(0) }) })
Version data entries
11 entries across 11 versions & 1 rubygems