-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cy.trigger('mousedown', ...) doesn't fill in event.view property #3686
Comments
By the way, I find sth confused in cy.trigger() event = new Event(eventName, options) // why not new MouseEvent or ? This occurs Cypress can not test React re-resizable. const clientX = event instanceof MouseEvent ? event.clientX : event.touches[0].clientX; cc @jennifer-shehane Thanks. ok, give a pr to re-resizable #439 ok, I have figured it out. Attention:
cy.wrap(mousedownDom).trigger('mousedown', { which: 1 });
cy.window()
.then(win => {
win.dispatchEvent(
new win.MouseEvent('mousemove', {
bubbles: true, // must
clientX: deltaWidth,
clientY: deltaHeight,
})
);
})
.trigger('mouseup', { which: 1 }); |
The code for this is done in cypress-io/cypress#8305, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
When the browser creates the
MouseEvent
object, it has aview
property which points to theWindow
object.Cypress does not add it during a
trigger
.Apparently the
d3-zoom
library depends on this property being there. My app breaks when run via cypress but not when the user clicks.Here is the property:
https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts#L15454
Desired behavior:
During a
trigger
, fill in all of the same properties that the browser does when the user clicks.Steps to reproduce: (app code and test code)
https://stackblitz.com/edit/typescript-eurovj?file=index.ts
Versions
Cypress 3.1.5
The text was updated successfully, but these errors were encountered: