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) { ...@@ -1091,7 +1091,7 @@ Casper.prototype.runStep = function runStep(step) {
1091 if (utils.isNumber(this.options.stepTimeout) && this.options.stepTimeout > 0) { 1091 if (utils.isNumber(this.options.stepTimeout) && this.options.stepTimeout > 0) {
1092 var stepTimeoutCheckInterval = setInterval(function _check(self, start, stepNum) { 1092 var stepTimeoutCheckInterval = setInterval(function _check(self, start, stepNum) {
1093 if (new Date().getTime() - start > self.options.stepTimeout) { 1093 if (new Date().getTime() - start > self.options.stepTimeout) {
1094 if (self.step === stepNum) { 1094 if ((self.test.currentSuiteNum + "-" + self.step) === stepNum) {
1095 self.emit('step.timeout'); 1095 self.emit('step.timeout');
1096 if (utils.isFunction(self.options.onStepTimeout)) { 1096 if (utils.isFunction(self.options.onStepTimeout)) {
1097 self.options.onStepTimeout.call(self, self); 1097 self.options.onStepTimeout.call(self, self);
...@@ -1101,7 +1101,7 @@ Casper.prototype.runStep = function runStep(step) { ...@@ -1101,7 +1101,7 @@ Casper.prototype.runStep = function runStep(step) {
1101 } 1101 }
1102 clearInterval(stepTimeoutCheckInterval); 1102 clearInterval(stepTimeoutCheckInterval);
1103 } 1103 }
1104 }, this.options.stepTimeout, this, new Date().getTime(), this.step); 1104 }, this.options.stepTimeout, this, new Date().getTime(), this.test.currentSuiteNum + "-" + this.step);
1105 } 1105 }
1106 this.emit('step.start', step); 1106 this.emit('step.start', step);
1107 stepResult = step.call(this, this); 1107 stepResult = step.call(this, this);
......
...@@ -54,6 +54,7 @@ var Tester = function Tester(casper, options) { ...@@ -54,6 +54,7 @@ var Tester = function Tester(casper, options) {
54 } 54 }
55 55
56 this.currentTestFile = null; 56 this.currentTestFile = null;
57 this.currentSuiteNum = 0;
57 this.exporter = require('xunit').create(); 58 this.exporter = require('xunit').create();
58 this.loadIncludes = { 59 this.loadIncludes = {
59 includes: [], 60 includes: [],
...@@ -752,17 +753,17 @@ var Tester = function Tester(casper, options) { ...@@ -752,17 +753,17 @@ var Tester = function Tester(casper, options) {
752 this.bar(f("No test file found in %s, aborting.", Array.prototype.slice.call(arguments)), "RED_BAR"); 753 this.bar(f("No test file found in %s, aborting.", Array.prototype.slice.call(arguments)), "RED_BAR");
753 casper.exit(1); 754 casper.exit(1);
754 } 755 }
755 var current = 0; 756 self.currentSuiteNum = 0;
756 var interval = setInterval(function _check(self) { 757 var interval = setInterval(function _check(self) {
757 if (self.running) { 758 if (self.running) {
758 return; 759 return;
759 } 760 }
760 if (current === testFiles.length) { 761 if (self.currentSuiteNum === testFiles.length) {
761 self.emit('tests.complete'); 762 self.emit('tests.complete');
762 clearInterval(interval); 763 clearInterval(interval);
763 } else { 764 } else {
764 self.runTest(testFiles[current]); 765 self.runTest(testFiles[self.currentSuiteNum]);
765 current++; 766 self.currentSuiteNum++;
766 } 767 }
767 }, 100, this); 768 }, 100, this);
768 }; 769 };
......