Skip to content

cy.trigger('mousedown', ...) doesn't fill in event.view property #3686

@fr0

Description

@fr0

Current behavior:

  cy.get('#thing').trigger('mousedown', 10, 10);

When the browser creates the MouseEvent object, it has a view property which points to the Window 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

  it('should click just like the user does', () => {
    cy.visit('https://typescript-eurovj.stackblitz.io');
    cy.get('#rect').trigger('mousedown', 5, 5);
    cy.get('#app').should('contain', 'got the view');
  });

Versions

Cypress 3.1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/driverThis is due to an issue in the packages/driver directorytype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions