GoJS Robot right click trigger


I am trying to write test cases using Robot for right click of the node, but it doesn’t trigger the click.
Here is my code for it.

Cypress.Commands.add('workflowDiagramContextClickNode', nodeId => {
  cy.workflowDiagramNode(nodeId).then(node => {
    cy.workflowDiagramRobot().then(robot => {
      const { centerX, centerY } = node.getDocumentBounds();
      robot.mouseDown(centerX, centerY, 0, { right: true });
      robot.mouseUp(centerX, centerY, 0, { right: true });

Cypress.Commands.add('workflowDiagramRobot', () => {
  cy.workflowDiagram().then(diagram => {
    cy.wrap(new Robot(diagram));

Cypress.Commands.add('workflowDiagramNode', nodeId => {
  cy.workflowDiagram().then(diagram => {

so it adds a command called workflowDiagramContextClickNode.

Does using a time value greater than zero as the third argument to mouseUp help?

The code otherwise looks OK. See for example the clickContextMenu function in https://gojs.net/latest/extensions/Robot.html

Hi Walter,
I tried giving the third argument in mouseUp as 100, but to no benefit. It is behaving as the single Left click.

Is there a way to give control+click?

Update - I don’t know why, { right: true } isn’t working, but { button: 2 } worked. Thanks.

That’s odd. The Simulating Input sample (extensions/Robot.html) works for me on both Mac and Windows. Maybe there’s something different about your environment?