Fix test status timeouts when running multiple suites
Showing
2 changed files
with
7 additions
and
6 deletions
... | @@ -1087,7 +1087,7 @@ Casper.prototype.runStep = function runStep(step) { | ... | @@ -1087,7 +1087,7 @@ Casper.prototype.runStep = function runStep(step) { |
1087 | if (utils.isNumber(this.options.stepTimeout) && this.options.stepTimeout > 0) { | 1087 | if (utils.isNumber(this.options.stepTimeout) && this.options.stepTimeout > 0) { |
1088 | var stepTimeoutCheckInterval = setInterval(function _check(self, start, stepNum) { | 1088 | var stepTimeoutCheckInterval = setInterval(function _check(self, start, stepNum) { |
1089 | if (new Date().getTime() - start > self.options.stepTimeout) { | 1089 | if (new Date().getTime() - start > self.options.stepTimeout) { |
1090 | if (self.step === stepNum) { | 1090 | if ((self.test.currentSuiteNum + "-" + self.step) === stepNum) { |
1091 | self.emit('step.timeout'); | 1091 | self.emit('step.timeout'); |
1092 | if (utils.isFunction(self.options.onStepTimeout)) { | 1092 | if (utils.isFunction(self.options.onStepTimeout)) { |
1093 | self.options.onStepTimeout.call(self, self); | 1093 | self.options.onStepTimeout.call(self, self); |
... | @@ -1097,7 +1097,7 @@ Casper.prototype.runStep = function runStep(step) { | ... | @@ -1097,7 +1097,7 @@ Casper.prototype.runStep = function runStep(step) { |
1097 | } | 1097 | } |
1098 | clearInterval(stepTimeoutCheckInterval); | 1098 | clearInterval(stepTimeoutCheckInterval); |
1099 | } | 1099 | } |
1100 | }, this.options.stepTimeout, this, new Date().getTime(), this.step); | 1100 | }, this.options.stepTimeout, this, new Date().getTime(), this.test.currentSuiteNum + "-" + this.step); |
1101 | } | 1101 | } |
1102 | this.emit('step.start', step); | 1102 | this.emit('step.start', step); |
1103 | stepResult = step.call(this, this); | 1103 | 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.includes = []; | 59 | this.includes = []; |
59 | this.running = false; | 60 | this.running = false; |
... | @@ -738,17 +739,17 @@ var Tester = function Tester(casper, options) { | ... | @@ -738,17 +739,17 @@ var Tester = function Tester(casper, options) { |
738 | this.bar(f("No test file found in %s, aborting.", Array.prototype.slice.call(arguments)), "RED_BAR"); | 739 | this.bar(f("No test file found in %s, aborting.", Array.prototype.slice.call(arguments)), "RED_BAR"); |
739 | casper.exit(1); | 740 | casper.exit(1); |
740 | } | 741 | } |
741 | var current = 0; | 742 | self.currentSuiteNum = 0; |
742 | var interval = setInterval(function _check(self) { | 743 | var interval = setInterval(function _check(self) { |
743 | if (self.running) { | 744 | if (self.running) { |
744 | return; | 745 | return; |
745 | } | 746 | } |
746 | if (current === testFiles.length) { | 747 | if (self.currentSuiteNum === testFiles.length) { |
747 | self.emit('tests.complete'); | 748 | self.emit('tests.complete'); |
748 | clearInterval(interval); | 749 | clearInterval(interval); |
749 | } else { | 750 | } else { |
750 | self.runTest(testFiles[current]); | 751 | self.runTest(testFiles[self.currentSuiteNum]); |
751 | current++; | 752 | self.currentSuiteNum++; |
752 | } | 753 | } |
753 | }, 100, this); | 754 | }, 100, this); |
754 | }; | 755 | }; | ... | ... |
-
Please register or sign in to post a comment