It is confusing to use the same parameter --grep= to both search the test title and tags. I think a much cleaner use case would be:
use grep to search the title, or -grep to invert the title search
use grep-tags to only match the explicit test tags specified in the test config object. The tags can be inverted, space is the OR and + character is the AND
# run just the first test
$ npx cypress --env grep=hello
# run all tests without hello in their title
$ npx cypress --env grep=-hello
# run the test with title "works more"
$ npx cypress --env grep="works more"
# run all tests with tag "smoke"
$ npx cypress --env grep-tags=smoke
# run all tests with tag "smoke" or "slow"
$ npx cypress --env grep-tags="smoke slow"
# run all tests with tag "smoke" AND "slow"
$ npx cypress --env grep-tags=smoke+slow
$ npx cypress --env grep-tags="smoke +slow"
# run all tests with tag "smoke" but without tag "slow"
$ npx cypress --env grep-tags=smoke-slow
$ npx cypress --env grep-tags="smoke -slow"
It is confusing to use the same parameter
--grep=
to both search the test title and tags. I think a much cleaner use case would be:grep
to search the title, or-grep
to invert the title searchgrep-tags
to only match the explicit test tags specified in the test config object. The tags can be inverted, space is the OR and+
character is the ANDImagine the tests like this:
Then we could filter tests like: