swift-snapshot-testing icon indicating copy to clipboard operation
swift-snapshot-testing copied to clipboard

Run snapshot test directly in Swift Package Manager (SPM) containing SwiftUI views

Open XRadevFRT opened this issue 2 years ago • 3 comments

Greetings everyone! The title pretty much says it all. Im currently exporting the UI in a SwiftPM and because there are already XCTest I was wondering if there is a way to directly snapshot the UI in the package...

XRadevFRT avatar May 12 '23 11:05 XRadevFRT

You can set up and run the tests from your package.

You can take a look here:

https://github.com/criticalmaps/criticalmaps-ios/tree/main/CriticalMapsKit/Tests/StyleguideTests

mltbnz avatar Jun 07 '23 04:06 mltbnz

@mltbnz

Thank You! By chance, I managed to make them work. But still, your answer is beneficial to me.

One thing I couldn't do, however, is to generate images for the failing tests... Help will be much appreciated! 🍻

XRadevFRT avatar Jun 07 '23 07:06 XRadevFRT

I think I don't know what you referring to. If you mean the failure screenshot when a test fails you will see them in Xcode

image

mltbnz avatar Jun 07 '23 07:06 mltbnz