haim-io / cypress-image-diff

Visual regression test with cypress
MIT License
251 stars 62 forks source link

Missing cucumber report when using cypress-image-diff and cypress-cucumber-preprocessor #222

Closed KaiWissel closed 3 months ago

KaiWissel commented 3 months ago

Hi folks,

after including the image diff plugin to our project which has already the cucumber preprocessor plugin configured, I encountered the problem that my cucumber reports (HTML and JSON) will not be generated anymore.

I couldn't find any hints in the documentation of image diff or the cucumber plugin. Has anyone faced the same problem and can point me in the correct direction? I guess the image diff plugin overwrites some hook for the cucumber report.

I'm using the following versions for Cypress and different plugins (in fact everything up-to-date): "cypress": "13.12.0", "@badeball/cypress-cucumber-preprocessor": "20.1.0", "cypress-image-diff-html-report": "2.1.2", "cypress-image-diff-js": "2.2.1",

My cypress setupNodeEvents looks like this:

export const setupNodeEvents = async (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {

  await addCucumberPreprocessorPlugin(on, config);

  on(
    'file:preprocessor',
    browserify(config, {
      typescript: require.resolve('typescript'),
    }),
  );

  on('task', {
    // ...
  });

  on('task', {
      // ...
  });

  on('after:run', async () => {
    await afterRunHandler(config);
    // ...
  });

  return getCompareSnapshotsPlugin(on, config);
}
kien-ht commented 3 months ago

It looks like it's a duplicate issue. Please take a look at #183 and #177

KaiWissel commented 3 months ago

@kien-ht thanks a lot. The proposed solution in https://github.com/haim-io/cypress-image-diff/issues/183 worked 👍