Improve stress-test workflow by adding grep functionality #35415
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change allows one to filter a specific test, or a set of tests to run within a single spec by using a Cypress
grep
functionality.The documentation and examples are here:
https://github.com/cypress-io/cypress/tree/develop/npm/grep
Why?
Sometimes you just want to test a single test within a large spec. You'd do this locally in an "open mode" by appending
.only()
to the test but that doesn't work with Cypress grep.If you tried this, you probably saw this error:
Solution
By using a dynamic
grep
filtering that Cypress grep plugin allows, we have way more flexibility than if we had to hard code.only()
to a test.How to test this change?
The easiest and the most accurate way is to test it directly in CI. This is exactly what I did here.
https://github.com/metabase/metabase/actions/runs/6770593301/job/18399303406#step:9:168
It correctly skipped all other tests and ran only the one that contains that phrase in the name.
grep
input is not required, let's test this workflow by omittinggrep
altogether ✅https://github.com/metabase/metabase/actions/runs/6770736797
As expected, it ran all tests in that spec.