percy / percy-cypress

Visual testing with Cypress and Percy
https://percy.io
MIT License
346 stars 40 forks source link

Fix multiple snapshots in one 'it' block when styled-components are being used #94

Closed timhaines closed 5 years ago

timhaines commented 5 years ago

Currently if you try to take multiple percySnapshots in a single test, if you're using styled-components to apply styles, sometimes the styles won't be correctly captured in the second and subsequent snapshots.

The fix to this requires changing how we capture CSSrules that have been added to the CSSOM.

katerynarieznik commented 5 years ago

Hi @timhaines 👋 As you know I am interested in this fix 🙂 Do you know when a team will work on it? It stops me from using Percy with Cypress, because I do not want to create new it for each snapshot that I want to have. Thank you :)

katerynarieznik commented 5 years ago

Really looking forward to this fix 🙏

timhaines commented 5 years ago

Hi all, we shipped an update to one of the dependencies (@percy/agent) that should fix this. Can you update to @percy/agent v0.5.1 and give it a try please? Let us know what you see, and I'll close this issue after a couple of successful reports. (cc: @rieznik)

Robdel12 commented 5 years ago

You can check to see which version of @percy/agent you have by running either yarn list @percy/agent or npm ls @percy/agent and make sure the output has 0.5.1 or greater.

If it's not 0.5.1, make sure you're on the latest version of the Cypress SDK (@percy/cypress) & try running yarn upgrade @percy/cypress or npm update @percy/cypress. That should update the dependency in your lock files

katerynarieznik commented 5 years ago

Thank you! 🤗 It works now. At least for that case that was broken before.

timhaines commented 5 years ago

Thanks for confirming @rieznik! 😄 Closing this issue now.