Skip to content
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 command cannot simulate real mouse events #8137

Closed
chuandeng opened this issue Jul 31, 2020 · 2 comments
Closed

cy.trigger command cannot simulate real mouse events #8137

chuandeng opened this issue Jul 31, 2020 · 2 comments
Labels
type: duplicate This issue or pull request already exists

Comments

@chuandeng
Copy link

chuandeng commented Jul 31, 2020

Current behavior:

when we use trigger like below code the event object in page is "Event"

cy.get('.target').trigger('mousedown', { button: 0 })

use "ev instanceof MouseEvent" in mousedown event got result of false

Desired behavior:

When we use "ev instanceof MouseEvent" in the mousedown event callback function should get result of true

Test code to reproduce

our coed is on below

$('div').on('mousedown', function(ev){
  if (ev instanceof MouseEvent) {
     ...
  }else {
    ...
  }
})

Versions

Cypress Version 4.9
System: Mac, Catalina 10.15.5
Browser: Chrome Version 84.0.4147.89 (Official Build) (64-bit)

@mingyixu
Copy link

mingyixu commented Jul 31, 2020

I had the same question. it not work, example

cy.xpath('//span[text()="target"]').trigger('mouseover');

@jennifer-shehane
Copy link
Member

Duplicate of #5650

@jennifer-shehane jennifer-shehane marked this as a duplicate of #5650 Aug 3, 2020
@jennifer-shehane jennifer-shehane added the type: duplicate This issue or pull request already exists label Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants