Robot Context Menu does not work?

Trying the Robot Context Menu here
It seems like it’s not working ?

I don’t understand also why the events of ‘lastInput’ and ‘firstInput’ contain values ONLY when using dragFromPalette ? For the other actions it’s null despite the logic is almost the same since all of theme are using mouseUp and mouseDown events of Robot.

I just tried it in two different browsers, and it worked well in both.

Perhaps you did not click the buttons in order, starting at the top and working down. Each button’s behavior depends on the previous button having just been executed only once.

Right.

I just reviewed the code.
It’s supposed to open the context menu then click on the first item instantly.
That’s why I didn’t see the context menu and I thought it’s not working.

@walter Well, I’m trying to implement some Tests for my diagram and I am using the Robot.

Some of my components are using the lastInput and firstInput.

The Diagram catch the events correctly when I use the keyboard and the mouse however when I simulate the behavior with the Robot, I see that lastInput and firstInput were messed up.

Should I avoid the Robot when I have a logic with lastInput and firstInput ?

What testing system are you using?

UI Tests with Selenium and some internal Helpers.

I have a custom Context Menu component that uses Popperjs and the firstInput event to define the mouse position.

This work fine on the App.

However, on the Tests and with the Robot script the Diagram does not capture the right firstInput.

Was trying the behavior of lastInput and firstInput on the methods of the example above.
I think the Robot does not overwrite them and keep the latest mouse of keyboard event ?!

Remember that the Points and Sizes and Rects of GoJS and of Robot are in GoJS document coordinates. Not any HTML element’s coordinates, nor window nor screen coordinates.

After using robot.mouseUp(X, Y), is it possible to get the Mouse Event in myDiagram.firstInput.event ?

If not, I will implement a specific logic only after using the Robot script.

In general, no, because the purpose of Robot is to simulate InputEvents, not use real HTML DOM Events.

1 Like