facebookarchive / ios-snapshot-test-case

Snapshot view unit tests for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot create snapshots in different screen sizes at the same time

matibzurovski opened this issue · comments

I want to verify that my views are correctly rendered for the following screen sizes: iPhone 4, iPhone 5, iPhone 6 & iPhone 6 Plus.

Therefore, I have a method I would call from each test that does something like this:

func verifyAllScreenSizes(viewController: UIViewController) {
    verifyIphone4(viewController)
    verifyIphone5(viewController)
    verifyIphone6(viewController)
    verifyIphone6Plus(viewController)
}

For most of my tests, this code works fine. However, in some particular cases, the snapshot is rendered only in verifyIphone4(viewController). In the rest of the cases, a reference image is created (when running with recordMode = true) with the correct size but it contains just an empty image.

What is even stranger, is that if I remove the first line of verifyAllScreenSizes(viewController: UIViewController), then a snapshot is correctly created for an iPhone 5, but not for the other 2 cases.

There is nothing special about the scenarios where the images are only rendered for one screen size. Any ideas on this?

@matibzurovski Could you upload some sample project to debug your problem?