Skip to content
Browse files

Making the jfComplete not disable future

  • Loading branch information...
1 parent 8cd97fe commit 7b63160df8f74d741c3bf380f26e26d5b5fa59ec @admc committed May 4, 2011
Showing with 26 additions and 17 deletions.
  1. +6 −4 lib/env/sauceEnv.js
  2. +5 −3 lib/env/webdriverEnv.js
  3. +5 −3 lib/env/zombieEnv.js
  4. +4 −4 lib/main.js
  5. +2 −1 static/nemato.js
  6. +4 −2 test/test.firefox.jfcomplete.js
View
10 lib/env/sauceEnv.js
@@ -25,17 +25,19 @@ sauceEnv.prototype.init = function(b) {
})
//Poll web driver for complete for JS tests
_this.state = setInterval(function() {
- if (_this.live && _this.tid && !_this.jfComplete) {
+ if (_this.live && _this.tid) {
_this.target.exec("window.jfComplete", function(body) {
if (body == true) {
- _this.jfComplete = true;
var endTime = Math.round(new Date().getTime() / 1000);
var runTime = endTime - _this.startTime;
- _this.emit("complete", {result:"complete", runTime:runTime});
+ if (!_this.jfComplete) {
+ _this.emit("complete", {result:"complete", runTime:runTime});
+ }
+ _this.jfComplete = true;
}
})
}
- }, 1000);
+ }, 1000);
}
});
};
View
8 lib/env/webdriverEnv.js
@@ -24,13 +24,15 @@ webdriverEnv.prototype.init = function(b) {
})
//Poll web driver for complete for JS tests
_this.state = setInterval(function() {
- if (_this.live && _this.tid && !_this.jfComplete) {
+ if (_this.live && _this.tid) {
_this.target.exec("window.jfComplete", function(body) {
if (body == true) {
- _this.jfComplete = true;
var endTime = Math.round(new Date().getTime() / 1000);
var runTime = endTime - _this.startTime;
- _this.emit("complete", {result:"complete", runTime:runTime});
+ if (!_this.jfComplete) {
+ _this.emit("complete", {result:"complete", runTime:runTime});
+ }
+ _this.jfComplete = true;
}
})
}
View
8 lib/env/zombieEnv.js
@@ -20,13 +20,15 @@ zombieEnv.prototype.init = function(b) {
}, 1000);
_this.state = setInterval(function() {
- if (_this.live && _this.tid && !_this.jfComplete) {
+ if (_this.live && _this.tid) {
var ret = _this.target.evaluate("window.jfComplete");
if (ret == true) {
- _this.jfComplete = true;
var endTime = Math.round(new Date().getTime() / 1000);
var runTime = endTime - _this.startTime;
- _this.emit("complete", {result:"complete", runTime:runTime});
+ if (!_this.jfComplete) {
+ _this.emit("complete", {result:"complete", runTime:runTime});
+ }
+ _this.jfComplete = true;
}
}
}, 1000);
View
8 lib/main.js
@@ -182,7 +182,7 @@ process.on('exit', function () {
}
});
-// process.on('uncaughtException', function (err) {
-// _this.log.push(['Caught exception: ' + err]);
-// _this.log.push([err.stack]);
-// });
+process.on('uncaughtException', function (err) {
+ _this.log.push(['Caught exception: ' + err]);
+ _this.log.push([err.stack]);
+});
View
3 static/nemato.js
@@ -22,9 +22,10 @@ function waitForJellyMsg() {
type: 'POST',
url: '/_jellyfish/complete',
data: JSON.stringify({result:true}),
- success: function(o) { user = null; },
+ success: function(o) {},
dataType: 'json'
});
+ window.jfComplete = false;
}
$jfQ.ajax({
View
6 test/test.firefox.jfcomplete.js
@@ -9,8 +9,10 @@ firefox.on('result', function(res) {
firefox.on('complete', function(res) {
console.log(firefox.name + ' : '+firefox.tid + ' - \x1b[33m%s\x1b[0m', JSON.stringify(res));
- firefox.stop(function() {
- setTimeout(process.exit, 2000);
+ firefox.js("document.location.href", function() {
+ firefox.stop(function() {
+ setTimeout(process.exit, 2000);
+ })
})
});

0 comments on commit 7b63160

Please sign in to comment.
Something went wrong with that request. Please try again.