Skip to content
New issue

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

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

Already on GitHub? # to your account

Run selected subset of files from Cypress interface (multiple tests) #3607

Open
mattmazzola opened this issue Feb 27, 2019 · 15 comments
Open
Labels
pkg/desktop-gui This is due to an issue in the packages/desktop-gui directory type: enhancement Requested enhancement of existing feature type: user experience Improvements needed for UX

Comments

@mattmazzola
Copy link

Current behavior:

As far as I know cypress only allows you to run in 3 types of ways.

  • UI
    • Run all specs located in the tests/integration folder
    • Run an individual test by clicking it
  • CI / Command line
    • Run all specs
    • Run a folder of test using --spec option and specifying folder

Desired behavior:

It would be nice if we could run tests in more flexible combinations. Below is picture of what I'm imagining:

cypresscheckboxes

I assume this feature could be hidden by default so it doesn't overwhelm users, but maybe enabled with a setting such as "Advanced Test Running" or something to opt-in to.

Each test and folder would have a check box. Modifying check of folder affects all children folders/tests.

There is button / warning to indicate when your selection deviates from normal and option to clear it in case people have checkbox selected but scroll down and might forget about it. In worse case I think they would see it trying to run test that had accidentally remained checked, stop the tests, uncheck it and continue.

Related option would be that the "Run All Specs" option only runs the tests that are satisfying the search text filter.

Versions

Cypress: Beta Version 3.0.3
Windows 10: 10.0.17763 Build 17763
Chrome: Version 72.0.3626.119 (Official Build) (64-bit)

@cypress-bot cypress-bot bot added the stage: proposal 💡 No work has been done of this issue label Feb 27, 2019
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Feb 27, 2019

You should be able to do this via the command log using the --spec option. Like: cypress run --spec 'cypress/integration/#/**/*'

Also, make sure to be aware the issues with the 'Run all tests' implementation here #1586

The code to update the specs list, to add checkboxes, etc can be found here: https://github.com/cypress-io/cypress/blob/develop/packages/desktop-gui/src/specs/specs-list.jsx

We would however have to update how the specs are executed per the url when it is then opened in the Test Runner on click.

@mattmazzola
Copy link
Author

mattmazzola commented Feb 27, 2019

You should be able to do this via the command log using the --spec option. Like: cypress run --spec 'cypress/integration/#/**/*'

Oh, my understanding of the spec option is that this line would only run tests in the login folder, but what if we want to run tests outside that folder as well?

On that issue: #1586 it's mentioned:

Enable clicking folders to automatically run a subset of specs

This would help a lot and be inline with checking the box for the folder and clicking run selected. Also this also seems very similar to using the --spec option and specifying the folder path.

