From a1835c813b2a2c254350cd1e3757ef3c15398324 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 20 Aug 2024 11:46:55 +0200 Subject: [PATCH] test: Implement "contextmenu" mouse event for BiDi cockpit-podman uses this. Conceptually this is strange, as mouses don't have a "context menu" button -- they have a right button (aka `btn=2`). But this does not work with `ph_mouse()`, so translate it to a right click. --- test/common/testlib.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/common/testlib.py b/test/common/testlib.py index 290c6deee52f..643a277b3293 100644 --- a/test/common/testlib.py +++ b/test/common/testlib.py @@ -515,6 +515,12 @@ def mouse( # sidestep the browser element = self.call_js_func('ph_find_scroll_into_view', selector) + # btn=2 for context menus doesn't work with ph_mouse(); so translate the old ph_mouse() API + if event == "contextmenu": + assert btn == 0, "contextmenu event can only be done with default 'btn' value" + btn = 2 + event = "click" + actions = [{"type": "pointerMove", "x": 0, "y": 0, "origin": {"type": "element", "element": element}}] down = {"type": "pointerDown", "button": btn} up = {"type": "pointerUp", "button": btn}