meinaart / cypress-plugin-snapshots

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

Test don't fail when change text or color #100

Closed rwardanjan closed 4 years ago

rwardanjan commented 4 years ago

I have an issue with matching screenshots when changing colors. It will won't fail when changing color or changing the text. It will only fail when elements are not in the same place. Is there a way that he detects whether color or text changed?

franciscotrillo commented 4 years ago

What threshold are you using? The default configuration didn't work for me when changing text color. I set it up this way and it works:

// cypress.json
"env": {
    "cypress-plugin-snapshots": {
      "imageConfig": {
        "threshold": 0.01,
        "thresholdType": "pixel"
      }
    }
  }
rwardanjan commented 4 years ago

Thanks that worked! Is there a way to show more detail in the difference? Is this situation he is not showing the difference very good

guillaumebouhier commented 4 years ago

I had the same issue while changing the text of an Angular Material button. Test was passing with results displaying "Snapshots match" even though the text of the button was changed from "open" to "close".

When adding the configuration provided by @franciscotrillo to cypress.json it worked. It seems that default configuration is not applied for some reason.