You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It says 0.2 means the pixel difference is 0.2% from README.md.
cy.get('h1').compareSnapshot('homePage', 0.2) // will compare only the image of h1 element and fail only if the percentage of pixels that are different is bigger than 0.2%
However, the percentage doesn't multiple by 100 in source code. I think the range of percentage is from 0 to 1 now.
Thanks for raising the issue, you are right, it is confusing. It was always represented as a decimal range 0-1, and we've always referred to it as the percentage. In the following PR I reworded it a little bit to make it clearer and fixed my 0.2% mistake.
For the square root part, you are again right, removing ** 0.5 and calculating the percentage by hand gives the correct numbers, I can't imagine why it was there in the first place for a straightforward pixel difference calculation. @mjhea0 maybe you could weigh in on this one? 🤔
The result of
percentage
makes me confused.It says
0.2
means the pixel difference is0.2%
from README.md.However, the
percentage
doesn't multiple by100
in source code. I think the range ofpercentage
is from 0 to 1 now.In conclusion,
0.2
should not translated to0.2%
, it means20%
.By the way, I suggest to remove
** 0.5
when calculatepercentage
. It seems haim-io/cypress-image-diff#184 has similar request too.The text was updated successfully, but these errors were encountered: