I have the following directory structure for working with Cypress:
cypress-automation
cypress
fixtures
integration
apps
one-spec.js
pulse
sample-spec.js
another-spec.js
examples
plugins
screenshots
support
videos
node_modules
cypress.env.json
cypress.json
package-lock.json
package.json
I want to be able to have a command to be able to target the pulse folder test when a specific push has been made. Has anyone made an attempt or has this working that can help me out ?
Edit: Lets say i have a few specs in the app folder. now if i wanted a way to run those specs instead with a specific command when pushing new code changes, is that possible. I want to be able to run specific folders with different scenarios so I am not always running everything everytime.
You can directly use the command like this:
npx cypress run --spec "cypress/integration/pulse/*-spec.js"
You can also pre-define commands with specific folders in your package.json like this:
"scripts": {
"test:pulse": "cypress run --spec \"cypress/integration/pulse/*-spec.js\""
"test:app": "cypress run --spec \"cypress/integration/app/*-spec.js\""
}
Now when you want to run pulse tests you can just run npm run test:pulse or for app you can run npm run test:app