I have a bug in my app which occurs if a user clicks the submit button of a form very quickly twice in a row. I can reliably reproduce this on production and in my development environment.
Is it possible for me to reproduce this with Capybara/poltergeist/phantomjs?
find("#my-button").double_click, find("#my-button").click.click, execute_script("$('#register-button').click().click();"), and other variations with execute_script do not work.
Everything I tried only caused my server-side code to be invoked once, even though console.log logging showed that click was indeed invoked twice. So I suspect there's something fundamentally missing from the capabilities of capybara and poltergeist simulate this behavior.
Is there a way to somehow invoke phantomJS at a lower level and achieve this?
I did try increasing the concurrency of my web server, it didn't help.
As you guessed - double_click is not the same as click twice.  To have two clicks you can do
find("#my-button").click.click
Or, depending on your bug you may need to sleep a little between those two clicks
find("#my-button").tap do |b|
  b.click
  sleep 0.1
  b.click
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With