Search code examples
cypresspointer-events

Wait for pointer-events in Cypress by default


The pointer-events CSS property sets under what circumstances (if any) a particular graphic element can become the target of pointer events. I use this property to prevent interaction with some sections of a web application for a short time while content is updating.

This causes problems with end to end tests run through Cypress. Cypress is correctly blocked from interacting with an element with pointer-events set to none. However, instead of failing immediately, I would like Cypress to wait for the element to become intractable. This is the default behaviour for elements which are disabled, readonly, animating etc.

My question is: Is there any way to make Cypress apply this default behaviour to elements with pointer-events set to none (or with a parent whose pointer-events is set to none)?


Solution

  • This seems to have been added with Cypress 5.6.0!

    Here's the update in Cypress' issues:

    https://github.com/cypress-io/cypress/issues/9227#issuecomment-729465861