facebookarchive / ios-snapshot-test-case

Snapshot view unit tests for iOS
MIT License
2.66k stars 253 forks source link

Testing View Across Devices in Simulator #231

Open alextakahashi opened 7 years ago

alextakahashi commented 7 years ago

I know in the Realm UI and Snapshot Testing Video Luis mentioned that we can test views across devices (iPhone5 vs iPhone 6+ etc).

I want to know which device I am running on within simulator, but when I print out the model name

let modelName = UIDevice.current.modelName

It would just say I am running in Simulator.

I was following this Stack Overflow post How to determine the device running in the simulator? but using FBSnapshotTestCase is not necessarily related to "functionalities available". Has anyone ran into a similar problem?

alanzeino commented 7 years ago

Probably use sysctl.h, like this library does:

https://github.com/InderKumarRathore/DeviceUtil/blob/master/DeviceUtil.m