Xcode: enable snapshotting of XCUIElement in UI tests

Originator:ricardopereira.eu
Number:rdar://42657299 Date Originated:27-Jul-2018 12:15 PM
Status:Closed Resolved:
Product:Developer Tools Product Version:9.3.1
Classification:Enhancement Reproducible:Not Applicable
 
Summary:
This is a duplicate of radar #24193438

Currently, UI testing is limited in its ability to verify the actual visual state of any given application. This severely limits its use for certain types of application testing where visual validation beyond frame positioning is required - i.e., dynamic loading of content into consistently-sized elements.

This feature is especially important for SDK or tooling development, and will lead to more robust tools for the community at large. Snapshotting allows comparing visual state of live tests against a recorded "known correct" image that provides additional verification and additionally has implications for computer vision or accessibility research (not that this is the responsibility of Apple; these tools would be produced by developers.)

Thus it would be useful to have a -(UIImage*)snapshot method (or similar) on XCUIElement (to capture view state; presumably XCUIApplication would capture the entire view state).

Steps to Reproduce:
Not applicable.

Expected Results:
Some way to produce a -(UIImage*) or other image/bitmap snapshot of a live test run from an XCUIElement.

Actual Results:
No way to produce an image.

Version:
9.3.1

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!