-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(browser.ready): make browser.ready
wait for all async setup work
#4015
Conversation
this.resetUrl = 'about:blank'; | ||
} | ||
}); | ||
this.ready = this.driver.controlFlow() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this 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() |
There was a problem hiding this comment.
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()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Closes #3900