-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advice for handling visual discrepancies between Intel and Apple Silicon images #302
Comments
There are also discrepancies between macOS and Ubuntu. The font weight rendered in Ubuntu is lighter compare to macOS. This causes the test to fail as I use macOS locally but the CI is based on Ubuntu. |
Hi, any updates for this issue? I also encounter discrepancies between Intel and Apple Silicon images and still have no idea how to handle this. |
For me, what I ended up doing is to create different sets of snapshots for different OS/platform. |
I've just ended up setting a expect(screenshot).toMatchImageSnapshot({
failureThreshold: 0.005,
failureThresholdType: 'percent'
}); reference: The LogRocket Blog Article |
I run the tests in an Ubuntu container using Docker for deterministic results. Dockerfile:
My yarn scripts:
|
We've opted for this pragmatic approach:
Not ideal, but since CI isn't darwin nothing should slip through undetected. |
https://github.com/justland/just-web-react/actions/runs/5792587155/job/15699083890 Expected image to match or be a close match to snapshot but was 0.06825086805555555% different from snapshot (629 differing pixels). I have this case where the snapshot generated locally from ubuntu in WSL and the one in the CI doesn't match.
|
How did you do that? |
I do this: customSnapshotsDir: `${process.cwd()}/__snapshots__/${process.platform}` |
The rendering discrepancy has caused text layout to shift and wrap depending on if I run the tests locally (Apple silicon) vs in an Ubuntu CI pipeline that the difference between images is greater than 30%. This makes setting a custom failure threshold unhelpful as it will not catch smaller changes anymore, which IMO is the whole point of image snapshot testing. I am attempting to run them locally in a docker container now, but the issue I run into is that it maxes out the CPU and causes tests to start timing out (even with a generous test timeout). |
Does anyone have advice on how best to handle the visual discrepancies between an image produced on an Intel machine vs an Apple Silicon machine for VR testing?
I'm encountering differences in how drop shadows are rendered. Enough to trip up
jest-image-snapshot
unless i set the pixel tolerance excessively high.My setup is running Chromium via Puppeteer on a multi-arch docker image running Debian 12. It seems like shadow differences are common
Has anyone tackled this problem successfully yet?
The text was updated successfully, but these errors were encountered: