Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass parameters from commandline while executing protractor test [duplicate]

Tags:

protractor

I want to execute the test where I can specify the browsername, environement name, suite name in execution command as follows protractor conf.js browser=chrome env=staging suite=smoke

Is that possible with Jasmine and Protractor and Can any one show me how to achieve that?

like image 622
Sachin Avatar asked Dec 04 '22 02:12

Sachin


2 Answers

To pass parameters to protractor, use --params.cmdVar ="cmdVar"

and again use it as above using browser.params.cmdVar

like image 199
vrachlin Avatar answered Jun 19 '23 17:06

vrachlin


Protractor has default feature where you are allowed to pass some parameters from command line. For e.g.

protractor conf.js --baseUrl <UrlToTest> --suite <SuiteName>

To pass some other project specific parameter, you can define that under params of config file.

params: { env: 'someValue' }

you can use: protractor conf.js --baseUrl <UrlToTest> --suite <SuiteName> --params.env <EnvValue>

like image 40
Priyanshu Shekhar Avatar answered Jun 19 '23 19:06

Priyanshu Shekhar