Replaced Element Tap Quiescence Check for iOS 13#278
Replaced Element Tap Quiescence Check for iOS 13#278mykola-mokhnach merged 4 commits intoappium:masterfrom
Conversation
merge upstream
|
ah... |
|
The issue is still happening when reduceMotion is enabled. |
KazuCocoa
left a comment
There was a problem hiding this comment.
Thanks.
This change looked good to me
| /** | ||
| Set the usage of animation check in quiescence validation (defaults to YES). | ||
| */ | ||
| + (void)setEnableAnimationCheck:(BOOL)value; |
There was a problem hiding this comment.
What about like below naming?
setAnimationCheckEnabled: (BOOL)isEnabledsetEnableAnimationCheck: (BOOL)enable
|
wow, thanks for the interesting investigation Mr @Dan-Maor |
| frame = newFrame; | ||
| return isSameFrame; | ||
| }]; | ||
| return result; |
There was a problem hiding this comment.
Calling self.frame retrieves a snapshot of the element every time.
From my testing saving the result of the frame instead of calling self.frame every time the property is needed is slightly faster (5% faster in my simple stress scenario); I've experimented with ways to make the possible performance impact lower, also tested using fb_snapshotwithattributes with only the frame as a parameter, but it didn't make much of a difference from just calling self.frame.
Saving the result into a variable was just for printing execution times though, I'll remove it.
We've encountered a case in which using XCTest's native
[XCUIElement tap]delays the command execution by 60 seconds compared to the custom implementation, which is not being used for iOS 13. After the 60 seconds delay a message stating "App animations complete notification not received, will attempt to continue" message is displayed in the device's log and the interaction succeeds.Turns out that the function uses XCTest's quiescence validation internally (the same one being used for launching applications), and that it appears to not play nice with animations after interacting with elements.
From what I could gather, XCTest's animations check uses the
XCAXClientmethodnotifyWhenNoAnimationsAreActiveForApplicationinternally, which registers for a user testing notification titled "AnimationsNonActive", and then injects an accessibility event (2043) to the accessibility element of the application. This in turn would trigger the required user testing notification to be posted from the tested application.It appears that for some reason attempting to check for animations after trying to find elements during an animation causes the application to not send the user testing notification required to finish the quiescence check, even if the check was initiated after the application has truly idled.
This PR disables the animation check before using
[XCUIElement tap]and validates the readiness of the object to be tapped usingfb_waitUntilFrameIsStable, like with the custom implementation.It should be noted that when using Xcode 11, in some instances this approach is slightly slower than XCTest's implementation. I did not notice a speed discrepancy on Xcode 10.