facebookarchive / ios-snapshot-test-case

Snapshot view unit tests for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snapshots differ between Xcode and buck/xctool

alanzeino opened this issue · comments

Posting this in case someone at Facebook has more insight into this issue — we routinely see issues where a snapshot that passes in Xcode doesn't pass in buck (via xctool).

Regenerating the snapshot in one setting (either Xcode or on the command line via Buck), invalidates it for the other setting.

Are we missing something? The difference is typically seen in UIViews with a corner radius set.

Not sure of the exact cause, but we're deprecating xctool in favor of fbxctest so it might be a good idea in any case to move as well.

cc: @lawrencelomax in case he might have some ideas.

@ryu2 - That's actually awesome/sensible news!

fbxctest does launch Simulators slightly differently, but I'd be surprised if this affects the output of the screen. This should be possible to test by changing the options to be 0 here

Thanks for the responses.

I took a go at using fbxctest by plugging it in to our buckconfig, unfortunately the issue persists, even with Lawrence's proposed change.

My guess is it's something we've done in our setup that is causing this.

We didn't end up finding out why buck/xctool was causing this issue.

However, for the affected tests we found that enabling usesDrawViewHierarchyInRect and re–generating the snapshots would fix it.

That can only be done on a case–by–case basis because usesDrawViewHierarchyInRect — which in turn uses drawViewHierarchyInRect:afterScreenUpdates: — is about 10x slower than the CoreGraphics default snapshot method.