cypress-parallel icon indicating copy to clipboard operation
cypress-parallel copied to clipboard

Cannot execute just a spec (or group of them) inside the specs folder

Open pedromateo opened this issue 3 years ago • 5 comments

Hi, first of all, thank you for your contribution, this can be very useful for our daily testing activities.

I see a problem, and it is that I cannot find a way to execute just a spec (or group of them) inside the specs folder.

For example, in regular Cypress I'll do:

"cypress run --spec 'cypress/integration/a.spec.js,cypress/integration/b.spec.js'  --reporter cypr...

But if in cypress-parallel I try to do this, it does not work:

"parTest": "cypress-parallel -s cy:run -t 2 -a '\"--spec 'cypress/integration/a.spec.js,cypress/integration/b.spec.js'\"' ",
"cy:run": "cypress run ",

I also tried other alternatives but I can not find a way to do this. What I am doing wrong? Is it possible to achieve this with current version of cypress-parallel?

Thank you very much in advance!

pedromateo avatar Sep 21 '21 12:09 pedromateo

I believe --spec option only works for directories. If you leave it out and create another npm script and call it in the -s option of cypress-parallel I think that will work.

stevenmchaves avatar Oct 28 '21 23:10 stevenmchaves

npx cypress-parallel --help
Options:
  --help                     Show help                                 [boolean]
  --version                  Show version number                       [boolean]
  --script, -s               Your npm Cypress command                   [string]
  --threads, -t              Number of threads                          [number]
  --verbose, -v              Execute with verbose logging              [boolean]
  --bail, -b                 Exit on first suite finishing with errors [boolean]
  --specsDir, -d             Cypress specs directory                    [string]
  --args, -a                 Your npm Cypress command arguments         [string]
  --reporter, -r             Reporter to pass to Cypress                [string]
  --reporterOptions, -o      Reporter options                           [string]
  --reporterOptionsPath, -p  Reporter options path                      [string]

Looks like you are requesting an Enhancement.

stevenmchaves avatar Oct 28 '21 23:10 stevenmchaves

I see a problem, and it is that I cannot find a way to execute just a spec (or group of them) inside the specs folder. For example, in regular Cypress I'll do: "cypress run --spec 'cypress/integration/a.spec.js,cypress/integration/b.spec.js' --reporter cypr..

This should be possible using the glob pattern match support: npx cypress-parallel -s cypress run -t 2 -d "cypress/integration/**/{a,b}.spec.js

Full example (-v, verbose):

npx cypress-parallel -s cypress run -t 2 -d  "cypress/integration/**/{a,b}.spec.js" -v
Using pattern cypress/integration/**/{a,b}.spec.js to find test suites
2 test suite(s) found.
Paths to found suites
[
  "cypress/integration/a.spec.js",
  "cypress/integration/b.spec.js"
]
[..]
Running:  a.spec.js
[..]
Running:  b.spec.js

Would result in 2 threads running the two matched specs in parallel.

isunja avatar Dec 16 '21 08:12 isunja

Great, I will try and get back! Thanks @stevenmchaves and @isunja for your kind help!

pedromateo avatar Dec 16 '21 16:12 pedromateo

Is there a way, where I can pass a list of test files instead of glob?

mohit-bansal-braze avatar Jan 14 '22 23:01 mohit-bansal-braze