cypress-io / cypress-documentation

Cypress Documentation including Guides, API, Plugins, Examples, & FAQ.
https://docs.cypress.io
MIT License
937 stars 1.04k forks source link

Grep docs #5133

Open leonid-sviderskii-mtl opened 1 year ago

leonid-sviderskii-mtl commented 1 year ago

Subject

Cypress grep readme should contain examples for CI runs with multiple args

Description

Hello guys!

Why

I spent a few hours trying to understand why my tests are not working as expected using grepTags plugin on GitHub Actions so I guess my finding could be helpful for others too.

Target page

https://github.com/cypress-io/cypress/blob/develop/npm/grep/README.md

What's missing

The majority of the examples provided do not cover cases with multiple arguments for the grepTags command when running on CI. As the way it's working in CLI and GHA is slightly different, it causes a huge confusion.

While in CLI (like npm scripts) it can work with quotes around the tags like:

"test": "npx cypress run",
"test:prod": "npm run test -- --env environmentName=prod,grepTags='@works-in-prod @only-in-prod --@only-in-staging'",

on GHA, the whole value must be in quotes like:

with:
      env: 'environmentName=prod,grepTags=@works-in-prod @only-in-prod --@only-in-staging'

Otherwise, the tests will be skipped / Cypress cannot find spec files.

Ioanna2001 commented 1 year ago

Hello, is anyone working on this issue? I would like to resolve it

leonid-sviderskii-mtl commented 1 year ago

@Ioanna2001 did you face the same issue?