Skip to content

Commit

Permalink
increase length of waitfor timeout for phantom
Browse files Browse the repository at this point in the history
  • Loading branch information
fat committed Apr 23, 2012
1 parent 091a97c commit c896a18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/tests/phantom.js
Expand Up @@ -2,15 +2,15 @@
// Adapted from Modernizr

function waitFor(testFx, onReady, timeOutMillis) {
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3001 //< Default Max Timout is 3s
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 5001 //< Default Max Timout is 5s
, start = new Date().getTime()
, condition = false
, interval = setInterval(function() {
, interval = setInterval(function () {
if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) {
// If not time-out yet and condition not yet fulfilled
condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()) //< defensive code
} else {
if(!condition) {
if (!condition) {
// If condition still not fulfilled (timeout but condition is 'false')
console.log("'waitFor()' timeout")
phantom.exit(1)
Expand Down
1 change: 1 addition & 0 deletions js/tests/pid.txt
@@ -0,0 +1 @@
1520

0 comments on commit c896a18

Please sign in to comment.