Using the end of document seems more logical for the test. And all works as desired.
I then went on to look at my prependParagraph test and to try the same logic,
What I find kind of works is...
function autoEdit(api) {
var posRef = api.input.documentStartAnchor();
api.input.setSelectedTextRange(posRef, posRef);
api.cursor.enterPressed();
api.cursor.moveLeft();
api.cursor.insertCharacter("Puff the magic dragon lives by the sea.");
}
The reason I say kind of works is that the content of the orginal paragraph is replaced and the first is moved to the second paragraph (or at least its contents)
My framework shows me the pretty pictures of....

Note I now get to see the cursor div too?
When the concrete document trees are merged we get...
So we've not really inserted the paragraph but logically I guess its ok. I have dropped the STYLE though. I need to grab that as part of processing the html. If there is no style assume the previous? Or maybe in the test I need to get the paragraph attributes correctly. Copy the formatting?
The last part of the test extracts the above picture to some text.
Changed:
node: DOM_TEXT
seq: 18
from: "Hello world"
to: "Puff the magic dragon lives by the sea."
Added:
node: TEXT_P
Added:
node: DOM_TEXT
value: "Hello world"
Which is the equivalent of what I expect.but ideally I think a new paragraph should be inserted.
Unless there is more magic to be revealed.... :-)