Search code examples
cucumbercypress

How to run multiple tags at once in Cucumber / Cypress JS project?


In my Cypress JS / Cucumber project, I am trying to run multiple test scenario's with different tags.

Feature: First feature

    @tagOne
    Scenario: #1 Navigation

Another feature:

Feature: Secondfeature

    @tagTwo
    Scenario: #1 Visibility

I'm able to run the tags seperately using the below commands:

npx cypress run -e TAGS=\"@tagOne\"
npx cypress run -e TAGS=\"@tagTwo\"

However, I now need to run them together at the same time.

When I run the below command, only tagOne scenario's run, & the tagTwo scenario is Pending.

npx cypress run -e TAGS=\"@tagOne or @tagTwo\"

Can someone please tell me how I can run these tags at the same time?


Solution

  • According to the syntax, these are the options.

    Old style command line Cucumber Expressions style command line
    --tags @dev --tags @dev
    --tags ~@dev --tags "not @dev"
    --tags @foo,@bar --tags "@foo or @bar"
    --tags @foo --tags @bar --tags "@foo and bar"
    --tags ~@foo --tags @bar,@zap --tags "not @foo and (@bar or @zap)"

    If this works the same as Boolean expressions, or will stop at the first one that matches.

    You should try and instead.

    npx cypress run -e TAGS="@tagOne and @tagTwo"