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

Commit

Permalink
feat(api): optional timeout on Protractor.get
Browse files Browse the repository at this point in the history
  • Loading branch information
David Simon authored and juliemr committed Nov 7, 2013
1 parent d383770 commit bac36d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,17 +471,20 @@ Protractor.prototype.clearMockModules = function() {
*
* Navigate to the given destination and loads mock modules before
* Angular.
*
* Optional 2nd argument: Number of seconds to wait for Angular to start.
*/
Protractor.prototype.get = function(destination) {
Protractor.prototype.get = function(destination, timeout) {
destination = url.resolve(this.baseUrl, destination);
timeout = timeout || 10;

this.driver.get('about:blank');
this.driver.executeScript(
'window.name = "' + DEFER_LABEL + '" + window.name;' +
'window.location.href = "' + destination + '"');

// Make sure the page is an Angular page.
this.driver.executeAsyncScript(clientSideScripts.testForAngular, 10).
this.driver.executeAsyncScript(clientSideScripts.testForAngular, timeout).
then(function(arr) {
var hasAngular = arr[0];
if (!hasAngular) {
Expand Down

0 comments on commit bac36d2

Please sign in to comment.