Open darknoon opened 3 years ago
Any luck with this? I can not run the tests on a simulator, thus I need to run them on a real device too...
You can actually make it work without modifying the library. Just use verifySnapshot
which takes snapshotDirectory
as an argument. Then all you have to do is place your snapshot images in a folder that gets packed into the bundle and then specify correct path for snapshotDirectory
. That usually means that you can not keep your reference images in the __Snapshots__
folders next to the source, but I was ok with moving them all into one folder with some subfolders.
@darknoon , any update?
Bump
Snapshot testing is great and saves an immense amount of time vs manually checking data structures or images / tests. However, some tests need to be run on actual devices for correctness.
Why
One use case is apps that make heavy use of Metal API
The way that swift-snapshot-testing tracks snapshot data currently does not work when the test app does not run where the source root is accessible (iOS, macOS sandbox). This has been mentioned before, eg https://github.com/pointfreeco/swift-snapshot-testing/issues/193 , perhaps https://github.com/pointfreeco/swift-snapshot-testing/issues/176#issuecomment-467328614
Proposed approach
__Snapshot__
directories are copied into test bundle before testing beginsXCTAttachment
DerivedData/Project-XXXXX/Logs/Test-Project-YYYY.xcresult
back to the source rootRelated
Going to see if I can get this working, interested to hear if anyone else is trying something similar