swift-snapshot-testing
swift-snapshot-testing copied to clipboard
runsForEachTargetApplicationUIConfiguration not respected
XCTestCase supports the property runsForEachTargetApplicationUIConfiguration which will cause each test to be run in each of the apps supported orientations and color schemes/appearances.
When using assertSnapshot on a view/view controller, the captured image will be in whatever color scheme is set on the simulator, even though the test appears to configure the mode as it runs. In effect, all of the snapshots will be identical.
The only way to override the behaviour is to disable runsForEachTargetApplicationUIConfiguration and manually set the trait for each desired orientation/appearance.
I think the problem is that runsForEachTargetApplicationUIConfiguration expects the test to use XCUIApplication, which is not used when snapshotting. I don't know that assertSnapshot can support the automatic application of each orientation/appearance when enabled, as it doesn't have access to the setting.