-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(browser): chain promises in browser.get
#4017
Conversation
@@ -837,79 +848,85 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver { | |||
return 'Protractor.get(' + destination + ') - ' + str; | |||
}; | |||
|
|||
let retPromise: wdpromise.Promise<any>; | |||
let then = (fn: () => wdpromise.Promise<any>) => { |
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 is clever, but naming it then
is a little confusing for me, since it makes it hard to distinguish chaining from calling .then
on a promise at a glance. Maybe just chainThenables
, andThen
, or something like that?
Also, why do we need this? Why wouldn't regular promise chaining work?
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.
Regular promise chain would work, but it's tricky, since the first promise could be one of three different ones, and you want to prematurely exit if ignoreSynchronization
is on. In the light of day though, if I move the ignoreSynchronization
case up, and start the synchronized case with a blank execute, I should be able to make promise chaining work fine.
Looking at the log for the test failure, it's not the alert timeout issue. It looks like disabling synchronization in get() when using blocking proxy is broken. |
this.driver.get(destination); | ||
return this.driver.controlFlow().execute(() => this.plugins_.onPageLoad()).then(() => {}); | ||
then(() => this.driver.get(destination)); | ||
return then(() => this.driver.controlFlow().execute(() => this.plugins_.onPageLoad())) |
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.
Move the bpClient.setSynchronization call after this test. I'm not sure, but I think Circle is failing because waitForAngular gets turned off in BP but never gets restored if get() returns from ehre.
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.
Based on my debugging last night, I don't think that's the problem. But I'll move it anyway
lib/browser.ts
and return promise …lib/browser.ts
and return promise …
lib/browser.ts
and return promise …browser.get
Since it appears to be only the |
Looking through the tcpdump from the earlier failure, and it looks like bp.setSynchronization(true) is getting called before addBaseMockModules. BP then runs the wait script, which fails because angular isn't on the page. Not totally sure what's going on, but it is looking like there was some kind of ordering issue earlier. |
browser.get
browser.get
@mgiambalvo @juliemr it appears the problem was solved by rebasing, whatever it was |
Part of #3904