Configuring Global precision Value for Reuse Across Snapshot Tests #829
Life-run9723
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, swift-snapshot-testing Community,
I've been leveraging swift-snapshot-testing for UI snapshot testing in my iOS projects and it's been incredibly useful for ensuring UI consistency across app updates. However, I've encountered a scenario where I need to set a global precision value that can be reused across all snapshot tests in my suite.
Currently, in every snapshot test, I specify the precision for the snapshot comparison like so:
This approach requires me to repeat the precision value in every test case, leading to duplication and making it cumbersome to maintain, especially if the precision needs to be adjusted across all tests.
I'm looking for a way to configure this precision value once, in a central location, and have it applied to all my snapshot tests. This would simplify the process of updating the precision value and ensure consistency across tests.
One idea I had was to create a base class for all snapshot tests that configures common settings, including precision. Here's a basic implementation:
All snapshot tests would inherit from this base class, utilizing the verifySnapshotViewWithGlobalPrecision method to enforce the global precision setting.
I'm curious if there's an existing, perhaps more integrated approach within the swift-snapshot-testing framework, or if there are any plans to support global configurations for parameters like precision. Feedback or suggestions from the community and maintainers would be greatly appreciated!
Thank you for your time and for the great work on this library!
Beta Was this translation helpful? Give feedback.
All reactions