title: Testing drag and drop not working rspec/capybara/selenium/jquery
body: <p>I am using:  </p>
  
  <ul>
  <li>rspec   </li>
  <li>capybara</li>
  <li>selenium   </li>
  <li>jquery  ui-sortable</li>
  <li>ruby</li>
  <li>rails</li>
  </ul>
  
  <p>This code:  </p>
  
  <pre><code>expect(find_by_id("note0").text).to eq(note_placeholder.to_s + "0")
  expect(find_by_id("note1").text).to eq(note_placeholder.to_s + "1")
  expect(find_by_id("note2").text).to eq(note_placeholder.to_s + "2")
  source=find_by_id("combo0")
  target=find_by_id("combo1")
  source.drag_to(target)    
  expect(find_by_id("note0").text).to eq(note_placeholder.to_s + "1")
  expect(find_by_id("note1").text).to eq(note_placeholder.to_s + "0")
  expect(find_by_id("note2").text).to eq(note_placeholder.to_s + "2")
  </code></pre>
  
  <p>... throws no error, but  </p>
  
  <pre><code>expect(find_by_id("note0").text).to eq(note_placeholder.to_s + "1")
  </code></pre>
  
  <p>... fails  </p>
  
  <pre><code> Failure/Error: expect(find_by_id("note0").text).to eq(note_placeholder.to_s + "1")
  
     expected: "imaging_step_note1"
          got: "imaging_step_note0"
  </code></pre>
  
  <p>It seems drag_to is not working.  Is there a good way to confirm that is in fact the trouble?  Is there a good workaround?  </p>
  
  <p>Drag and drop and subsequent sorting work fine outside rspec.  What sort of spec will test this in rspec?  </p>
  
  <p>EDIT:
  This seems to offer some promise, but I am not sure I understand it well:<br>
  <a href="https://github.com/mattheworiordan/jquery.simulate.drag-sortable.js/blob/master/README.md" rel="nofollow">https://github.com/mattheworiordan/jquery.simulate.drag-sortable.js/blob/master/README.md</a>  </p>
  
  <p>Is it a good option?  Seems there must be a better way, no?  Isn't this common functionality to test?  What am I missing?</p>
  
  <p>EDIT2:<br>
  Another option dated 2011:<br>
  <a href="https://ynot408.wordpress.com/2011/09/22/drag-and-drop-using-selenium-webdriver/" rel="nofollow">https://ynot408.wordpress.com/2011/09/22/drag-and-drop-using-selenium-webdriver/</a>
  ... although the single long line of javascript is beyond me at the moment.</p>
  
  <p>EDIT3: 
  Based on this:<br>
  <a href="http://www.seleniumhq.org/docs/03_webdriver.jsp#setting-up-webdriver-project" rel="nofollow">http://www.seleniumhq.org/docs/03_webdriver.jsp#setting-up-webdriver-project</a></p>
  
  <p>... I tried this code:  </p>
  
  <pre><code>source = page.driver.browser.find_element(:id, 'combo0')
  target = page.driver.browser.find_element(:id, 'combo1')
  page.driver.browser.action.drag_and_drop(source, target).perform
  sleep 5
  </code></pre>
  
  <p>... but I still get:  </p>
  
  <pre><code>Failure/Error: expect(find_by_id("note0").text).to eq(note_placeholder.to_s + "1")
  
     expected: "imaging_step_note1"
          got: "imaging_step_note0"
  </code></pre>
  
  <p>EDIT4:<br>
  Just updated to selenium-webdriver (2.45.0) from 2.42.0  Same result.  Only difference now is spec seems to run much slower.  Reverted back to 2.42.0.</p>
  
  <p>EDIT5:
  If I add:  </p>
  
  <pre><code>sleep 15
  </code></pre>
  
  <p>... and manually perform the drag-and-drop, the rspec test passes.  Everything seems to be pointing to a failure of whatever should be happening after the left-mouse button release event.</p>