Commit 45a46090 45a46090f91217af89084cbfa81966969691da77 by Nicolas Perriault

Merge remote-tracking branch 'chiefcll/fix-test-timeout' into pr-202

2 parents e524f490 fd71a035
......@@ -1091,7 +1091,7 @@ Casper.prototype.runStep = function runStep(step) {
if (utils.isNumber(this.options.stepTimeout) && this.options.stepTimeout > 0) {
var stepTimeoutCheckInterval = setInterval(function _check(self, start, stepNum) {
if (new Date().getTime() - start > self.options.stepTimeout) {
if (self.step === stepNum) {
if ((self.test.currentSuiteNum + "-" + self.step) === stepNum) {
self.emit('step.timeout');
if (utils.isFunction(self.options.onStepTimeout)) {
self.options.onStepTimeout.call(self, self);
......@@ -1101,7 +1101,7 @@ Casper.prototype.runStep = function runStep(step) {
}
clearInterval(stepTimeoutCheckInterval);
}
}, this.options.stepTimeout, this, new Date().getTime(), this.step);
}, this.options.stepTimeout, this, new Date().getTime(), this.test.currentSuiteNum + "-" + this.step);
}
this.emit('step.start', step);
stepResult = step.call(this, this);
......
......@@ -54,6 +54,7 @@ var Tester = function Tester(casper, options) {
}
this.currentTestFile = null;
this.currentSuiteNum = 0;
this.exporter = require('xunit').create();
this.loadIncludes = {
includes: [],
......@@ -752,17 +753,17 @@ var Tester = function Tester(casper, options) {
this.bar(f("No test file found in %s, aborting.", Array.prototype.slice.call(arguments)), "RED_BAR");
casper.exit(1);
}
var current = 0;
self.currentSuiteNum = 0;
var interval = setInterval(function _check(self) {
if (self.running) {
return;
}
if (current === testFiles.length) {
if (self.currentSuiteNum === testFiles.length) {
self.emit('tests.complete');
clearInterval(interval);
} else {
self.runTest(testFiles[current]);
current++;
self.runTest(testFiles[self.currentSuiteNum]);
self.currentSuiteNum++;
}
}, 100, this);
};
......