Mike H-R
Mike H-R

Reputation: 7815

Capybara drag_to function throwing NotImplementedError

I have a Rails app that i'm trying to test the drag and drop functionality on, I'm using capybara and rspec along with jquery ui for the dragging, it works fine in the browser but I can't get a working test for it. The error I get is as follows:

source_element.drag_to(dest_element)
NotImplementedError: NotImplementedError

I have a simple test file like so:

describe "display index page" do
  it "try drag and drop" do
    dest_element = find('#list_'+list.id.to_s+' #sortable')
    source_element = find('#list_'+other_list.id.to_s)
    source_element.drag_to dest_element
  end
end

My Html looks like this (javascript is correctly configured and everything works in the browser):

<ul id="sortable" class="ui-sortable">
  <li id="list_20" class="sort">
  <li id="list_121" class="sort">
    <span>Content</span>
    <ul id="sortable" class="ui-sortable"> </ul>
  </li>
</ul>

Can anyone point out where I might be going wrong? I've tried looking around for a good few hours but haven't been able to figure out what the solution is.

Thanks in advance

Upvotes: 1

Views: 1088

Answers (1)

Adrian
Adrian

Reputation: 96

Not 100% sure but drag_to might be capybara-webkit specific. If you are using capybara-webkit make sure to add :js => true to your describe

Upvotes: 6

Related Questions