Adopt SnapshotPreviews for iOS visual testing
Context
The iOS app needed visual regression testing — something like Chromatic or Storybook but for SwiftUI. The ecosystem in 2024 doesn't have a good middle ground: open source tools have poor visual diffing, and enterprise solutions (EmergeTools, Percy, Applitools) have hidden pricing.
Decision
Adopt SnapshotPreviews by EmergeTools. Tests are auto-generated from existing #Preview blocks, and the PreviewGallery provides an in-app component browser for development.
Known limitations
- Full visual diffing and test failures require EmergeTools' paid cloud service with non-transparent pricing
- Without the cloud service, it generates PNG attachments but doesn't fail tests on visual differences
- Multi-device regression testing deferred due to lack of affordable tooling
Consequences
The core promise (visual regression detection) doesn't work without the paid service, which limits the value as a testing tool. The PreviewGallery in-app browser was useful for a while but Xcode's built-in previews are sufficient.
The broader takeaway is that iOS visual testing tooling lags significantly behind web. This is likely to be superseded as Xcode's built-in preview snapshot capabilities mature and can be fed to LLM agents for visual verification.