Show Menu
Cheatography

UI Testing with Swift Cheat Sheet (DRAFT) by

How do I test this with UI Testing?

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Testing if an element exists

XCTAssert(app.staticTexts["Welcome"].exists)

Waiting for an element to appear

let goLabel = app.staticTexts["Go!"]
XCTAssertFalse(goLabel.exists)

app.buttons["Ready, set..."].tap()
XCTAssert(goLabel.waitForExistence(timeout: 5))
"­Wai­tin­g" is now built into XCTest.