browser flow control no longer dictates execution order
prior to switching to protractor 2.0, we were able to inject methods that return promises into the execution chain using the browser's control flow
browser.controlFlow().execute(deferred_method);
After 2.0, however, this no longer works. I have attempted to address the controlFlow of protractor.WebDriver, among other things, but am simply having no luck. Is there no longer a way to pass a promise into the control flow to occur before testing begins? Am I going about it wrong? I found some information on the site regarding webdriver's promises, but nothing quite as convenient and straightforward as this.
Right now the answer seems to be that I would now have to make some other deferred method to trigger a protractor related event, and I'm really hoping that is not actually the answer.
I just left a comment on Issue 1991 (maybe related?) because I'm seeing a similar problem. Actions are not always happening in the correct order.
For example, I'm clicking buttons 1, 2, 3, 4 in that order. The order I'm seeing is 2, 1, 3, 4.
This test worked before upgrading to 2.0.
EDIT: I suspect this is from this commit https://github.com/angular/protractor/commit/667111856627b9e81bedb92f3337fb0aba5a139c
I say that because of the commit comments and default timeouts also are not being set. All my browser.waits that don't have a timeout defined are timing out after 30ms.
EDIT2:
Same test, Click order on 1.8.0:
[launcher] Running 1 instances of WebDriver .1 2 3 4 1 2 3 4 1 2 3 4 .
Click order on 2.0.0
[launcher] Running 1 instances of WebDriver .1 2 4 3 4 1 3 2 2 1 3 4 .
I am currently getting around my issue by executing the browser.controlFlow().execute(deferred_method); command inside of an assertion. Not the prettiest, but it works
@brocsk can you share the code you are using to get those results? It would be especially great if you could modify Protractor's example tests to show this issue.
@whtevn I'm not quite sure what you're trying to achieve. What do you mean by 'pass a promise into the control flow to occur before testing begins'. Could using beforeEach or an onPrepare function help?
This should all be fixed in the next version of the selenium-webdriver node module after https://github.com/SeleniumHQ/selenium/issues/444