Commit fd71a035 fd71a0356b2a80625b03a6e4b6d647e0b5961b11 by Chris Lorenzo

Fix test status timeouts when running multiple suites

1 parent 5ed461e8
......@@ -1087,7 +1087,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);
......@@ -1097,7 +1097,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.includes = [];
this.running = false;
......@@ -738,17 +739,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);
};
......