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

Filter out to run only 1 test from the rest of the loop

Open quad5 opened this issue 3 years ago • 6 comments

We have a suite (describe) consists of a few tests (it). On top of that suite, we have a for loop to iterate through that suite.

We are using cypress-grep to filter out a handful of tests for smoke test or acceptance test run. Is it possible to filter out or run only 1 test in said loop?

quad5 avatar May 02 '22 21:05 quad5

Can you provide an example spec showing what you run and how you write your spec?

Sent from my iPhone

On May 2, 2022, at 17:46, quad5 @.***> wrote:

 We have a suite (describe) consists of a few tests (it). On top of that suite, we have a for loop to iterate through that suite.

We are using cypress-grep to filter out a handful of tests for smoke test or acceptance test run. Is it possible to filter out or run only 1 test in said loop?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

bahmutov avatar May 02 '22 21:05 bahmutov

npx cypress run --config-file cypress/configs/desktopView.json --browser chrome --env grepTags=smoke,grepFilterSpecs=true,grepOmitFiltered=true

for (const [key, value] of Object.entries(allUserTypes)) { describe(xyz, function() {

    before(function() {
        value().then(function(param) {
            somefunction()
        })
    })

    it('test 1', function() {
        ...
    })

    it('test 2', function() {
       ...
    })

    it('test 3', {tags: [SMOKE_TEST]}, function() {
        ...
    })

    it('test 4', function() {
        ...
    })

    it('test 5', function() {
        ...
    })

}) }

quad5 avatar May 02 '22 21:05 quad5

And which test you want to run?

Sent from my iPhone

On May 2, 2022, at 17:59, quad5 @.***> wrote:

 for (const [key, value] of Object.entries(allUserTypes)) { describe(xyz, function() {

before(function() {
    value().then(function(param) {
        somefunction()
    })
})

it('test 1', function() {
    ...
})

it('test 2', function() {
   ...
})

it('test 3', {tags: [SMOKE_TEST]}, function() {
    ...
})

it('test 4', function() {
    ...
})

it('test 5', function() {
    ...
})

}) }

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

bahmutov avatar May 02 '22 22:05 bahmutov

it('test 3', {tags: [SMOKE_TEST]}, function() {}

quad5 avatar May 02 '22 22:05 quad5

@nthypes

mfrma-moura avatar May 13 '22 13:05 mfrma-moura

https://github.com/cypress-io/cypress/issues/24451

I also submitted an issue for this. This feels like such a useful case, but it is not supported.

DPC15038 avatar Sep 20 '22 18:09 DPC15038

We are in the process of deprecating this repo as this package has been republished under @cypress/grep and has moved to https://github.com/cypress-io/cypress/tree/develop/npm/grep. I'm going to go ahead and close this issue as it appears stale. If this is still an issue, please open a new issue here

jordanpowell88 avatar Oct 28 '22 19:10 jordanpowell88