user9847788
user9847788

Reputation: 2445

How to omit Cucumber JS scenarios based on tags in Cypress tests?

In my Cypress / Cucumber JS framework, I have several scenarios that have different tags (@Regression, @Login, & @Smoke, etc.).

I am trying to run all scenarios except those with the @Login tag.

I am able to run only the @Login tests with the below command:

npx cypress open --config specPattern=cypress/tests/e2e/*.feature --env tags=@Login

I tried the below 2 commands that I found online, but I'm running into issues with those:

  1. npx cypress open --config specPattern=cypress/tests/e2e/*.feature --env tags=not @Login

Error: Your configFile threw an error from cypress.config.js The error was thrown while executing your e2e.setupNodeEvents() function: Error: empty stack at pop (C:...\node_modules@cucumber\tag-expressions\dist\src\index.js:139:15)

  1. npx cypress open --config specPattern=cypress/tests/e2e/*.feature --env tags=~@Login

This second attempt does open the Cypress Explorer, but it says that no specs were found. Even though I do have tests with tags other than @Login.

I know I could specify all the other tags, & run it that way, but I instead want to just exclude @Login tests.

Can someone please point out what I am doing incorrectly?

Upvotes: 0

Views: 867

Answers (1)

Greer
Greer

Reputation: 176

Have you tried putting some quotes around the parameter?

npx cypress open --env tags="not @Login"

Upvotes: 5

Related Questions