title: Drag & Drop with Protractor by Repeater
body: <p>There are a few questions similar to this one &amp; and I have read them all.  However I still can't get the Action Sequence to work as expected in protractor.</p>
  
  <p>I have a list of  items that are draggable and I need to test results after they are re-arranged.  However I can't get the dragging/dropping to work correctly.  Here is a simplified mock up of what I have so far.</p>
  
  <p>helper functions:  </p>
  
  <pre><code>var getRow = function (num){
        return element(by.repeater('p in pList').row(num - 1));
  };
  
  var getField = function (rowNum){
      return getRow(rowNum).findElement(by.css('td.ng-binding'));
  };
  
  var moveIndexToIndex = function (startIndex, endIndex) { 
    return getField(endIndex).then(function (endPoint) {
        getField(startIndex).then(function (startPoint) { 
            // browser.actions().dragAndDrop(startPoint, endPoint).perform(); // doesn't work either
            browser.actions().
              mouseMove(startPoint, {x: 0, y: 0}).
              mouseDown().
              mouseMove(endPoint).
              mouseUp().
              perform();   
        });
      });
  });
  </code></pre>
  
  <p>I am calling the move helper function with literals like so:</p>
  
  <pre><code>moveIndexToIndex(2, 5);
  </code></pre>
  
  <p>And the html look something like this:</p>
  
  <pre><code>&lt;tbody&gt;
            &lt;!-- ngRepeat: p in pList --&gt;
            &lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 1&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 2&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 3&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 4&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 5&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 6&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 7&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 8&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 9&lt;/td&gt;
            &lt;/tr&gt;&lt;!-- end ngRepeat: p in pList --&gt;&lt;tr ng-repeat="p in pList" eg-draggable="p" eg-droppable="eg-droppable" class="ng-scope" draggable="true" style="cursor: move;"&gt;
              &lt;td class="ng-binding"&gt;DummyValue 10&lt;/td&gt;
            &lt;/tr&gt;
            &lt;!-- end ngRepeat: p in pList --&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>How can I get dragging and dropping to work? Am I doing something wrong?</p>