multiCapabilities doesn't invoke parallel instances of WebDriver
Bug report Using Protractor = 6.0.0-beta, multiCapabilities execute individual captibilities in sequential order rather than running the capabilities in parallel.
- Node Version:
v10.15.1 - Protractor Version:
6.0.0-beta - Selenium Standalone:
3.141.59 - Browser(s):
Chrome 72/ Firefox 64 - Chrome Driver:
2.46 - Operating System and Version
Mac OS 10.14.2
- Your protractor configuration file // conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
multiCapabilities: [{
browserName: 'chrome',
specs: ['spec.js'],
}, {
browserName: 'chrome',
specs: ['spec.js'],
}]
};
- A relevant example test // spec.js
describe('Protractor Demo App', () => {
it('should have a title', async () => {
await browser.get('http://juliemr.github.io/protractor-demo/');
await browser.driver.sleep(5000);
expect(await browser.getTitle()).toEqual('Super Calculator');
});
});
- Output from running the test
➜ standard git:(vr-async-await) ✗ sudo ./node_modules/protractor/bin/protractor config.js
.[13:10:24] I/testLogger -
------------------------------------
[13:10:24] I/testLogger - [chrome #01] PID: 11283
[chrome #01] Specs: /Users/vr/Documents/new-async-await/kb-automation/standard/spec.js
[chrome #01]
[chrome #01] [13:10:13] I/local - Starting selenium standalone server...
[chrome #01] [13:10:14] I/local - Selenium standalone server started at http://192.168.0.11:56758/wd/hub
[chrome #01] DEPRECATION: Setting specFilter directly on Env is deprecated, please use the specFilter option in `configure`
[chrome #01] Randomized with seed 98392
[chrome #01] Started
[chrome #01] .
[chrome #01]
[chrome #01]
[chrome #01] 1 spec, 0 failures
[chrome #01] Finished in 6.914 seconds
[chrome #01] Randomized with seed 98392 (jasmine --random=true --seed=98392)
[13:10:24] I/testLogger -
.[13:10:34] I/testLogger -
------------------------------------
[13:10:34] I/testLogger - [chrome #11] PID: 11309
[chrome #11] Specs: /Users/vr/Documents/new-async-await/kb-automation/standard/spec.js
[chrome #11]
[chrome #11] [13:10:24] I/local - Starting selenium standalone server...
[chrome #11] [13:10:25] I/local - Selenium standalone server started at http://192.168.0.11:62938/wd/hub
[chrome #11] DEPRECATION: Setting specFilter directly on Env is deprecated, please use the specFilter option in `configure`
[chrome #11] Randomized with seed 38299
[chrome #11] Started
[chrome #11] .
[chrome #11]
[chrome #11]
[chrome #11] 1 spec, 0 failures
[chrome #11] Finished in 6.914 seconds
[chrome #11] Randomized with seed 38299 (jasmine --random=true --seed=38299)
[13:10:34] I/testLogger -
[13:10:34] I/launcher - 0 instance(s) of WebDriver still running
[13:10:34] I/launcher - 0 instance(s) of WebDriver still running
[13:10:34] I/launcher - Running 0 instances of WebDriver
[13:10:34] I/launcher - chrome #01 passed
[13:10:34] I/launcher - chrome #11 passed
Able to reproduce this issue only in Protector 6.0.0-beta
Start using Cypress
I don't see Cypress as a viable alternative atm. It only supports Chrome and doesn't work with BrowserStack. Also, it requires a paid license.
@heathkit @cnishina @juliemr
Appreciate if you could provide some insight into the future of Protractor. Its' been more than 6 months since we have any update on Protractor 6.0. If the plan is to abandon protractor, kindly let us know so that we have enough room to look for the alternatives.
While removing q from Protractor, I did run into this (which might be suspect): https://github.com/angular/protractor/blob/master/lib/launcher.ts#L231
My problem with this was we called a method that returned a Promise without awaiting the promise. I ended up putting an await there. This might not be it... It might be:
https://github.com/angular/protractor/blob/master/lib/launcher.ts#L250
here you wait for every runner, sequentially in the loop. now:
for (let i = 0; i < maxConcurrentTasks; ++i) {
await createNextTaskRunner();
}
should be:
const runners = [];
for (let i = 0; i < maxConcurrentTasks; ++i) {
runners.push(createNextTaskRunner());
}
await Promise.all(runners); // wait for all, running simultaneously
and Promise((resolve) => ...) (https://github.com/angular/protractor/blob/master/lib/launcher.ts#L219)
should be just async function, so remove the line. Otherwise, no resolve() happens at the end of the method with outstanding tasks https://github.com/angular/protractor/blob/master/lib/launcher.ts#L235
@heathkit @cnishina @juliemr no longer work on Protractor, we can't speak to future plans. We continue to use Protractor internally, and there's a lot of other projects at Google that depend on it.
The Angular team would like to invest more in Protractor, and will have time now that they've landed Ivy. @IgorMinar will be better able to answer questions about the future of Protractor.
Is someone fixing this ? I need it badly. Our tests serially takes more than an hour. Please help.