Closed markst closed 1 year ago
Happy to work on this, but not sure how we might conditionally use a delay.
Perhaps PrefireProvider
could expect a config to be returned which could have some additional attributes?
Yes, I think we can make a configuration that will provide some custom settings for Snapshots. For example, add delay and accuracy there:
struct TestView_Previews: PrefireProvider {
static var previews: some View {
TestView()
.snapshot(delay: 0.1, precision: 1)
}
}
@BarredEwe not sure view modifier will work given we can't capture the preference synchronously.
unless we triggered a draw of the view prior to assertSnapshot
?
I made this improvement and posted a pull request 🥳
In our views we have
UIImageView
which fetches from an image url.For testing purposes these test assets are loaded from load bundle:
But for snapshots to work there needs to be a minor delay for completion closures to be called in which to display the image.
i.e: