Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
refactor(waitForAngular): improve error messages when timeouts occur
Browse files Browse the repository at this point in the history
  • Loading branch information
juliemr committed Feb 4, 2014
1 parent 0bcaedb commit 6ae6261
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,24 @@ Protractor.prototype.waitForAngular = function() {
'sync with the page: ' + JSON.stringify(browserErr);
}
}).then(null, function(err) {
if (!/asynchronous script timeout/.test(err.message)) {
var timeout;
if (/asynchronous script timeout/.test(err.message)) {
// Timeout on Chrome
timeout = /[\d\.]*\ seconds/.exec(err.message);
} else if (/Timed out waiting for async script/.test(err.message)) {
// Timeout on Firefox
timeout = /[\d\.]*ms/.exec(err.message);
} else if (/Timed out waiting for an asynchronous script/.test(err.message)) {
// Timeout on Safari
timeout = /[\d\.]*\ ms/.exec(err.message);
}
if (timeout) {
throw 'Timed out waiting for Protractor to synchronize with ' +
'the page after ' + timeout + '. Please see ' +
'https://github.com/angular/protractor/blob/master/docs/faq.md';
} else {
throw err;
}
var timeout = /[\d\.]*\ seconds/.exec(err.message);
throw 'Timed out waiting for Protractor to synchronize with ' +
'the page after ' + timeout;
});
};

Expand Down

0 comments on commit 6ae6261

Please sign in to comment.