protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Disable parallel tests

Open oriweingart opened this issue 12 years ago • 7 comments

Hi, I'm new to Protractor. I have 2 tests which are running in parallel which cause them to fail. My config file has the following attribute: specs : [ 'tests/scenario_1.js', 'tests/scenario_2.js' ],

Is there an attribute to make them running one after another?

Thanks, Ori

oriweingart avatar Jan 14 '14 17:01 oriweingart

Tests always run serially with Protractor, so something else is going on. What makes you think they're running in parallel?

juliemr avatar Jan 14 '14 17:01 juliemr

Actually the expects usually are promises and those ones are asynchronous. I think It is possible Protractor start a test while the last asynchronous expectation is running yet. Right? But i'm curious to know whats going on as well.

2014/1/14 Julie Ralph [email protected]

Tests always run serially with Protractor, so something else is going on. What makes you think they're running in parallel?

— Reply to this email directly or view it on GitHubhttps://github.com/angular/protractor/issues/408#issuecomment-32286207 .

vipper avatar Jan 14 '14 21:01 vipper

No - the way that WebDriverJS handles promises is in a control flow, so it will wait for one promise to resolve before moving on to the next.

juliemr avatar Jan 14 '14 21:01 juliemr

Weird, because I've already done a test to use a setInterval inside a promise to print a message each 1 seconds while 5 seconds and I set the 2 next tests up to print a message outside a promise. The result was the messages in the promise being printed before and after the log message in the next test. Something like that " test1 - promise test2 test1 - promise test1 - promise test3 test1 - promise "

2014/1/14 Julie Ralph [email protected]

No - the way that WebDriverJS handles promises is in a control flow, so it will wait for one promise to resolve before moving on to the next.

— Reply to this email directly or view it on GitHubhttps://github.com/angular/protractor/issues/408#issuecomment-32311186 .

vipper avatar Jan 14 '14 22:01 vipper

If you use setInterval inside your tests then you'll be able to get around the test's attempts to do things in the order they are listed (because it knows about asynchronous things that webdriver does, but not about your setInterval calls). Your test will also complete before your setInterval calls are done, because the way tests know they are finished is that the control flow is empty. Why do you need to do that inside your tests? If you avoid adding your own async stuff things should work as expected.

juliemr avatar Jan 14 '14 22:01 juliemr

I've just done a test to see whats happen. I'm not using this. So my side conversation blurred the main problem from oriweingart. Sorry

vipper avatar Jan 14 '14 22:01 vipper

Hi,

Seems like issue was resolved, both tests had login part outside the describe(..) which was running in parallel. We moved this login part to beforeEach

Thanks for the help.

oriweingart avatar Jan 15 '14 13:01 oriweingart