Testing clickCreatingTool using robot

I am trying to use robot to test the creation of an element in the diagram on click. The code is using clickCreatingTool. isDoubleClick is set to false so only one click should be enough to create the element.
I tried the following that didn’t work:
robot.mouseDown(to[0], to[1], 200, options); robot.mouseUp(to[0], to[1], 200, options);
When options is
const options = {sourceDiagram: myDiagram, targetDiagram: myDiagram};
I’m guessing that options might be incorrect?
If so, what should I be sending? Or what is the issue otherwise?

You normally don’t need to set the targetDiagram or sourceDiagram eventprops properties unless you are simulating a drag-and-drop between diagrams. If you are trying to run the ClickCreatingTool, that is clearly not the case, since the click starts and ends in one diagram. So I don’t think you need to provide any options. (You can step though the Robot code to confirm that.)

If the ClickCreatingTool isn’t running perhaps the conditions for that tool starting aren’t being met. Read the docs for its canStart method: ClickCreatingTool | GoJS API

In particular, have you set ClickCreatingTool.archetypeNodeData? In your context probably by selecting a node in the palette diagram.

And have you specified an x and y point where there is no existing Node or Link? Unless you have that override of canStart to ignore whether there is a Part at that document point.