How can I test JQuery UI Sortable with Cucumber

Viewed 2565

I'm tryting to write a cucumber/capybara test to reorder some items and then save them back. Any thoughts on how to best do this?

5 Answers

I followed @codener's solution and it works! The only thing I changed in my code is configuring the UI-sortable with tolerance: 'pointer'.

The limitation described in @codener's answer is not gone, too. (I'm using capybara 2.18.0.) It doesn't need the third row to swap the first with the second row.

When /^I drag the first table row down$/ do
  element = find('tbody tr:nth-child(1)')
  target = find('tbody tr:nth-child(2)')
  element.drag_to target
end
Related