Commit e10a4704 e10a47049dae7b35486855e3f2763eca0b553e1c by Nicolas Perriault

fixed #390 - casper.start().wait(x, fn) makes test hang on fail

1 parent 8ee6b142
......@@ -1946,7 +1946,11 @@ Casper.prototype.wait = function wait(timeout, then) {
setTimeout(function _check(self) {
self.log(f("wait() finished waiting for %dms.", timeout), "info");
if (then) {
then.call(self, self);
try {
then.call(self, self);
} catch (error) {
self.emit('wait.error', error);
}
}
self.waitDone();
}, timeout, this);
......
......@@ -191,6 +191,7 @@ var Tester = function Tester(casper, options) {
}
[
'wait.error',
'waitFor.timeout.error',
'event.error',
'step.error',
......