Skip to content

Make click wait for animation to finish #3106

@thesunny

Description

@thesunny

Is your feature request related to a problem? Please describe.
Modern interfaces use animations heavily to, for example, animate dialogs, slide sidebars in/out etc.

In order to handle this, right now, the suggestion is to write a custom command as per the issue submitted here: #429

While animated UI was rare before, now that it is common, it would be a benefit to handle this in webdriverio. This would be similar to the idea that click waits for the element to exist and scrolls to it before clicking. The click command is a smart function and is not a nieve implementation of just clicking.

Describe the solution you'd like
When calling click, the library could run a test as simple as getting the coordinates of the element, waiting until the next requestAnimationFrame and if the new coordinates are the same, we know that the element is not animating. If it's not animating, execute the click command. If it is animating, then we do another requestAnimationFrame test. There can be a timeout in the unusual case that the element animates forever.

Describe alternatives you've considered
This works as described in the Cypress test runner, an alternative to WebdriverIO. It works really well.

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first picka reasonable task to start getting familiar with the code basehelp wantedIssues that are free to take by anyone interestedwebdriverio

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions