Open ryanshellberg opened 1 year ago
Hi @BlueWinds @ryanshellberg
I can confirm the regression.
A simple use case to reproduce the issue of .click overwrite not working
Cypress.Commands.overwrite(
'click',
(originalFn, subject, positionOrX, y, options = {}) => {
return cy
.screenshot()
.then(() => originalFn(subject, positionOrX, y, options))
},
)
We use this kind of code to generate screenshot documentation based on clicks on our test suite.
Figured out what's going on here, and it's pretty messy, deep in the Cypress internals. The tl;dr of it is that the originalFn is reading the wrong subject, and getting the subject of .screenshot()
(which is null) rather than the one of the parent command.
I have a PR to address this, but it's a really messy edge case caused by the overwrite API having been written (and therefore set in stone) before queries / subject chains existed.
Apologies for letting this languish - it is still on my radar, but I've been out sick a lot recently. Will get back to this as soon as I'm able.
@BlueWinds any updates on this?
@jennifer-shehane Is there a plan to fix this, or is there a workaround I can use in the meantime?
This isn't currently something our team is focused on addressing.
Current behavior
My team uses Turbo Drive and has been using the solution discussed here to overwrite the
cy.click()
function wait wait for theturbo:load
event before proceeding. After upgrading to Cypress 12.0.2 our overwritten function no longer executes the original click, and the promise never returns.Desired behavior
Execute the original click function correctly, resolving the promise after the "turbo:load" event is fired.
Test code to reproduce
With this command overridden, I can reproduce with the following code called on any element that triggers a turbo load
Cypress Version
12.0.2
Node version
16.13.2
Operating System
macOS 13.0.1
Debug Logs
No response
Other
No response