Q:

How to pass different config for each instance of a browser created by protractor in sharded config enabled.?

Iam passing the login details of a tested website using browser.params in protractor login suite. But the problem is that my web application has  a restriction for single login for a user account. Hence running tests in multicapablities in firefox and chrome simultaneously fails.Since only one browser user session can exists at a time.Please provide a work around to solve this. It should be nice to pass different login params to firefox and chrome inside multicapabilities. is it possible.

A:

The browser instance can be fetched using browser.getProcessedConfig and the login credentials can be assigned accordingly in on-prepare of Protractor.conf.js
Refer browser.getProcessedConfig API doc
onPrepare: function() {
    browser.getProcessedConfig().then(function(config){
        switch(config.capabilities.browserName) {

            case 'chrome':
                //logic for chrome
                browser.params.username = 'blahblah'
                break;

            case 'firefox':
                browser.params.username = 'blahblah2'
                break;

            default:
                browser.params.username = 'blahblah3'
                break;
        }
    })
},

