I have a cypress project set up and I am trying to run cypress tests based on tags using the nx command.
cypress grep--->"@cypress/grep": "^4.0.1"
After applying the nx command like this:
nx run e2e:e2e --tags=@regression
The issue is that the nx project is recognizing all test cases in cypress, rather than just the ones tagged with @regression
I am looking for guidance on whether there is a way to run cypress tests based on tags using the nx command.
Here is an example of my spec file structure:
Filename: filename.cy.ts
describe('', { tags: "@regression"}, () => {
beforeEach(() => {
cy.login();
});
it('', { tags: "@regression"},() => {
});
My e2e.ts file:-
import './commands';
import registerCypressGrep from "@cypress/grep";
registerCypressGrep();
My project.json file:-
{
"name": "",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "e2e/cypress.config.ts",
"devServerTarget": "",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": ""
}
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
},
"tags": ["@regression"],
"implicitDependencies": [""]
}