Hi everyone,
In the Apple overview page of Xcode Cloud, I can see this image of the result of a test executed with Xcode Cloud:
The attachements of the test are displayed as a full image. But on my side, the attachements are displayed inline and not as a full image preview. I can still QuickLook them but they are always collapsed.
I created an extensions of XCTestCase to easily generate screenshot attachements for my UI tests:
extension XCTestCase {
/// Take a screenshot of a given app and add it to the test attachements.
/// - Parameters:
/// - app: The app to take a screenshot of.
/// - name: The name of the screenshot.
func takeScreenshot(of app: XCUIApplication, named name: String) {
let screenshot = app.windows.firstMatch.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
#if os(iOS)
attachment.name = "Screenshot-\(name)-\(UIDevice.current.name).png"
#else
attachment.name = "Screenshot-\(name)-macOS.png"
#endif
attachment.lifetime = .keepAlways
add(attachment)
}
}
And use it like so on my UI Test:
final class LocalizationTests: XCTestCase {
override class var runsForEachTargetApplicationUIConfiguration: Bool {
true
}
func testLaunchScreen() throws {
let app = XCUIApplication()
app.launch()
takeScreenshot(of: app, named: "Launch")
}
}
Here is also my test plan configuration:
There are a lot of WWDC sessions about Xcode Cloud and unit testing, but I couldn't find one of them that talks about this feature. Maybe I'm missing something really obvious, but this feature would be a super nice addition to my workflow. I'm using Xcode 14.1 (14B47b) and macOS Ventura 13.0.1 (22A400).
Does anyone know if it is possible to replicate the behavior showed on the Apple website? Thanks in advance for your help.