-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/precision parameter #121
Conversation
Hello! Which steps needs to be done to merge that pr? I'm really waiting for it 😄 |
@NickEntin pls review 🙏 |
Hey! Apologies, I was out on vacation and fell way behind on my GitHub queue. Would perceptual precision alone provide sufficient control for you? See the discussion in #63. From our testing we've found precision-based control can make it really easy for regressions to slip through, especially in larger snapshot images (which accessibility snapshots tend to be since they include the legend). I'm worried about making it very easy to accidentally undermine the confidence gained from these snapshots. Perceptual precision seems a bit safer than the standard precision parameter, though I'm doing some testing right now to confirm that. |
Welcome back, returning from vacation) |
I've got the same one for And I agree with @alexey1312 that its should be user's decision. It's also crucial to introduce compatibility between snapshots recorded and checked on different architectures (Intel/M1) or environments (older/newer macOS). |
I'm generally in favor of giving consumers control, but I think there's an important caveat: it needs to be very obvious when what you're doing might result in unexpected/undesirable behavior. You can see a good example of this in Swift's API with the "unsafe" terminology around memory (
Absolutely agreed that's a problem we need to solve. We're currently investigating some alternate approaches to comparing snapshots that are (hopefully) less prone to some of the issues we've seen with the existing precision/tolerance options, but don't have any ready to apply here quite yet. I'm open to at least temporarily introducing precision/tolerance as a workaround, but I think it's important to do so in a way that (a) limits the potential impact where possible, which is why I was asking if perceptual precision is sufficient and (b) makes it very clear you're opening the door to non-trivial regressions slipping through. What would you think about adding a copy of the verification methods with something like "imprecise" or "inexact" in the name, e.g. I'm also trying to gather some samples to better illustrate the problem (#124), but have been running into issues with our CI builds. 😞 Hoping to have some more concrete examples to show how regressions can slip through soon, so we can frame this discussion around real cases. |
@NickEntin Generally it sounds good, and my only concern is that's incompatible with API of BTW. I see in #124 that you only use |
@@ -36,7 +36,7 @@ let package = Package( | |||
.package( | |||
name: "SnapshotTesting", | |||
url: "https://github.com/pointfreeco/swift-snapshot-testing.git", | |||
.upToNextMajor(from: "1.8.0") | |||
.upToNextMajor(from: "1.11.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for SPM, but unfortunately we can't update the dependency past 1.9 for CocoaPods since SnapshotTesting dropped CP support in 1.10. Unfortunately this means our test suite won't compile right now (not sure why the CI job didn't run for this PR), since it uses the demo app as a host app, which uses CP to pull in its dependencies.
Yep, totally agreed. Unfortunately we've found that
That's fair, but since we provide a separate API already, I think it's okay to have two sets of methods. I'm going to decline this PR in favor of #143, which introduces the "imprecise"-prefixed variants. Note that it's currently a draft due to the same dependency issues this PR faces, as I commented on above. Thanks for opening this one @alexey1312 , appreciate it moving forward this conversation. |
This PR adds the precision and perceptualPrecision parameters to the different snapshot functions.
swift-snapshot-testing
version to1.11.0
.swift-snapshot-testing
#63
#64