Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec files are not being split in different threads #152

Open
jgonzalezalbisu opened this issue Dec 28, 2022 · 5 comments
Open

Spec files are not being split in different threads #152

jgonzalezalbisu opened this issue Dec 28, 2022 · 5 comments

Comments

@jgonzalezalbisu
Copy link

jgonzalezalbisu commented Dec 28, 2022

When running tests using parallelization and the cypress-tags(https://www.npmjs.com/package/cypress-tags) library together, I see that the X executions are opened (x being the number of threads passed to the command with t) but both threads are executing the same things and specs are not being split in different threads.

Here is what I've got in my package.json:

"scripts": {
  "original-command": "CYPRESS_INCLUDE_TAGS=TAG1,TAG2,TAG3,TAG4 CYPRESS_EXCLUDE_TAGS=BROKEN,ARCHIVED,INPROGRESS npx cypress run --spec 'cypress/e2e/**/*.ts' --browser chrome",
  "parallel-command": "cypress-parallel -s original-command -t 2 -d '/cypress/e2e/**/*.ts'",
}

And when running the script parallel-command, I see that the the spec files are run in both threads and no splitting is being done. Am I missing something? Could it be cause it's the first run I'm doing and there is no weigh file?

Would you be able to help me?

Thanks!

@jgonzalezalbisu jgonzalezalbisu changed the title Cannot run parallelization using the dependency cypress-tags Spec files are not being split in different threads Dec 28, 2022
@lems3
Copy link

lems3 commented Apr 3, 2023

I started to use cypress parallel last week, and I had a similar issue. Turns out that setting spec and browser on the "original-command" as you do can cause issue.

Either remove those params from the original-command in your scripts or create a new command to use only with cypress-parallel. It should start behaving properly.

@dthisner
Copy link

dthisner commented Apr 4, 2023

@lems3 That seems to work, thank you :)

@adoshi-branch
Copy link

adoshi-branch commented Jan 26, 2024

@lems3 any suggestions for me I'm hitting this same issue this is the command I'm using, This is a script that sits in the cypress directory and is referenced from my package.json as

"cy:runParallel": "python3 runParallel.py",

cypress-parallel -s cy:run -t {thread_count} -d "cypress/e2e/**/*.spec.ts" "
f"-a " --browser chrome --headed --env grep={test_id_arguments} --spec '{formatted_file_paths}'""

I am greping for specific strings, and I am passing in all the different spec files.

@lems3
Copy link

lems3 commented Jan 26, 2024

@adoshi-branch I don't have a lot of experience with python, but I think you're facing the same limitation, where setting specs twice causes issues.

You'd need to find a way to only use the -d argument from cypress-parallel, as it will set cypress' --spec when running.

@adoshi-branch
Copy link

@lems3 thanks it looks like I need to find a way to combine both as -d should be the directory of where the tests are and the --spec is what specific spec files I'd like to run. If I find a solution I'll post back here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants