Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Getting error while trying to use plugin cypress-plugin-visual-regression-diff (please, details in description) #308

Open
2 of 3 tasks
sakilandeswari opened this issue Dec 27, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@sakilandeswari
Copy link

Describe the Bug

while running cypress component with plugin cypress-plugin-visual-regression-diff, getting below error

command executed: npx nx run-many -t component-test -p bindings-ng-pos --parallel=false --skip-nx-cache --watch

Error
taskcp-visual-regression-diff-getScreenshotPathInfo, Object{4}, {log: false}
AFTER ALL (FAILED)
1
taskcp-visual-regression-diff-cleanupImages, {log: false}
CypressError
cy.task('cp-visual-regression-diff-cleanupImages') failed with the following error:

The 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task()

Fix this in your setupNodeEvents method here:

Steps to reproduce

Followed steps mentioned in the below page
https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff

Expected behavior

Visual comparison should work fine without any issue

no reference in document to resolve this issue

Additional context

No response

Package version

3.3.10

Device

Chrome Browser - Mac

OS and version

Mac OS Sonama 14.1.2 (23B92)

Browser and version

Chrome 120.0.6099.109

Node version

20.8.0

I can work on it by myself

  • Yes
  • No

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sakilandeswari sakilandeswari added the bug Something isn't working label Dec 27, 2023
@dsuchan
Copy link

dsuchan commented Apr 25, 2024

I don't know if this could be related, but i get the same error message in my cypress app, where i don't initialize the node event. I'm working in a big repo, where we have multiple e2e apps which some of them uses visual regression testing and some of them don't. The apps that doesn't need to use this feature doesn't have it initialized in setupNodeEvents. When the test finishes, it fails inside afterAll hook on exactly the same message. Is there any settings i need to use to skip this task if i don't want to use that?

@FRSgit
Copy link
Member

FRSgit commented Sep 14, 2024

Hello everyone!

Sorry for long delay in the response.
Please help me understand the issue. From what I know about the plugin inner workings. When you do the second step from the installation guide, this plugin sets up a global after hook in which it tries to automatically cleanup unused image files.
But, for this feature to work a cleanup task needs to be registered and the task registration happens only when you use initPlugin function within setupNodeEvents in your cypress.config file.

So, to sum up - if you do only first two steps of installation guide, you'll receive this error. And I guess that shouldn't be considered a bug?
But I might be wrong, so please give me more info about your scenarios for me to understand where the plugin/documentation fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants