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

feat(browser.ready): make browser.ready wait for all async setup work #4015

Merged
merged 1 commit into from
Jan 26, 2017

Conversation

sjelin
Copy link
Contributor

@sjelin sjelin commented Jan 26, 2017

Closes #3900

this.resetUrl = 'about:blank';
}
});
this.ready = this.driver.controlFlow()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the wrapping in execute here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.driver.getSession() is not necessarily a promise which is on the control flow, so this is needed to ensure that the other stuff we stick onto browser.ready is on the control flow

browser_.driver.getCurrentUrl().then((url: string) => {
newBrowser.get(url);
});
newBrowser.ready = wdpromise.all([newBrowser.ready, browser_.driver.getCurrentUrl()])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems simpler as:

newBrowser.ready = newBrowser.ready().then(() => {
  return browser_.driver.getCurrentUrl();
}).then((url) => {
  return newBrowser.get(url);
}).then(() => {
  return newBrowser;
});

instead of messing with the promise.all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

@sjelin sjelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juliemr all comments addressed

this.resetUrl = 'about:blank';
}
});
this.ready = this.driver.controlFlow()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.driver.getSession() is not necessarily a promise which is on the control flow, so this is needed to ensure that the other stuff we stick onto browser.ready is on the control flow

browser_.driver.getCurrentUrl().then((url: string) => {
newBrowser.get(url);
});
newBrowser.ready = wdpromise.all([newBrowser.ready, browser_.driver.getCurrentUrl()])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants