chromaui / chromatic-e2e

Archive end-to-end tests to be replayed in Storybook and Chromatic
MIT License
21 stars 4 forks source link

Enable manual snapshots without automatic snapshots #143

Closed skitterm closed 4 months ago

skitterm commented 4 months ago

This is the non-fork version of #134 (thanks to @jackleslie and @ethriel3695 for the fix!), so that we get CI checks before merging.

Issue: https://github.com/chromaui/chromatic-e2e/issues/131

What Changed

From documentation:

When true, will disable the snapshot that happens automatically at the end of a test when using the Chromatic test fixture.

I believe currently when disableAutoSnapshot is set to true we are not proceeding to the prepareArchives task, so rather than disabling the automatic snapshot we are disabling all snapshots

I also disabled Codacy's duplication rule for test directories.

How to test

  1. Set up a Cypress project on Chromatic (following these instructions) -- make sure you're using the canary release from this PR
  2. set disableAutoSnapshot: true globally
  3. Run Cypress
  4. Verify the cypress/downloads/chromatic-archives directory has an empty storybook
  5. Inside a test, call cy.takeSnapshot()
  6. Run Cypress again
  7. Verify the cypress/downloads/chromatic-archives is populated and has a non-empty storybook
  8. Run Chromatic
  9. Verify the test with cy.takeSnapshot() has a story with the UI that it would have had at that point in the test
  10. Set disableAutoSnapshot: false globally
  11. Run Cypress again
  12. Run Chromatic again
  13. Verify that automatic and manual snapshots are all captured
codacy-production[bot] commented 4 months ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: +0.00% (target: -1.00%) :white_check_mark: (target: 80.00%)
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (3ff2278cabfac53aa7e0b6552263ae2a7085b0f1) | 225 | 215 | 95.56% | | | Head commit (1c9f6d6ee9f6b1d3c21b7152235b6a37428ae02a) | 225 (+0) | 215 (+0) | 95.56% (**+0.00%**) | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#143) | 0 | 0 | **∅ (not applicable)** | **Diff coverage** is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: `/ * 100%`

See your quality gate settings    Change summary preferences

Codacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more

skitterm commented 4 months ago

@tevanoff this is ready for your re-review! I disabled Codacy's duplication rules for test directories as well.