My understanding of the issues you were referring to in (#1586) is that when running a lot of tests in interactive mode it will take up too much memory and it's advised to limit the set of tests run.

If we had check boxes and only ran those checked or only those in a folder this would also be limiting the number of tests so it seems also to help with that issue.

Can you explain a bit more about the url issue, I didn't quite understand?

I know when you click a single test that file name is put in the url like:
http://localhost:58054/__/#/tests/integration\CreateModels\WaitVsNoWaitActions.js
and my understanding of your suggesting is that if we did this change the url would need to be updated as the interactive mode switched form testA to testB, etc

When you click "Run all specs" it seems to show:
http://localhost:58054/__/#/tests/__all

So I thought we could so something like:
http://localhost:58054/__/#/tests/__filtered

Which would prevent having to deal with updating the url

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Feb 27, 2019

Oh, my understanding of the spec option is that this line would only run tests in the login folder, but what if we want to run tests outside that folder as well?

You should be able to comma separate globs as well so you can run multiple separate directories or files, like:

cypress run --spec 'cypress/integration/examples/**/*,cypress/integration/other-folder/**/*,cypress/integration/other-file.js'

Can you explain a bit more about the url issue, I didn't quite understand?

Yeah, what you guessed is on the right train of thought. Cypress currently will look for an exact match to 1 file (like when http://localhost:58054/__/#/tests/integration\CreateModels\WaitVsNoWaitActions.js it will look for a single file matching CreateModels\WaitVsNoWaitActions.js within your integrationFolder) or will look for __all and run all of the tests within your integrationFolder. We'd have to have some logic here for it to know how to run a subset of specs from a url.

@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: proposal 💡 No work has been done of this issue labels May 28, 2019
@yagudaev
Copy link

Would love to see this added as soon as possible. This is a simple enough feature that will have a huge positive impact on developer experience.

Scenarios like "I only changed the customer app, so I don't need to run the admin specs" would be easy. It will also make it easier to debug leaky tests that fail when they run together.

@jennifer-shehane jennifer-shehane added type: user experience Improvements needed for UX pkg/desktop-gui This is due to an issue in the packages/desktop-gui directory labels Oct 2, 2019
@jennifer-shehane
Copy link
Member

Related issue with how we want to change the behavior of 'run all specs' in general #1586

@atopper
Copy link

atopper commented Nov 28, 2019

I'd like to see annotations on the test level. So you could add a test to multiple test groups (smoke, daily, full, etc.) and then run Cypress specifying the group.

@jennifer-shehane
Copy link
Member

From @bahmutov suggestion in #6581

Our users are asking us sometimes to run some specs when using the interactive mode. I think the simplest way we could make them happy is to use the search pattern when the user clicks "Run All Specs" button.

Screen Shot 2020-02-27 at 9 18 09 AM

@jennifer-shehane jennifer-shehane changed the title Run selected subset of files from Cypress interface Run selected subset of files from Cypress interface (multiple tests) Apr 30, 2020
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: ready for work The issue is reproducible and in scope stage: needs review The PR code is done & tested, needs review stage: work in progress labels Jul 24, 2020
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Aug 7, 2020

We've released the ability to run a selected subset of files based on the search filter in 4.12.0 - closing #6581.

Full instructions here: https://on.cypress.io/writing-and-organizing-tests#Run-filtered-specs

I don't believe this exactly covers the original criteria of this feature request, so this issue will remain open, but I thought it may be helpful to some people following this issue.

run-selected-specs

@jennifer-shehane jennifer-shehane added stage: proposal 💡 No work has been done of this issue and removed stage: needs review The PR code is done & tested, needs review labels Aug 7, 2020
@OldSchooled
Copy link

OldSchooled commented Feb 5, 2021

We've released the ability to run a selected subset of files based on the search filter in 4.12.0 - closing #6581.

Full instructions here: https://on.cypress.io/writing-and-organizing-tests#Configuration

I don't believe this exactly covers the original criteria of this feature request, so this issue will remain open, but I thought it may be helpful to some people following this issue.

This is awesome, thank you. It would be more awesome, however, if I could enter multiple, separate search terms and capture the results for all of them.

e.g.
Searching (login; add-todo; delete-todo) returns all tests matching login, all tests matching add-todo and all tests matching delete-todo

@NevenaSymphony
Copy link

I would agree @atopper, adding annotations on test level would be a massive improvement, especially in the context of CI/CD: we could enable/disable cherry-picked tests to run on certain environments, create specified test suits for different deployments... possibilities are endless.

@feliperaul
Copy link

feliperaul commented Nov 1, 2021

@jennifer-shehane Jennifer, is there any estimate for this feature?

Not having to constantly write .only and .skip in tests (and not forgetting to remove before a git commit) is something that would hugely improve the user experience.

This guy created a plugin here (https://github.com/bahmutov/cypress-skip-and-only-ui), but it broke after a Cypress update; his UI was great. Maybe it could get some love from the official developers?

@Zombobot1
Copy link

We've released the ability to run a selected subset of files based on the search filter in 4.12.0 - closing #6581.

Full instructions here: on.cypress.io/writing-and-organizing-tests#Run-filtered-specs

I don't believe this exactly covers the original criteria of this feature request, so this issue will remain open, but I thought it may be helpful to some people following this issue.

run-selected-specs

Is it possible to do in component testing? Its UI is quite limited

@BlueWinds
Copy link
Contributor

Is it possible to do in component testing? Its UI is quite limited

We are reworking and unifying the UI for e2e and component testing at the moment, which should help with missing features. Currently expecting to release with 10.0.0, mid-January or so.

@AStoker
Copy link

AStoker commented Feb 2, 2022

Our use case is one where we have our e2e tests which live in the integration folder (totally fine there), but unit tests that test specific files are alongside the actual file that's being tested. This allows for modules to be moved around and test files go with them and not screw up references. I would love to be able to say, "Find all test files in 'Integrations' folder as well as any .spec.js file inside the 'src' folder. Are the new changes going to support that kind of use case?

@cypress-bot cypress-bot bot added stage: backlog and removed stage: proposal 💡 No work has been done of this issue labels Apr 29, 2022
@hodapp512
Copy link

Is there any progress on this issue in the new UI?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
pkg/desktop-gui This is due to an issue in the packages/desktop-gui directory type: enhancement Requested enhancement of existing feature type: user experience Improvements needed for UX
Projects
None yet
Development

No branches or pull requests