protractor icon indicating copy to clipboard operation
protractor copied to clipboard

browser flow control no longer dictates execution order

Open whtevn opened this issue 11 years ago • 5 comments

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.

whtevn avatar Apr 07 '15 17:04 whtevn

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 .

brocsk avatar Apr 07 '15 18:04 brocsk

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

whtevn avatar Apr 08 '15 15:04 whtevn

@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.

juliemr avatar Apr 08 '15 20:04 juliemr

@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?

juliemr avatar Apr 08 '15 20:04 juliemr

This should all be fixed in the next version of the selenium-webdriver node module after https://github.com/SeleniumHQ/selenium/issues/444

juliemr avatar Apr 24 '15 16:04 juliemr