-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fast cypress #8459
Fast cypress #8459
Conversation
f9ce4fe
to
23a698d
Compare
Also, provide a `fast-cypress` npm script to call a similar local command. Cypress tests should now only be invoked when files they test are changed. If this is found incomplete, more files can be defined in the `spec-map.js` file, as needed.
I like this idea in theory but worry about false negatives. There is some common Python code that underlies most of the functionality being tested but isn't included in the map; for example anything in Wagtail relies on
The risk is that we don't detect the false negative until way after a change has gone live by which point it may not be a simple matter to fix or undo. If the goal here is to speed up checks/merges to main, should we consider reintroducing the full test suite as a gate to production deployment? |
I added the python files in core and base.html to the full suite trigger in 416e252
I agree that this approach inherently carries some level of risk. However, I think it's actually smaller than you might think, namely (1) areas where the files changed SHOULD trigger certain tests but don't, where (2) those tests would fail under the given change in (3) a way that points to an unintended behavior/bug that (4) isn't caught in development by the code author or (5) the reviewer. Certainly possible, but I'd bet reasonably rare and fairly minor in reach/scope if it did happen. |
To assuage these concerns should we run the full suite against the merge queue? i.e. jobs:
cypress:
if: ${{ vars.GITHUB_EVENT_NAME == 'merge_group' }}
steps:
...
fast-cypress:
if: ${{ vars.GITHUB_EVENT_NAME == 'pull_request' }}
steps:
... |
I think that would be a decent option. I do kinda want to get to a place where we are only running tests that we really think need to run though, to reduce all the various delays that aren't usually necessary. I'd almost rather just run it on a push to main, which would let us know early that there's a failure but wouldn't gate the merges on the full suite (so 97% of the time merges -> deploys are quicker) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote to give this a whirl and adjust as needed in the future
This PR changes how our cypress functional tests run against changes to code in this repo. It does this by defining a mapping between files & directories of application code and corresponding directories of cypress tests that need to be run. This mapping is defined in the
spec-map.js
file and the changed files that are tested against this map are discovered via diffing against main (locally) / using a changed-files action that wraps the diff (in GHA). How this actually affects Cypress is by using the mapping to rewrite a cypress config file with constrained spec paths.Cypress can be run locally using this mapping with
yarn run fast-cypress
. The entire suite can be run locally usingyarn run cypress
(as normal).Broadly speaking, the answer to "what Cypress tests should run against this PR" is usually decently easy to answer and so I expect this naive mapping to mostly function without many false negatives. Indeed, any detected false negatives can just simply be added to the map.
Some choices I made:
requirements
, orpackage.json
(sorry ans_update_deps) are changed, ALL the specs run, as there can be no guarantee that random tests won't failLet me know what y'all think!