cypress-io / cypress-grep

Filter tests using substring
137 stars 19 forks source link

Cypress-Grep : All the specs are executing , not only the spec where the particular tag is given #67

Closed dilugit closed 2 years ago

dilugit commented 3 years ago

For me it executed all the specs under integration rather the tag given. I followed below steps. Could you please let me know where I have done wrong?

  1. Install grep

  2. Package.json "smoke:qa": "cypress run --env grepTags=\"Smoke\" --browser chrome",

  3. index.js require('cypress-grep')

  4. Added the Smoke tag for a spec describe('ID - 343 : Verify Navigate to "Assisted Service" Page, Heading & Grid Fields',{tags:'Smoke'}, function () {

  5. Execute the below command; npm run smoke:qa

MaheshSinghSawant commented 3 years ago

All the specs are running for me as well. @dilugit were you able to solve this issue?

MaheshSinghSawant commented 3 years ago

@dilugit I resolved this by adding in cypress/plugins/index.js

const grepPlugin = require('cypress-grep/src/plugin');
...
grepPlugin(config);

in commands.ts -

import * as grep from 'cypress-grep';
grep();
rbknajera commented 2 years ago

I'm having the same issue, all tests are running, ignoring the tag I'm using. I tried @MaheshSinghSawant approach but still not working. I get the following error: > grep is not a function

dilugit commented 2 years ago

@MaheshSinghSawant No, I couldn't .Then what I did was created folders as Smoke, Regression and added Test scripts under these folders. Then used npm commands to call the TCs of respective folder when it's either Smoke/Regression.

rbknajera commented 2 years ago

@dilugit I was able to make it work by addingrequire ('cypress-grep')(); in support/index.js file

bahmutov commented 2 years ago

I can probably make it an opt-in feature for some simple cases following the approach shown in this video https://youtu.be/44kkiCa7VJk

bahmutov commented 2 years ago

Released support for simple --grep title case, not for test tags

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 2.9.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: