Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
964 views
in Technique[技术] by (71.8m points)

angularjs - Running e2e tests using Protractor multiCapabilities config but limit max Webdriver instances

Context

I am trying the brand new Protractor 0.19.0 with the multiCapabilities config option. It is actually working as described in the docs :

  1. It makes running tests on multiple browsers easier (no need for grunt, nor script, only 1 config file).
  2. It makes tests running in parallel

The second point is problematic for me. One of my app doesn't handle multiple connection to the data, implying that the tests fail.

My question is:

Is it possible to limit the maximum number of instances of Webdriver in order to disable parallel testing for this app?

What I have tried

I've found in Selenium Webdriverjs Grid2 wiki that there's a maxSession parameter that would perfectly fit to my case! But I tried to add it in my Protractor config, without success.

maxSession is also in the Desired Capabilities. Anyone knows if it's working yet?

Here is the link to the multiCapabilities PR topic, I left a comment there.

If you need more info, feel free to ask :)

Thanks in advance!!

EDIT: Dedicated GitHub issue

EDIT2: I recently tried to add seleniumArgs: ['-maxSession=1'] to my Protractor config, unfortunaltely this doesn't work too...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Implemented in this commit and released in 0.24.0 (See Protractor changelog).

You need to add a maxSessions option into your protractor config file with a value >=1 (otherwise it is considered as unlimited).

protractor.config.js example:

exports.config = {
  seleniumAddress: 'http://127.0.0.1:4444/wd/hub',

  specs: [
    '../e2e/**/*.js'
  ],

  multiCapabilities: [
    {'browserName': 'chrome'},
    {'browserName': 'firefox'},
    {'browserName': 'phantomjs'}
  ],

  maxSessions: 1,

  baseUrl: 'http://localhost:8000'
};

Tested and working as expected for my case.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...