📸 Automatic snapshots from Xcode previews. Supports UIKit/AppKit/SwiftUI on iOS/macOS/watchOS/visionOS/tvOS. Browse previews in-app with the Preview Gallery, or save them to PNGs with an XCTest
Most of the functionality in the old UI test PreviewTest is now in a unit test SnapshotTest. The old functionality still exists but is renamed to `AccessibilityPreviewTest. This UI test is now meant for using XCUIApplication's build in accessibility testing, which can't be done in the unit test. The unit test is faster and doesn't depend on the local network communication which was limiting and error prone.
There is also a new unit test called PreviewTest which does not snapshot, but performs a layout pass for each preview. This can be used to quickly unit tests that previews don't crash, such as when forgetting to add an object to the environment.
The demo app is updated to use all 3 of these tests, and to have examples of using these tests in the watch app target, which uses SwiftUIRenderer instead of AppKitRenderer
Most of the functionality in the old UI test
PreviewTest
is now in a unit testSnapshotTest
. The old functionality still exists but is renamed to `AccessibilityPreviewTest. This UI test is now meant for using XCUIApplication's build in accessibility testing, which can't be done in the unit test. The unit test is faster and doesn't depend on the local network communication which was limiting and error prone.There is also a new unit test called
PreviewTest
which does not snapshot, but performs a layout pass for each preview. This can be used to quickly unit tests that previews don't crash, such as when forgetting to add an object to the environment.The demo app is updated to use all 3 of these tests, and to have examples of using these tests in the watch app target, which uses
SwiftUIRenderer
instead ofAppKitRenderer