-
Notifications
You must be signed in to change notification settings - Fork 75
ContextMenu
Jan Richter edited this page Apr 24, 2019
·
3 revisions
Page object for any context menu opened by left-clicking an element that has a context menu. Title bar items also produce context menus when clicked.
Typically, a context menu is opened by calling openContextMenu
on elements that support it. For example:
import { ActivityBar, ContextMenu } from 'vscode-extension-tester';
...
const menu = await new ActivityBar().openContextMenu();
// find if an item with title exists
const exists = await menu.hasItem('Copy');
// get a handle for an item
const item = await menu.getItem('Copy');
// get all displayed items
const items = await menu.getItems();
// recursively select an item in nested submenus
await menu.select('File', 'Preferences', 'Settings');
// select an item that has a child submenu
const submenu = await menu.select('File', 'Preferences');