Is there any way to pass multiple browser via protractor cli

前端 未结 3 411
旧时难觅i
旧时难觅i 2020-12-31 19:29

Just wanted to know is it possible to specify cli args to protractor like

--multiCapabilities.0.browserName chrome --multiCapabilities.1.browserName firefox

3条回答
  •  既然无缘
    2020-12-31 20:27

    There are a couple of things you could try.

    How can I use command line arguments in Angularjs Protractor? explains how to pass in a "params" variable, which if you were totally pro you could reference later in the config file, with the multiCapabilities section (maybe use a helper function or an if statement so you don't have to pass in a complex object from the command line). Not easy to do, but possible.

    https://sourcegraph.com/github.com/teerapap/grunt-protractor-runner (see the Options section) is a utility that lets you pass in these things from the command line without any trouble. It's open-source and seems like it would be easy to mod if it doesn't quite meet your needs.

    The easiest option, assuming you just need a couple of different options, would just be to use two different config files, "protractor.chrome.conf.js" and "protractor.firefox.conf.js" and run whichever one you need at the moment.

提交回复
热议问题