Unit test contextmenu options

Hi Team,

Is there a way to test contextmenu and its options through unit tests? I tried getting hold of the contextmenu through obj.part , but not sure on how to click the given button options after that. Could you please help.

Could you please tell us and show us more about your tests? Are you using Robot or not?
Simulating Input Events
Testing GoJS apps -- Northwoods Software

Robot is used hereā€¦

i would like to test whether the deleteElement function is getting called when context menu button delete is clicked. i am not able to get the context menu button in my tests.

$(
            'ContextMenuButton',
            $(go.TextBlock, 'Delete element', {
              font: '14px',
              stroke: '#525252',
              alignment: go.Spot.Left,
              margin: new go.Margin(7, 16, 7, 16),
              mouseEnter: (e, tb) => (tb.stroke = '#FFF'),
              mouseLeave: (e, tb) => (tb.stroke = '#525252'),
              name: 'Delete_Element',
            }),
            

            {
              click: (e, node) => deleteElement(e, node.part),
            },

The Simulating Input Events sample has a function in it that produces a context menu and then clicks on a context menu button. The function is named clickContextMenu.

Note that the calls to mouseDown and mouseUp pass { right: true } to cause a right or context click on the node.

The following calls to mouseMove, mouseDown, and mouseUp click on the button.