Avoid jQuery Hanging in Akephalos

by @im_a_muppet on January 21, 2011

I have been using Akephalos with Cucumber/Capybara for a few weeks now. It tends to hang on jQuery (v1.4.3) calls

e.g. step that it would hang on

  When /^I double click on ([^"].*)$/ do |named_element|
      selector = selector_for(named_element)
      page.evaluate_script("$('#{selector}').dblclick()")
  end

I found that if I do not call jQuery directly that it works fine so I did the following.

  When /^I double click on ([^"].*)$/ do |named_element|
      selector = selector_for(named_element)
      page.evaluate_script("double_click('#{selector}')")
  end
  # public/javascripts/test_helpers.js
  var double_click = function(query) {
      $(query).dblclick();
  }

I hope this can help others. I do not know why this works and a direct call does not.

blog comments powered by Disqus
Tweet