Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with elements not becoming first responder fast enough #1100

Conversation

justinseanmartin
Copy link
Contributor

When an UIPopover is presented in an animated fashion when an element is tapped, that element may not become first responder until after the animation is completed. This change gives waits for the animation to complete before checking that it became first responder.

Moving the waitForAnimationsToFinish introduced some other test failures when the element that became first responder is moved offscreen. For this reason, the additional check of ![view isProbablyTappable] was added.

@justinseanmartin
Copy link
Contributor Author

It looks like this breaks WebViewTests testTappingLinks, so I need to look into that before merging this change.

When tapping an element, there is a check that ensures it becomes the
first responder within a half second. This doesn't work for elements
such as popover controls however, which only become first responder
after the popover view finishes being presented (usually animated). In
that case, there is a race condition as to whether the element will
finish displaying before the polling interval completes.

The fix here is to ensure that we wait for any animations to complete
before trying to check that the element that has been tapped became
first responder.

One exception to this is when interacting with an accessibility element
and not a view. In this case, the backing view for the may still be
visible on screen, even though the element itself is not. An example of
this is web views, where this would cause the test `-[WebViewTests
testTappingLinks]` to fail.
@justinseanmartin justinseanmartin force-pushed the jmartin/wait-for-animation-after-first-responder-tapped branch from 55f46dc to 60f3b1a Compare April 21, 2019 20:43
@justinseanmartin
Copy link
Contributor Author

@harleyjcooper - Please take another look. I had to add an exception for cases like web views. I think this should go green now though.

Copy link
Contributor

@harleyjcooper harleyjcooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New changes LGTM

@harleyjcooper harleyjcooper merged commit f3e2aff into kif-framework:master Apr 22, 2019
@justinseanmartin justinseanmartin deleted the jmartin/wait-for-animation-after-first-responder-tapped branch April 22, 2019 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants