Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[cypress/grep] Add capability to filter spec by referring to Typescript enums #26038

Open
kunalashar25 opened this issue Mar 7, 2023 · 5 comments
Labels
E2E Issue related to end-to-end testing npm: @cypress/grep @cypress/grep package issues type: feature New feature that does not currently exist

Comments

@kunalashar25
Copy link

What would you like?

My tests are written as

import { TestLayer, TestSeverity } from 'utils/testTags';

describe('check tags result', { tags: [TestLayer.API] }, () => {
    it('test1', { tags: [TestSeverity.CRITICAL] }, () => {
        console.log('');
    });
    it('test2', { tags: [TestSeverity.NORMAL] }, () => {
        console.log('');
    });
});

I have an enum for tags

export enum TestSeverity {
    BLOCKER = '@blocker',
    CRITICAL = '@critical',
    NORMAL = '@normal',
    MINOR = '@minor'
}

export enum TestLayer {
    UI = '@ui',
    API = '@api'
}

When I run my cases with the below config

grepFilterSpecs: true,
grepOmitFiltered: true

I get the following console message and it cannot filter tests

Could not determine test names in file: ${fileName}
Will run it to let the grep filter the tests

While debugging I observed it printed cypress-grep found grep tags "@ui" in 51 specs +193ms but only 2 files have a @ui tag.

Why is this needed?

Grouping tags in enums is helping to have a centralized place to identify all the tags of a project and will not lead to spelling mistakes or duplicates/unnecessary tags.

identifying tags from enum will help to leverage this capability to the fullest.

Other

No response

@mjhenkes mjhenkes added E2E Issue related to end-to-end testing type: feature New feature that does not currently exist labels Mar 9, 2023
@mjhenkes mjhenkes removed their assignment Mar 9, 2023
@TomaszG
Copy link
Contributor

TomaszG commented May 25, 2023

My wild guess is that culprit of the issue lies here: bahmutov/find-test-names#78

@jennifer-shehane jennifer-shehane added the npm: @cypress/grep @cypress/grep package issues label Jun 13, 2023
@cameroncooks-branch
Copy link

We encountered the same issue

@hshimmex
Copy link

hshimmex commented Feb 28, 2024

We see that also. Any update? it is very important

@preeti-bellad-sp
Copy link

I am also facing the same issue.

@camseda
Copy link

camseda commented Oct 23, 2024

Also having problems with this issue -- is it on the roadmap?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing npm: @cypress/grep @cypress/grep package issues type: feature New feature that does not currently exist
Projects
None yet
Development

No branches or pull requests

8 participants