The image obtained from a static website appears to vary with each download. #808
Unanswered
SavvyOsive
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm utilizing the spatie/browsershot library to fetch a PNG from a given URL. Subsequently, I employ the spatie/phpunit-snapshot-assertions library to ensure that the image, as well as the UI elements such as text, logo, and colors, remains unaltered by any developer within the company.
To accomplish this, I'm employing the assertMatchesFileHashSnapshot() method, adhering to the requirement of using a hash for comparison. However, there seems to be inconsistency in hash matching, potentially due to variations in the image retrieved from the static website with each download.
This is how the code looks like
This test is unsuccessful because Browsershot does not consistently download identical images, even after attempting to use the assertMatchesImageSnapshot() method.
I'm seeking recommendations on the most effective approach to address this issue. Additionally, I'm curious about why the Browsershot library tends to download different images for the same static website on each test run. If anyone can provide insights into handling or resolving this matter, it would be greatly appreciated.
@freekmurze
Beta Was this translation helpful? Give feedback.
All reactions