Search code examples
package.jsoncypress-cucumber-preprocessor

Cypress feature file structure in folders


I am using Cypress with Cucumber preprocessor and currently we have all the feature files in one feature folder, e.g.:

features/testcase1.feature

As we have many files there, we want to have cleaner structure, so we are trying to group some feature files into subfolders:

features/HOME/testcase1.feature, features/HOME/testcase2.feature, features/LOGIN/testcase3.feature

etc.

This is ok, and it is working fine in test runner, as it recognizes the files also in subfolders.

But I have problems to set up the path to all feature files in package.json:

  "scripts": {
    "test": "node_modules\\.bin\\cypress run --spec \"cypress/integration/features/*.feature\"",
    "head": "npm run test -- --headed",
    "chrome": "npm run test -- --browser chrome",
  },

because this path cypress/integration/features/*.feature will look in the main features folder and not into subfolders.

Is there a way to define a path to check all feature files in subfolders?

something like: cypress/integration/features/(*.)/*.feature

but this solution doesn't work.


Solution

  • ok, the solution was very simpe :)

    Just to use 2 asterisks instead of (*.):

    cypress/integration/features/**/*.feature