Snapshot testing differences between local machine and Xcode Cloud

Hi,

I’m using the snapshot testing library from https://github.com/pointfreeco/swift-snapshot-testing

I recorded the snapshot tests on the iPhone 15 pro simulator on iOS 17.4 and Xcode 15.3 On my M1 Max MacBook Pro

Within the tests found in https://github.com/fespinoza/sample-json-app/blob/84b81ee3fa1d24e97bbeded65487b32258a42325/SampleProjectTests/MovieDetails/MovieDetailsViewTests.swift

I try to control all the traits and properties I can, to make sure the test is run in the same environment in Xcode Cloud

For some reason though, on Xcode Cloud, Text with multiline strings have a different line height than on my machine and thus the test fail

I don’t understand:

  • why that happens
  • how to debug this situation

Does anyone here have any pointers?

Reference Image

From my machine

Failure Image

from Xcode Cloud

P.S. thread initially posted in https://github.com/pointfreeco/swift-snapshot-testing/discussions/842 but i haven’t gotten any answers, trying here instead

Accepted Reply

In the GitHub discussion, someone mentioned

Did you compare the supported languages between your local simulator and CI simulator? The line height increases when you add a language like Hindi or Arabic as a supported language.

Which reminded me that I hadn't set up a test plan for the project. A test plan is one way to configure the language/region of the the app, which I set the same as I had locally on my machine, then, with this configuration, the test passed as expected

Replies

In the GitHub discussion, someone mentioned

Did you compare the supported languages between your local simulator and CI simulator? The line height increases when you add a language like Hindi or Arabic as a supported language.

Which reminded me that I hadn't set up a test plan for the project. A test plan is one way to configure the language/region of the the app, which I set the same as I had locally on my machine, then, with this configuration, the test passed as expected