chromaui / chromatic-e2e

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

Chromatic options for Cypress #59

Closed skitterm closed 6 months ago

skitterm commented 6 months ago

Issue: #AP-3793

What Changed

Passing Chromatic options

To use these values in Cypress, you can apply at a global level:

// cypress.config.ts
export default defineConfig({
  env: {
    diffThreshold: 0.58
  },
  e2e: {
    setupNodeEvents(on, config) {
      installPlugin(on);
    },
  },
});

or at a test-specific level:

// some-test.cy.ts
it('A test that does something', { env: { diffThreshold: 1 } }, () => {
  cy.visit('https://some-url.com');
});

Limitations

We still can't do external domain archiving at a test-specific level in Cypress yet, since we're using one watcher for all the tests (global-config for external domain archiving should work fine). I'll tackle that work in a follow-up PR.

How to test