Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle attached screenshots #357

Open
idrougge opened this issue Jul 2, 2019 · 0 comments
Open

Handle attached screenshots #357

idrougge opened this issue Jul 2, 2019 · 0 comments

Comments

@idrougge
Copy link

idrougge commented Jul 2, 2019

Since a while, XCUITest can take screenshots by itself and "attach them" to the .xcresult file for inspection in Xcode. I use that to snapshot the state when a UI test fails:

    override func recordFailure(withDescription description: String, inFile filePath: String, atLine lineNumber: Int, expected: Bool) {
        let screenshot = app.screenshot()
        let screenshotAttachment = XCTAttachment(screenshot: screenshot)
        screenshotAttachment.name = "\(name)-screenshot"
        screenshotAttachment.lifetime = .deleteOnSuccess
        add(screenshotAttachment)
        super.recordFailure(withDescription: description, inFile: filePath, atLine: lineNumber, expected: expected)
    }

This seems to be ignored by xcpretty, even when specifying the --screenshots command line argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant