Overview
I think I have figured out a reason the tests can be flakey - specifically around operations that involve the right-click context menu.
Proposed resolution
In ComponentContextMenu.tsx we have a useEffect that if the canvasViewPort is updated (x, y and scale) then the context menu should close. This is done to prevent the menu becoming mis-aligned with the location the user right clicked to initially open it.
However, cypress automatically scrolls the page often when selecting/checking elements. Even just cy.get() will scroll the target element into view if required.
When scrolling occurs, the update for the x/y position of the canvas is updated after a 250ms debounce which I think explains why the issue is flakey! In some case the test is running fast enough that it can open the menu and click the item before the scroll position updates and closes the menu.
User interface changes
Issue fork experience_builder-3526034
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jessebaker commentedComment #6
bnjmnmYep the moving / scrolling seems to be one of the more common intermittent issues here. good find.