<div dir="ltr"><br><div>Among other things, this is a regression test for <a href="https://bugzilla.wikimedia.org/show_bug.cgi?id=54443">https://bugzilla.wikimedia.org/show_bug.cgi?id=54443</a></div><div><br></div><div>We merged this test today:  <a href="https://gerrit.wikimedia.org/r/#/c/87620">https://gerrit.wikimedia.org/r/#/c/87620</a></div>
<div><br></div><div>The interesting part is in the steps file: </div><div><br></div><div><div>When(/^I send right arrow times (\d+)$/) do |number<span style="white-space:pre">|</span></div><div>  on(VisualEditorPage) do |page|</div>
<div>    page.content_element.when_present.fire_event('onfocus')</div><div>    number.to_i.times do</div><div>      page.content_element.send_keys :arrow_right</div><div>      page.content_element.fire_event('onblur') #gerrit 86800/86801</div>
<div>    end</div><div>  end</div></div><div><br></div><div><span style="white-space:pre">Before we do anything, we have to fire an 'onfocus' event for the contentEditable area of VE, in order for the Save page button to become enabled. </span></div>
<div><span style="white-space:pre"><br></span></div><div><span style="white-space:pre">Then every time we send an arrow_right command we also  have to send a corresponding 'onblur' event.  (Or at least we do when we move the cursor onto an "object".)  </span></div>
<div><br></div><div><span style="white-space:pre">If the test does not send the onblur event, then upon encountering an "object" like a reference or a link or a transclusion, the cursor repositions itself at the beginning of the contentEditable field.  It's fun to watch, but it's not a good test.  :-) </span></div>
<div><span style="white-space:pre"><br></span></div><div><span style="white-space:pre">If you investigate those 86800/86801 commits in gerrit, you can see how VE keeps track of where the cursor is.  </span></div><div><span style="white-space:pre"><br>
</span></div><div><span style="white-space:pre"><br></span></div></div>