I have a fairly normal XCTest UI
test for a Mac application which clicks some menu items in the application menu to open a window.
In some places - like my own Mac - the tests work fine. But in other places - like on Travis CI
- they fail, with this error:
UI Testing Failure - Failed to receive event delivery confirmation within 2.5s of the original dispatch.
...
menuBarsQuery.menuBarItems["Top level menu item"].click()
menuBarsQuery.menuItems["Menu item in sub menu"].click()
System:
- Mac OS 10.11.5
- Xcode 7.2.1
- Mac OS SDK version: 10.11.2
- Swift 2.1.1
Slightly sanitised version of the test case:
import XCTest
class FooUITests: XCTestCase {
override func setUp() {
super.setUp()
continueAfterFailure = false
XCUIApplication().launch()
}
override func tearDown() {
super.tearDown()
}
func testCanDoSomething() {
let app = XCUIApplication()
let menuBarsQuery = app.menuBars
menuBarsQuery.menuBarItems["Top level menu item"].click()
menuBarsQuery.menuItems["Menu item in sub menu"].click()
let window = app.windows["Foo"]
// Rest of test, assertions, actions in window etc.
}
}
It's not reproducible locally, so I'll ask the audience... why would this error happen?