cypress
cypress copied to clipboard
Detached DOM: Update .click() to use cy.currentSubject()
What would you like?
Queries solve a major problem: how can Cypress safely requery the DOM when the subject becomes detached? The Cypress command queue also handles this cleanly and internally for queries and their associated assertions.
However, commands - such as .click() - still receive a static subject, and this subject can "go stale" as the DOM mutates. Because there is no generic handling of subjects - each command contains its own logic - fixing this will involved updating each command one at a time.
We have to start somewhere, to understand exactly what this solution looks like and establish patterns for updating future commands. This will also help scope out how much work remains on other commands, whether it is simple or complex to update each one.
Why is this needed?
No response
Other
No response