nirav
nirav

Reputation: 651

Capture screen recording with UITesting in Swift

Is there any tool or service for capturing screen-recording or screenshot with UITesting?

I do not want snapshot testing from https://github.com/pointfreeco/swift-snapshot-testing.

Thank you,

Upvotes: 2

Views: 912

Answers (1)

Reinier Melian
Reinier Melian

Reputation: 20804

You can configure it in the scheme

enter image description here

First you need to remove checkmark in "Delete when each test succeeds" remove checkmark in "Delete when each test succeeds" in attachments section too

Then you can find the screenshots in test logs

enter image description here

You can also take screenshots of different components using screenshot()

let screenShot = emailTextField.screenshot()
let emailScreenAttachment = XCTAttachment(screenshot: screenShot)
emailScreenAttachment.name = "screnshot of email textField"
emailScreenAttachment.lifetime = .keepAlways
add(emailScreenAttachment)

Upvotes: 2

Related Questions