Testing jQuery Autocomplete using Capybara
26 February 2012 by martin
This is a brilliant tip. I would never have worked this out on my own. Thank you Jack Russell Software Company.
http://jackhq.tumblr.com/post/3728330919/testing-jquery-autocomplete-using-capybara
The sleep commands were the critical bit, without them Selenium just wasn't firing the JavaScript event handlers.
Here are the relevant lines from my integration test.
# We are looking for "Make Two"
s.fill_in "Make", :with => "Make"
sleep 1
page.execute_script("$('.ui-menu-item a:contains(\"Make Two\")').trigger('mouseenter').click();")