facebookarchive / ios-snapshot-test-case

Snapshot view unit tests for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deviceAgnostic strictly enforces key window requirement unnecessarily

alanzeino opened this issue · comments

In our testing, host applications are not a hard requirement for snapshot tests. @bgerstle added this in #137. Would you object to me changing this code to not raise an exception?

In our setup, we have thousands of snapshot tests without host applications. But we cannot use deviceAgnostic to have OS–specific snapshot file names because fb_strictKeyWindow raises an exception if there is no key window.

From what I can tell, this window is used only to get the bounds to use in the file name. But when it is removed, the bounds used for the file name is 0x0.

Alternatively instead of removing the exception we can split deviceAgnostic into deviceAgnostic and osAgnostic, which would allow for leaving the exception since it might make sense to have non–zero sizes in those file names while still having the OS version in the path without the exception.

I have the same issue. Can't figure out how to run this test properly with deviceAgnostic flag enabled. Any clues?

We have this fixed in our fork which we're hoping to open soon (#245). In the meantime, you can just remove the NSException in fb_strictKeyWindow but you'll also have to fork.