[Appium][iOS]Visibility attribute and simpleIsVisibleCheck capability in Appium/XCUITest

Appium has a capability named simpleIsVisibleCheck which follows visibility by testmanagerd. The original PR is here.

I have no exact idea we can recommend you to use the capability defaults to true, but I would leave a note about it here.

Current Appium/WebDriverAgent has complicated process like this. The process after the simpleIsVisibleCheck is here. The capability handles as shouldUseTestManagerForVisibilityDetection in the WDA.

XCTest has two similar attributes, hittable and exists. They have below descriptions:

The fact that an element exists does not imply that it is hittable. Elements can exist offscreen, or exist onscreen but be hidden by another element, causing their hittableproperty to return false.

in exists

hittable only returns YES if the element is already visible and hittable onscreen. It returns NO for an offscreen element in a scrollable view, even if the element would be scrolled into a hittable position by calling clicktap, or another hit-point-related interaction method.

in hittable

It means an element is not hittable even if the element is visible case can happen.

According to isAccessibilityElement,

The default value for this property is NO unless the receiver is a standard UIKit control, in which case the value is YES.

Assistive applications can get information only about objects that are represented by accessibility elements. Therefore, if you implement a custom control or view that should be accessible to users with disabilities, set this property to YES. The only exception to this practice is a view that merely serves as a container for other items that should be accessible. Such a view should implement the UIAccessibilityContainer protocol and set this property to NO.

in isAccessibilityElement

The isAccessibilityElement should be YES if we would like to handle the element as hittable, at least.

XCAccessibilityElement might return nil even if even if the element is hittable by the appium/WDA’s comment. interesting…

Sometimes XCTest returns nil for leaf elements hit test even if such elements are hittable

Assume such elements are visible if their rectInContainer is visible

I hope the visibility status has been fixed in newer Xcode/XCTest versions. Then, we can remove such complicated logic and can follow XCTest results.

I ran ruby_lib_core test suite with simpleIsVisibleCheck true. They were greened. In some case, can we use the value true by default?: link to Azure result page.

BTW, I tried to call source command with/without simpleIsVisibleCheck. I thought it was wroth to enable the capability by default if it had improved the performance. The result was almost same speed, around 1 sec. The target app was YouTube on real iOS 12.3.1 real device.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.