Is there a way to redact a particular element from an image in xcode? We are doing snapshot tests and currently we cropping the images where needed or just taking snapshots of particular elements to avoid this issue, but we would like to be able to take an image and redact a certain element that could potentially keep changing like a date/time field.
Asked
Active
Viewed 55 times
1 Answers
0
You can change the UIImage
/NSImage
of element (depending on platform)
Read the documentation here https://developer.apple.com/documentation/xctest/xcuiscreenshot/2897658-image
Also, there is a tool SUITCase
designed for screenshot testing and capable of cropping elements and erasing dynamic views.
https://github.com/devexperts/suitcase/
With SUITCase you can do such verifications:
verifyScreenshot(withoutQuery: app.staticTexts)

Roman Zakharov
- 2,185
- 8
- 19