zalando / SwiftMonkey

A framework for doing randomised UI testing of iOS apps
MIT License
1.95k stars 175 forks source link

Cannot build SwiftMonkey from pods #60

Closed PavelKatunin closed 6 years ago

PavelKatunin commented 6 years ago

Cannot call value of non-function type 'XCUIElement'

public func addXCTestTapAlertAction(interval: Int, application: XCUIApplication) {
    addAction(interval: interval) { [weak self] in
        // The test for alerts on screen and dismiss them if there are any.
        for i in 0 ..< application.alerts.count {
            let alert = application.alerts.element(boundBy: i)
            let buttons = alert.descendants(matching: .button)
            XCTAssertNotEqual(buttons.count, 0, "No buttons in alert")
            let index = UInt(self!.r.randomUInt32() % UInt32(buttons.count))
            let button = buttons.element(boundBy: index)
            button.tap()
        }
    }
}

let button = buttons.element(boundBy: index)

wojciechczerski commented 6 years ago

Hey @PavelKatunin! Could you please provide more details on the error? Is this something that stopped working after you made an update? Which Swift version are you using? Did you add SwiftMonkey to your UI tests target?

lfarah commented 6 years ago

Just got the same error. This is because the Readme example is pointing to 1.0 instead of the newest.

screen shot 2018-08-13 at 13 50 52
wojciechczerski commented 6 years ago

The #62 that fixes the README has been merged. Closing the issue.