Skip to content
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

different images on Intel and Apple M1 #174

Open
kikeenrique opened this issue Feb 1, 2022 · 5 comments
Open

different images on Intel and Apple M1 #174

kikeenrique opened this issue Feb 1, 2022 · 5 comments

Comments

@kikeenrique
Copy link

I'm seeing some tests with different binary image results on a Mac with Intel and a Mac with Apple M1.
The diff image is all grey, so I guess it's just some bits.

Has anyone also seen this problem?

@tahirmt
Copy link

tahirmt commented Feb 5, 2022

I've seen the same issue. I have to use Rosetta on the project to keep compatibility with CI and other team members.

@acecilia
Copy link

acecilia commented Feb 9, 2022

The issue is well known and tracked here

@davidme-stripe
Copy link

davidme-stripe commented Apr 13, 2022

This project already supports a perPixelTolerance parameter, which behaves similarly to the swift-snapshot-testing PR linked in the above thread. I've found that setting this to 0.02 (2%) allows my snapshot tests to pass on both M1 and Intel.

Here's a convenience wrapper in Swift:

public extension FBSnapshotTestCase {
    func FBSnapshotTolerantlyVerifyView(_ view: UIView, identifier: String? = nil, suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), perPixelTolerance: CGFloat = 0.02, overallTolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
        FBSnapshotVerifyView(view, identifier: identifier, suffixes: suffixes, perPixelTolerance: perPixelTolerance, overallTolerance: overallTolerance, file: file, line: line)
  }
}

And in Objective-C:

#define FBSnapshotTolerantlyVerifyView(view__, identifier__) \
FBSnapshotVerifyViewWithPixelOptions(view__, identifier__, FBSnapshotTestCaseDefaultSuffixes(), 0.02, 0)

Hope this helps!

@Deco354
Copy link

Deco354 commented Apr 22, 2022

This project already supports a perPixelTolerance parameter, which behaves similarly to the swift-snapshot-testing PR linked in the above thread. I've found that setting this to 0.02 (2%) allows my snapshot tests to pass on both M1 and Intel.

This works for me, when the snapshot was created on an M1 I need to add 0.002 (0.2%) overallTolerance as well.

@tdrhq
Copy link

tdrhq commented May 4, 2023

We record screenshots in the same environment we verify them (i.e. we never record on developer devices). That solves the problem quite well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants