How To Run MultiCapabilities Reading Configuration Parameters From The Configuration File

I have one file of config which runs tests in one browser using capabilities. Now I have created one more separate config file which contains multiCapabilites and will run same tests in multiple browsers.

I want to optimize configs so I second config file I write multiCapabilities for first config and used

delete firstConfig['capabilities'];

to ignore the capabilities from first config and use all other params from firstConfig and use multiCapabilities from 2nd config and run.

Expected result: params in configs should not be duplicated in both configs, only multiCapabilities is the change, rest of config is same.



Use a base configuration file

Having a base configuration file and another file that extends from it might be a better approach. For this example, we will look at my base configuration file:

var env = require('./environment');

// This is the configuration for a smoke test for an Angular TypeScript application.
exports.config = {
  seleniumAddress: env.seleniumAddress,

  framework: 'jasmine',

  specs: [

  capabilities: env.capabilities,

  baseUrl: env.baseUrl,
  allScriptsTimeout: 120000,
  getPageTimeout: 120000,
  jasmineNodeOpts: {
    defaultTimeoutInterval: 120000

Create a second config from the base config

From there, we did something similar to your question where we removed the capabilities and added multicapabilities. ( In addition, since we were running on Sauce Labs, we also decided to increase our timeouts.

exports.config = require('./angular2Conf.js').config;

exports.config.sauceUser = process.env.SAUCE_USERNAME;
exports.config.sauceKey = process.env.SAUCE_ACCESS_KEY;
exports.config.seleniumAddress = undefined;

// TODO: add in firefox when issue #2784 is fixed
exports.config.multiCapabilities = [{
    'browserName': 'chrome',
    'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
    'build': process.env.TRAVIS_BUILD_NUMBER,
    'name': 'Protractor suite tests',
    'version': '54',
    'selenium-version': '2.53.1',
    'chromedriver-version': '2.26',
    'platform': 'OS X 10.11'
exports.config.capabilities = undefined;
exports.config.allScriptsTimeout = 120000;
exports.config.getPageTimeout = 120000;
exports.config.jasmineNodeOpts.defaultTimeoutInterval = 120000;

I hope that helps.


Per comments below, setting the config.capabilities to undefined did not work; however, setting config.capabilities to false did work.