Jun 09, 2015:  ~ 1 min read

Xcode UI testing

This is really, really awesome. Run your app and press the record button (next to the enable/disable breakpoints): as you navigate your app, code will be automatically generated. A quick test for LTHMonthYearPickerView:

let app = XCUIApplication()
let toolbar = app.toolbars

app.pickerWheels["2015, 46 of 91"].swipeUp()

let textField = app.children(matching: .window)
	.element(boundBy: 0)
	.children(matching: .textField)
	.element(boundBy: 0)

XCTAssertTrue(textField.value as? String == "June / 2034")
XCTAssertFalse(textField.value as? String == "June / 2033")

The value property is, as described in the documentation:

The raw value attribute of the element. Depending on the element, the actual type can vary.
Subscribe to my monthly newsletter.
No spam, unsubscribe at any time.