Commit 369dd7d3 369dd7d3fdce842bca2dd004065b4b632a22b0d1 by Nicolas Perriault

Merge pull request #424 from jfparadis/option-retryTimeout

refs #417 - Added options retryTimeout
2 parents 73d31860 61e42819
...@@ -329,6 +329,15 @@ Viewport size, eg. ``{width: 800, height: 600}`` ...@@ -329,6 +329,15 @@ Viewport size, eg. ``{width: 800, height: 600}``
329 329
330 .. index:: timeout 330 .. index:: timeout
331 331
332 ``retryTimeout``
333 -------------------------------------------------------------------------------
334
335 **Type:** ``Number``
336
337 **Default:** ``100``
338
339 Default delay between attempts, for ``wait*`` family functions.
340
332 ``waitTimeout`` 341 ``waitTimeout``
333 ------------------------------------------------------------------------------- 342 -------------------------------------------------------------------------------
334 343
......
...@@ -119,6 +119,7 @@ var Casper = function Casper(options) { ...@@ -119,6 +119,7 @@ var Casper = function Casper(options) {
119 stepTimeout: null, 119 stepTimeout: null,
120 timeout: null, 120 timeout: null,
121 verbose: false, 121 verbose: false,
122 retryTimeout: 100,
122 waitTimeout: 5000 123 waitTimeout: 5000
123 }; 124 };
124 // options 125 // options
...@@ -1368,7 +1369,7 @@ Casper.prototype.run = function run(onComplete, time) { ...@@ -1368,7 +1369,7 @@ Casper.prototype.run = function run(onComplete, time) {
1368 } 1369 }
1369 this.log(f("Running suite: %d step%s", this.steps.length, this.steps.length > 1 ? "s" : ""), "info"); 1370 this.log(f("Running suite: %d step%s", this.steps.length, this.steps.length > 1 ? "s" : ""), "info");
1370 this.emit('run.start'); 1371 this.emit('run.start');
1371 this.checker = setInterval(this.checkStep, (time ? time: 100), this, onComplete); 1372 this.checker = setInterval(this.checkStep, (time ? time: this.options.retryTimeout), this, onComplete);
1372 return this; 1373 return this;
1373 }; 1374 };
1374 1375
...@@ -1905,7 +1906,7 @@ Casper.prototype.waitFor = function waitFor(testFx, then, onTimeout, timeout) { ...@@ -1905,7 +1906,7 @@ Casper.prototype.waitFor = function waitFor(testFx, then, onTimeout, timeout) {
1905 if (then) { 1906 if (then) {
1906 self.then(then); 1907 self.then(then);
1907 } 1908 }
1908 }, 100, this, testFx, timeout, onTimeout); 1909 }, this.options.retryTimeout, this, testFx, timeout, onTimeout);
1909 this.waiters.push(interval); 1910 this.waiters.push(interval);
1910 }); 1911 });
1911 }; 1912 };
......