meinaart / cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io
MIT License
498 stars 117 forks source link

<svg> snapshots are not working in headless mode #102

Closed louis-vinchon closed 4 years ago

louis-vinchon commented 4 years ago

Describe the bug

elements image snapshots do not work as intended. **To Reproduce** Try to `cy.get('svg').toMatchImageSnapshot({ name: 'test' });` **Expected behavior** A valid png image of the svg as it is rendered in the browser. **Desktop:** - OS: Linux - Cypress Version 4.1 **Additional context** I have a couple representations in my website that I would love to do visual regression tests on, unfortunately it does not work, I have observed two behaviors: - when taking a snapshot of a parent element: there is a black box instead of the svg. - when taking a snapshot of the svg element itself: the plugin registers an invalid PNG `Fatal error reading PNG image file: Invalid IHDR data` (when I try to open the png). I also sometimes get an error from the plugin when running the tests that says `RangeError: The value "-530376" is invalid for option "size"`.
louis-vinchon commented 4 years ago

Strangely I have an other that works fine. I don't know what's wrong with the other two.