Skip to content

Commit

Permalink
fixed #390 - casper.start().wait(x, fn) makes test hang on fail
Browse files Browse the repository at this point in the history
  • Loading branch information
n1k0 committed May 9, 2013
1 parent 8ee6b14 commit e10a470
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/casper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions modules/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ var Tester = function Tester(casper, options) {
}

[
'wait.error',
'waitFor.timeout.error',
'event.error',
'step.error',
Expand Down

0 comments on commit e10a470

Please sign in to comment.