Eugene Zhenya Gordin Eugene Zhenya Gordin - 1 year ago 92
iOS Question

How to test if navigationBar button is enabled/disabled in UI test on iOS?

In my iOS app I've added UI tests, where I need to check if navigationBar button is enabled/disabled at different point of time.

Currently I'm using:

XCUIElement* saveButton =[@"TSSIDAddCardView"].buttons[@"Save"];

XCTAssertEqual(saveButton.hittable, YES);

However, this always returns YES. The .exists test returns YES as well.

Does anyone knows how to do the proper test?

Answer Source

So with help of @InsertWittyName I found the solution:

UIBarButtonItem *saveButton =[@"TSSIDAddCardView"].buttons[@"Save"];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download