cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.5k stars 3.14k forks source link

Proposal: Launch single cypress test from vscode #3111

Open tnrich opened 5 years ago

tnrich commented 5 years ago

It would be awesome to be able to run a single cypress test in the cypress devtool directly from vscode. Currently something like that exists for debugging a jest test:

image

As seen in the above photo, a user can hit "debug" and launch a debugging session for an individual jest test. I think it would be super awesome if I could press a "run cypress" button from the editor and have the devtool launch just that test.

In order to get that feature to work I think a few things would need to be done:

I'd love to hear other people's thoughts on this. I just think it could make the already excellent cypress workflow even better!

Thanks!

ethernal commented 5 years ago

I would love to see a proper jest runner so that we could script all tests (jest and Cypress) via a runner and use npm run test or npx jest to just run all tests and integration tests. Would that feature make it possible? It would require Cypress to be able to communicate it's output to jest/external not only to std out as far as I remember.

tnrich commented 5 years ago

@ethernal I don't think what you're suggesting is necessary for what I want to do. While it would technically solve what I'm trying to do, I think it should probably opened as a separate issue to this one.

tnrich commented 5 years ago

Could anyone guide me as to how to implement this:

jennifer-shehane commented 5 years ago

@tnrich There is an issue open to add support for --spec argument to cypress open https://github.com/cypress-io/cypress/issues/1925

tnrich commented 4 years ago

Okay I've created a v1 of the vscode extension vscode-extension-open-cypress

cypressOpen

https://github.com/tnrich/vscode-extension-open-cypress

https://marketplace.visualstudio.com/items?itemName=tnrich.vscode-extension-open-cypress

I've added a TODO list for the features that I think would make this extension actually be really cool:

@jennifer-shehane @bahmutov if you guys could help me figure out a way to have cypress run automatically that would be awesome! I think the need to grep to run a single it block is less important because I can just manually add a .only() to the it block and save (which is a little messy but fine).

PiotrNestor commented 4 years ago

'Run Test | Debug Test' in a test spec.js file in order to run / debug a cypress test in VSCode is a must.

What's the status of this work in the Cypress dev group?

mbolotov commented 4 years ago

I've created a similar plugin for IDEA (with JS support only) It allows running a single test, a spec or all tests in a directory from IDE directly (and see test statuses as well) https://plugins.jetbrains.com/plugin/13819-intellij-cypress

AlexA-1976 commented 4 years ago

Debugging from VSCode by simply setting a breakpoint is a must.

jennifer-shehane commented 4 years ago

Yeah, it'd be ideal to have this feature delivered to help the extensions be more helpful. https://github.com/cypress-io/cypress/issues/1925

There are some workaround in there, like using the testFiles config to narrow down the specs shown in the list, but yah - wouldn't open and run directly.

badeball commented 2 years ago

Christ, 3 years and there's still no way to make any meaningful editor extensions. Please, for the love of god, don't misinterpret the original issue as a request for the Cypress team to develop extensions, you're merely asked to expose more fine-grained control over runner. It's literally a no-brainer and nothing to agonize over.

tnrich commented 1 year ago

@jennifer-shehane bump on this one.. still waiting for a way to be able to launch and RUN a test directly from my editor.

tnrich commented 6 months ago

@jennifer-shehane A year later, would still love to see some way of making this happen.. anyone have any news on this? @emilyrohrbough @chrisbreiding :)