chromaui / chromatic-e2e

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

Cypress: Electron can be used in interactive mode #72

Closed skitterm closed 5 months ago

skitterm commented 5 months ago

Issue: #AP-4060

What Changed

Resolves a bug where when running Cypress in interactive mode (cypress open) and using the Electron browser, the tests would not run at all.

Got around this by not expecting users to prepend their cypress open command with ELECTRON_EXTRA_LAUNCH_ARGS variable (like we require them to do for cypress run).

In interactive mode, we don't listen to CDP or take snapshots or write archives at all.

API Change

Instead of only passing on to our installPlugin function, we require config to be passed as well (so we can know if they are in interactive mode on the server side of things).

So it's now:

import { defineConfig } from 'cypress';
import { installPlugin } from '../src';

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      // `config` now supplied to `installPlugin`
      installPlugin(on, config);
    },
  },
});

How to test