haim-io / cypress-image-diff

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

Cypress integration broken: The deleteScreenshot 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task() #202

Closed sakilandeswari closed 7 months ago

sakilandeswari commented 9 months ago

I am facing the above error while running component test case

My project is Nx project and build in typescript. i have updated configuration here, please, suggest me what is wrong in this and how to get away from this issue

Command to run test case - npx nx run-many -t component-test -p bindings-ng-pos --parallel=false --skip-nx-cache --watch

"cypress": "^13.0.0",
"cypress-image-diff-html-report": "^2.0.2",
"cypress-image-diff-js": "^2.1.3",

cypress.config.ts import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing'; import { defineConfig } from 'cypress'; import getCompareSnapshotsPlugin from 'cypress-image-diff-js/plugin'

export default defineConfig({ component: nxComponentTestingPreset(__filename), setupNodeEvents(on, config) { return getCompareSnapshotsPlugin(on, config) }, fixturesFolder: '../../../apps/store/src/assets/mockdata/storefacade/api/storefacade/', includeShadowDom: true, viewportWidth: 1024, viewportHeight: 720, reporter: '../../../node_modules/cypress-multi-reporters', video : false, reporterOptions: { reporterEnabled: 'mochawesome', mochawesomeReporterOptions: { reportDir: '../../../dist/cypress/reports/json', quite: true, overwrite: false, html: false, json: true }, }, });

commands.ts

import compareSnapshotCommand from 'cypress-image-diff-js/command'; import { RecurseDefaults } from 'cypress-recurse'; compareSnapshotCommand();

component.ts

import compareSnapshotCommand from 'cypress-image-diff-js/command' import { RecurseDefaults } from 'cypress-recurse'; compareSnapshotCommand()

test script cy.compareSnapshot('component-testing', 0.2)

kien-ht commented 9 months ago

@sakilandeswari With your given details, I can't address the issue. Could you please provide a minimal reproduction about the issue you're facing?

sakilandeswari commented 9 months ago

@kien-ht - i have followed the steps given in the documentation and ended up with the above issue - hence, interested to check if any config missed in document and to be done during setup to overcome this issue

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 7 months ago

This issue was closed because it has been inactive for 30 days since being marked as stale.