I am testing the new UI testing functionality of Xcode 7 (introduced in the WWDC 2015 video \"UI Testing in Xcode\").
On launch, my app animates a \"login panel\" into v
I would recommend against ticking the run loop and instead use the built in XCTest
asynchronous API. For example:
let app = XCUIApplication()
app.launch()
let textField = app.textField["user name"]
let existsPredicate = NSPredicate(format: "exists == 1")
expectationForPredicate(existsPredicate, evaluatedWithObject: textField, handler: nil)
waitForExpectationsWithTimeout(5, handler: nil)
textField.tap()
textField.type("joemasilotti")
This will wait until the text field with accessibility label/identifier "username" actually exists on the screen. Then it will tap on the text field, making it active, and type my username. If five seconds pass before this becomes true the test will fail.
I have also written a post on how to use UI Testing on my blog and put together a UI Testing Cheat Sheet for scenarios like this.