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

False positives on checkbox click (includes test case) #280

Closed
jpurcell001 opened this Issue Mar 18, 2013 · 5 comments

Comments

Projects
None yet
5 participants
@jpurcell001

jpurcell001 commented Mar 18, 2013

We are seeing intermittent failures when trying to click a checkbox. Symptoms sound very similar to #120 - Capybara/Poltergeist acts like the click was successful, but it seemed to have clicked in the wrong spot. In our case we have a form that has options shown/hidden (no animations, just hide/show) depending on other choices, and it seems like there's some sort of a race condition where, intermittently, Poltergeist just misses the checkbox.

Put together a gist that seems to reproduce the problem. Generally fails within the first 10 iterations for me, often even earlier, but it seems to be a timing thing so you might have to play with the delays a bit.

https://gist.github.com/jpurcell001/5190514

This is using master of capybara/xpath as well as master of poltergeist.

The same gist passes without issue when using either selenium or webkit, so it feels like a poltergeist-specific issue.

@jonleighton

This comment has been minimized.

Contributor

jonleighton commented Mar 19, 2013

Thank you for the gist! That will be very helpful.

@jpurcell001

This comment has been minimized.

jpurcell001 commented May 16, 2013

@jonleighton Do you think the root cause of this may be the same as #286 ? We think we might be seeing this in a couple other places as well, and trying to assess whether we should be using .trigger(:click) rather than .click (is there any other downside to doing this?)

@ghost ghost assigned route Sep 3, 2013

@bentheax

This comment has been minimized.

bentheax commented Oct 21, 2014

This sounds 100% related to #286

I encountered a similar issue with checkboxes whose y-positions were changed very close to the time when the click occurred. One of these could possibly be closed as a duplicate, with the relevant examples carried over.

In my case, using trigger(:click) is a sufficient workaround for the issue.

@twalpole

This comment has been minimized.

Contributor

twalpole commented Nov 12, 2015

This would seem to be a duplicate of #286 so I'm going to close this one - as a potential solution - rather than switching to trigger(:click) when you know your checkboxes will hide rows you can use

 #click the checkbox
 expect(page).not_to have_css('css selector of the element that should be hidden')
#click the next checkbox

This will have the effect of testing that your rows do hide as you expect, and also making the test wait until the page is stable to click the next checkbox

@twalpole twalpole closed this Nov 12, 2015

@jpurcell001

This comment has been minimized.

jpurcell001 commented Nov 12, 2015

No problem @twalpole. Hopefully the test case / gist is still helpful in resolving #286.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment