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

support for run-ct command

Open hcho112 opened this issue 3 years ago • 5 comments

Hello,

Our team is trying to adopt component testing of cypress and wonders if we can run them in parallel locally. I have tried using cypress-parallel package to run in parallel, hoping that I just need to swap run command to run-ct. But unfortunately it did not work.

Before I start pasting error messages and my attempts, I would like to know if it is officially supported (or it is possible) from this repo, or has anyone successfully got it working.

Cheers

hcho112 avatar Feb 16 '22 02:02 hcho112

@hcho112 this is will work in local machine without any issue. can help If you can share the error message.

ISanjeevKumar avatar Mar 02 '22 16:03 ISanjeevKumar

Hey @hcho112 , were you able to get this working?

tnicola avatar Mar 20 '22 16:03 tnicola

My apologies for late update. Our team decided not to proceed with cypress unit testing so I kind of stopped investigating the issue.

hcho112 avatar Mar 20 '22 20:03 hcho112

I am using Cypress for React based component testing and cannot get it to work in parallel. I think what happens is that Webpack is launched for each thread and, as a result, only 1 webpack instance is able to launch in parallel? So as a result only 1 thread ever actually runs. I am using this script (specs exist in src folder):

    "cy:parallel": "cypress-parallel -s cy:ct:run -t 2 -d src/**/*.spec.cy.tsx",

The run starts but Webpack shuts down for one of the threads:

[webpack-dev-server] Gracefully shutting down. To force exit, press ^C again. Please wait... [webpack-dev-middleware] wait until bundle finished: /__cypress/src/index.html

It then resumes on the other thread and a handful of the specs therefore run.

Any ideas?

Phonesis avatar Mar 30 '22 14:03 Phonesis

Quick update on above for anyone who has similar problem. I was able to fix shortly after typing the above! I needed to remove a hard coded port value from the webpack config. So it was down to a port conflict. With that removed webpack assigns each instance a free port within the 8000 range. Seems ok now.

Interestingly though, the run time is actually slower running the tests in parallel (using an m1 macbook) than when doing it via single cypress instance. I suspect this is down to the overheard of launching 4 webpack instances.

So I actually am not sure cypress-parallel is worth it for when using Cypress for component mounting/testing

Phonesis avatar Mar 30 '22 14:03 Phonesis