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

click not firing mouseover event #2928

Closed
jkeruzec opened this issue Dec 11, 2018 · 7 comments · Fixed by #3030
Closed

click not firing mouseover event #2928

jkeruzec opened this issue Dec 11, 2018 · 7 comments · Fixed by #3030
Assignees
Labels
type: duplicate This issue or pull request already exists
Milestone

Comments

@jkeruzec
Copy link

Current behavior:

I trigger some react-contextify menu with .trigger('contextmenu')
My menu is displaying OK

image

Then I select the div element where an onClick event is attached.
cy.get('.react-contexify__item').debug().click();

I tried to use also "force: true" as an option.

But my action is not triggered. Nothing happens.

With debug() option activated, I trigger manually the click() event and my Material UI dialog is displayed.

------------------------ Debug Info ------------------------
cypress_runner.js:63678 Command Name:     get
cypress_runner.js:63678 Command Args:     [".react-contexify__item"]
cypress_runner.js:63678 Current Subject:  jQuery.fn.init [div.react-contexify__item, prevObject: jQuery.fn.init(1), context: document, selector: ".react-contexify__item"]
subject.click()
MegaTrendPage.jsx:316 hello!
jQuery.fn.init [div.react-contexify__item, prevObject: jQuery.fn.init(1), context: document, selector: ".react-contexify__item"]

Source for div menu is like this:

  return (
      <div
        className={cssClasses}
        style={style}
        onClick={this.handleClick}
        role="presentation"
      >
        <div className={styles.itemContent}>{children}</div>
      </div>
    );

Desired behavior:

I trigger click event and dialog is shown...

Versions

Cypress Version used : 3.1.3
Chrome 70.0.3538.110
React 16.6.3
react-contexify : 3.0.3

@jkeruzec jkeruzec changed the title get element click doesn't work div onClick Click on div element doesn't work Dec 11, 2018
@jennifer-shehane
Copy link
Member

Could you provide a reproducible example of this? With test code + application code.

@jkeruzec
Copy link
Author

jkeruzec commented Dec 12, 2018

This repo reproduces the error :
https://github.com/jkeruzec/cypress-context-bug

@kuceb
Copy link
Contributor

kuceb commented Dec 12, 2018

@jkeruzec I was able to reproduce, thank you. We are aware of this issue because we do not yet send mouseover/pointerover events during a click.

We'll have a fix in either 3.1.3 or 4.0

in the meantime, you can do this:

cy.get('.react-contexify__item__data')	
  .trigger('mouseover').click()
  .then(() => {
	 expect(stub).to.be.calledWith('Hello bug !');
  });

@jkeruzec
Copy link
Author

Workaround works beautifully !

Thanks for that !

@kuceb kuceb changed the title Click on div element doesn't work click not firing mouseover event Dec 17, 2018
@kuceb kuceb self-assigned this Dec 17, 2018
@kuceb kuceb added this to the Sprint 16 milestone Dec 17, 2018
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Aug 8, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Sep 6, 2019
@jennifer-shehane
Copy link
Member

Closing as duplicate of #1847

@jennifer-shehane jennifer-shehane added type: duplicate This issue or pull request already exists and removed stage: needs review The PR code is done & tested, needs review type: bug labels Sep 24, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: needs review The PR code is done & tested, needs review stage: work in progress labels Sep 25, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: pending release and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Oct 7, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 11, 2019

The code for this is done in cypress-io/cypress#3030, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 23, 2019

Released in 3.5.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants