Problem Statement: I would like to know how can I configure the npm run test command in such a way that I can run a set of feature files/ a single feature file from a dir path/ folder.
Background: I have an automation setup using Playwright + Cucumber BDD + NPM + JavaScript. My execution scripts are defined on package.json and the respective config details on cucumber.js.
Current Setup: With the current setup I have, when I run the npm run test:env
command, it runs the entire suite. And when I run the npm run test:env --TAGS="@TagName"
command after adding @TagName to a feature file or to a specific scenario, it runs those tests alone.
Is there a way I can pass the dir path to the npm run command and it runs all the features under that dir?
Other Details:
I have the tag config setup (tags: process…npm_config_tags in cucumber.js) and whenever I set a specific tag in a test file(s) and execute the command npm run test:env –TAGS=”@TagName”, it executes only the tests with that particular tag. I would like to have a similar setup using which I can pass a folder path to the command and it runs all the tests under that folder.
This is how my package.json looks like: “scripts”{“test”: “cross-env ENV=QA cucumber-js –config=config/ cucumber.js || true} and my cucumber.js has the defaults, paths, require, format etc. mentioned. Screenshots attached for reference.
package.json
cucumber.js
Narendra Boyanapalli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.