Make test_context_click_action pass with native context menus
Categories
(Core :: Widget: Cocoa, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox89 | --- | fixed |
People
(Reporter: mstange, Assigned: mstange)
References
Details
(Whiteboard: [proton-context-menus][mac:mr1])
Attachments
(1 file)
Bug 1533786 added a test_context_click_action
Marionette unit test: https://searchfox.org/mozilla-central/rev/402802eb42ba7d905531fd8e3b089fc8b2292f66/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py#98
It opens the content area context menu with a synthesized right click, checks that the popup's state is "open", and then synthesizes an ESC key event to close the menu.
With native context menus, closing the menu with a synthesized key event is not going to be possible. Is this a required capability for WebDriver? How do other browsers expose the ability to open and close context menus?
Updated•4 years ago
|
Updated•4 years ago
|
Comment 1•4 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #0)
It opens the content area context menu with a synthesized right click, checks that the popup's state is "open", and then synthesizes an ESC key event to close the menu.
Markus, what's the way how Browser Chrome tests will close these native context menus? Does the ESC key needs to be synthesized against the window instead?
With native context menus, closing the menu with a synthesized key event is not going to be possible. Is this a required capability for WebDriver? How do other browsers expose the ability to open and close context menus?
Context menus aren't handled by the WebDriver spec.
Assignee | ||
Comment 2•4 years ago
|
||
(In reply to Henrik Skupin (:whimboo) [⌚️UTC+1] from comment #1)
(In reply to Markus Stange [:mstange] from comment #0)
It opens the content area context menu with a synthesized right click, checks that the popup's state is "open", and then synthesizes an ESC key event to close the menu.
Markus, what's the way how Browser Chrome tests will close these native context menus?
Browser chrome tests can now close the native context menu by calling menupopupElement.hidePopup(). (This now works as of bug 1703333, it wasn't working when I filed this bug.)
Does the ESC key needs to be synthesized against the window instead?
From what I can tell, synthesized key events are ignored by native context menus, and they are also consumed in such a way that Firefox doesn't see them. So I think we just cannot synthesize any events (mouse or key) while the menu is open and expect it to work. Instead, we need to open the menu, inspect the contents, maybe call menuitem.doCommand()
to execute a menu item, and then close the menu with .hidePopup()
.
With native context menus, closing the menu with a synthesized key event is not going to be possible. Is this a required capability for WebDriver? How do other browsers expose the ability to open and close context menus?
Context menus aren't handled by the WebDriver spec.
Ah ok good, so we just need to find a solution that works for us internally then.
Assignee | ||
Comment 3•4 years ago
|
||
Henrik, is it possible to call hidePopup()
from test_context_click_action
?
Comment 4•4 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #2)
Markus, what's the way how Browser Chrome tests will close these native context menus?
Browser chrome tests can now close the native context menu by calling menupopupElement.hidePopup(). (This now works as of bug 1703333, it wasn't working when I filed this bug.)
This is fine. Marionette tests should use that too to close the native context menu then given that the ESC key doesn't work anymore.
Comment 5•4 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #3)
Henrik, is it possible to call
hidePopup()
fromtest_context_click_action
?
You can re-use the already retrieved context menu cm_el
:
with self.marionette.using_context("chrome"):
cm_el = self.marionette.find_element(By.ID, "contentAreaContextMenu")
self.marionette.execute_script("arguments[0].hidePopup()", script_args=(cm_el,))
Assignee | ||
Comment 6•4 years ago
|
||
Thanks a lot, that works!
Assignee | ||
Comment 7•4 years ago
|
||
Updated•4 years ago
|
Comment 9•4 years ago
|
||
bugherder |
Description
•