How to access ALL the properties defined in multi capabilities?

Viewed 41

I am defining my multi capabilities like below:

multiCapabilities: [{
      browserName: 'chrome',
      platform: 'macOS 10.14',
      version: 'latest',
      name: 'Chrome tests',
      shardTestFiles: true,
      maxInstances: 1,
      extendedDebugging: true,
}]

I am able to access some of the properties by:

browser.driver.getCapabilities().then(function(caps){
   console.log(caps);
   console.log(caps.get('browserName'));
});

I am not able to find/log the properties like shardTestFiles and maxInstances. How can I access those properties in my tests?

1 Answers

You can use this getProcessedConfig. For example you can firstly console.log() entire return object:

    const  = await browser.getProcessedConfig();
    // tslint:disable-next-line:no-console
    console.log(JSON.stringify(config));

For getting something specific just get it like in any plain object. For example in my case:

console.log(JSON.stringify(a.capabilities));

I was getting: {"browserName":"chrome","shardTestFiles":true,"maxInstances":3,"count":1}

Hope you got an idea.

Related