Add ability to auto-start the first spec file in the list (add option to cypress open)
See original GitHub issueWhat would you like?
Hi there, I am very close to being able to run a GUI cypress test with a single click from vscode. Here’s how that happens currently:
I use an extension https://marketplace.visualstudio.com/items?itemName=shevtsov.vscode-cy-helper that adds the “Open Cypress” text above each it block. Upon clicking that, this code runs in the vscode terminal:
npx cypress open --e2e --browser chrome --config specPattern="/Users/tnrich/Sites/openVectorEditor/cypress/e2e/tabs.spec.js"
That command in turn opens up the cypress gui to a page that looks like:
What I’m asking for is an additional option on cypress open
, something like --auto-start
or auto-run
or auto-start-first-spec
The entire command would then look like:
npx cypress open --auto-start --e2e --browser chrome --config specPattern="/Users/tnrich/Sites/openVectorEditor/cypress/e2e/tabs.spec.js"
And then the first (and in my case only) matching spec file would start running immediately on startup instead of me having to click another button.
I hope that all makes sense.
Why is this needed?
Having the ability to click once to run a test is very powerful. This would be a useful feature for all cypress users and make cypress testing even easier.
Other
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:7 (7 by maintainers)
Top GitHub Comments
I generally disagree with that as do many others judging by the number of upvotes in that thread.
The startup time for the new cypress v10 for me on an m1 macbook is negligible. The ability to just click one button (from vscode specifically) is paramount to me. If it didn’t have to restart the cypress runner each time a new spec was clicked that would be fine (and was thus even faster on subsequent runs), but the single button click to get to a running test is the KEY feature for me.
Hope the above points make sense. I appreciate the back and forth @mirobo!
Cheers!
Wouldn’t it be an option to let the plugin execute this command instead?
npx cypress run --headed --e2e --browser chrome --config specPattern="/Users/tnrich/Sites/openVectorEditor/cypress/e2e/tabs.spec.js"
or maybe with added “–no-exit” so the UI stays open and the test could be re-run?
npx cypress run --headed --no-exit --e2e --browser chrome --config specPattern="/Users/tnrich/Sites/openVectorEditor/cypress/e2e/tabs.spec.js"
Also I don’t really see the benefit in starting Cypress with only one spec. You could just open Cypress normally and then click on the respective test to start it (ok, it’s not started from the IDE though). It will be much faster since Cypress is already open
https://docs.cypress.io/guides/guides/command-line#cypress-run