Linked Questions

Popular Questions

I am currently running Cypress and I have folders inside of it, where I have tests located for different applications. I have a folder entitled "smhw-qa" which contains sub-folders and tests files for this specific application.

This directory apps will also include other applications too in future.

What I wish to do

In order to avoid having to run every test for a run, I wish to only run this specific folder. The location of the folder is as such:

'cypress/integration/apps/smhw-qa'

Over time, there will be more folders and tests added to the apps directory.

I am familiar with how to run a specific file, so doing the following works:

npx cypress run --spec 'cypress/integration/apps/smhw-qa/banners_promos_global/global_search.js'

How can I specify to Cypress which folder to run specifically when I use the npx cypress -run command?

What I have tried already

To run a specific test file I tried:

npx cypress run --project 'cypress/integration/apps/smhw-qa'

But this provides an error instead:

Can't run because no spec files were found.

We searched for any files inside of this folder:

/Users/jaswindersingh/Documents/cypress-automation/automation/cypress/integration/apps/smhw-qa/cypress/integration

Running specific sets of tests by their folders will be much easier for me, and will save time when running a specific suite of tests on our CI platform for example. I will also not need to specify the individual files since this is time-consuming.

It would also mean I can split out my tests and run them on different machines

Do I need to put anything into my test files, or inside of cypress.json or modify anything else, or can this be achieved through the terminal? What options must I use instead?

Thanks

Related Questions