Created
March 14, 2013 17:43
-
-
Save xcambar/5163456 to your computer and use it in GitHub Desktop.
An example for Clouseau
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clouseau = require('clouseau-js'); | |
function alertCheck(page) { | |
var dfd = this; // `this` is a deferred! \o/ | |
page.onAlert = function (txt) { | |
if (txt !== 'MY EXPECTED MESSAGE') { | |
return dfd.reject(new Error("Unexpected message: " + txt)); | |
} | |
return dfd.resolve(page); | |
}; | |
}; | |
var check1 = clouseau.addCheckpoint(alertCheck, 10000); // timeout in ms | |
clouseau.start("http://your.domain.com/end/point") | |
.then(check1) | |
.then(function () { console.log('OK'); }, function () { console.log('Fail'); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment