Put Cypress archives in temp directory #38
Merged
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.
Issue: #AP-3824
What Changed
Writes archives to the Cypress-managed
/cypress/downloads
folder instead of the project root (the/cypress/downloads
folder is cleared by Cypress at the beginning of each test run). This makes sure we have correct assets and that we don't bleed assets over between test runs (e.g. if you had a spec, ran a test, then removed that spec and ran the test again, we'd expect there to not be a story entry or spec-specific assets from that removed spec).This doesn't handle if the user has configured a custom download folder; I'll make a ticket to handle that in the future.
2 situations where
/cypress/downloads
folder is not cleared before a test run:npx cypress open
)trashAssetsBeforeRun
tofalse
Alternatives I considered
I originally planned on managing the archives directory ourselves -- clearing it out before each test run via the
before:run
lifecycle hook. However, this has a couple downsides:cypress.config.js
file (since we shouldn't just create all lifecycle event listeners for them)I figured we might as well use the Cypress-managed directory like we do for Playwright.
How to test
/cypress/downloads/
folder contains thechromatic-archives/
directorynpm run archive-storybook
/downloads
directorynpx cypress run --spec path/to/spec
againChange Type
maintenance
documentation
patch
minor
major