I have a test where I'd like to pass a language key through the command line, and have the browser use that language key in the chromeOption args.
How would I use a default of en-us, but pass in whatever language I want and change it from the default based on what is passed in?
I've got this in my conf file:
exports.config = {
...
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [
'lang=en-419',
]
}
},
params: {
language: {
lang: 'en-US'
}
},
...
};
I would like to run this command and have the browser switch to es-419 for this run of the tests
protractor conf.js --params.language.lang=es-419
What do I add in to modify the capabilities based on the passed language, with en-us as a default if nothing is passed?
I've tried a few things, which crash with errors like 'object has no method capabilities' or 'chromeOptions undefined'.
browser.capabilities.chromeOptions.args.update(browser.params.login.lang);
browser.getCapabilities().then(function(){
chromeOptions.args = browser.params.language.lang;
});
browser.manage().capabilities.chromeOptions.args(browser.params.language.lang);
capabilities: {
chromeOptions: {
args: { 'lang=' + this.params.language.lang
}
}
}
Any ideas?