How to write a UI Test (XCTestCase) that waits for a UISwitch to be enabled.
I added this code to one of my tests but it timed out:
let firstSwitch = XCUIApplication().switches.elementBoundByIndex(0)
_ = self.expectationForPredicate(
NSPredicate(format: "self.value = %@", enabled),
evaluatedWithObject: firstSwitch,
handler: nil)
self.waitForExpectationsWithTimeout(15.0, handler: nil)