protractor icon indicating copy to clipboard operation
protractor copied to clipboard

how to input --cucumberOpts.tags with multiple tags with And relationship

Open jlin412 opened this issue 12 years ago • 5 comments

Equivalent in conf.js file will look like:

cucumberOpts: { tags: ['@dev', '~@ignore'] }

I am trying something like --cucumberOpts.tags="@dev&&~@ignore" or --cucumberOpts.tags="['@dev','~@ignore']" None of it seems to work. Do we support multiple tags input from commandline?

jlin412 avatar Aug 08 '14 22:08 jlin412

You can use the --cucumberOpts.tags option multiple times, for instance:

 protractor protractorConf.js --cucumberOpts.tags="@dev" --cucumberOpts.tags="~@ignore"

lksv avatar Aug 13 '14 12:08 lksv

that is very helpful. I am trying to drive it from grunt. When I do grunt.option('cucumberOpts', '@dev'); grunt.option('cucumberOpts', '~@ignore');

The second option overrides the first. Any grunt expert here?

On Wed, Aug 13, 2014 at 8:25 AM, Lukas Svoboda [email protected] wrote:

You can use the --cucumberOpts.tags option multiple times, for instance:

protractor protractorConf.js --cucumberOpts.tags="@dev" --cucumberOpts.tags="~@ignore"

— Reply to this email directly or view it on GitHub https://github.com/angular/protractor/issues/1180#issuecomment-52041105.

jlin412 avatar Aug 13 '14 22:08 jlin412

I think this is now a grunt question, so I'm going to close. Please ask on stack overflow or a more appropriate grunt forum. Thanks!

juliemr avatar Jan 06 '15 20:01 juliemr

just stumbled on this. The OP is encountering a grunt bug which is fixed in grunt 1.X , which was released a couple months ago. HTH

see closed issue here : https://github.com/gruntjs/grunt/issues/488

kylezeeuwen avatar Jun 03 '16 06:06 kylezeeuwen

Since this is the first relevant google hit for the subject and I have a feeling myself or someone else might end up here in the future:

This is what I'm ended up using doing with an integration-test grunt registered task, where I'm setting a bunch of process.env and passing the values to the grunt-protractor-runner module with my CLI input as grunt integration-test -tags=@wip,@kian. Note that from what I can tell before diving further that the grunt-protractor-runner is using AND logic on the CLI passed in tags, so it works great if you want to AND NOT (@kian,~@wip), but isnt great for IN/LIKE logic.

//$ grunt integration-test -tags=@wip,@kian

//Collect tags from CLI or specify elsewise.
if(grunt.option('tags') != undefined) cukeTags = grunt.option('tags');
else cukeTags = false;

//Throw tags into an array if they exist and aren't an array.
if (!Array(cukeTags) && cukeTags != false && cukeTags != undefined && cukeTags.includes(',')) cukeTags = cukeTags.split(','); 

//Set tags for grunt-protractor-runner to consume
grunt.config.merge({protractor: {options: {args: {cucumberOpts: {tags: cukeTags} }}}});

//Run protractor based off standard grunt-protractor-runner task config.
grunt.task.run(['protractor:e2e']);

kyleian avatar Feb 27 '17 21:02 kyleian