cypress-component-testing-examples icon indicating copy to clipboard operation
cypress-component-testing-examples copied to clipboard

UNIFY-68-vite-cypress-screenshot

Open jaffrepaul opened this issue 2 years ago • 0 comments

https://cypress-io.atlassian.net/browse/UNIFY-68

Note:

  • Plugin works as expected in /create-react-app example. Although there seems to be an issue with the plugin itself, where subsequent runs error on the image diff algorithm when they should be exactly the same. I bumped the threshold config to 1.00 just to avoid this. But it seems this would be a sizable issue that wouldn't instill confidence. *This is an aside and not related to the objective of this effort

  • Plugin does not work in the /vite-react or /vite-vue examples. It would seem that the Vite config is trying to run some Node code in the browser. There are some (seemingly related) community issues with this, e.g https://github.com/vitejs/vite/issues/728 The library is potentially inserting require statements which won't jive the Vite ESM flow.

I got this error from simply adding the plugin, before even adding the assertions. Which is discussed in the above issue thread. The plugin is using a crypto library to generate random tokens here- https://github.com/meinaart/cypress-plugin-snapshots/blob/master/src/config.js

Attempted to side step that with a hardcoded token and started getting errors in the Cypress command log about not finding a process. So there seem to be multiple issues with server code trying to run in the Cypress browser instance.

This is currently branched off of the code coverage branch, but confirmed the same result when using main as the base branch.

jaffrepaul avatar Oct 18 '21 15:10 jaffrepaul