Hi.
I'm giving a try to PlayWright to drive my Electron application in my E2E tests.
I'm trying hard to find a way to handle the menu of my Electron application to open what should be a configuration popup window. But actually I can't manage to access and click the menu item to eventually access the configuration dialog window this menu is opening.
I've try something like this...
it('should have access to the menu', async () => {
await appElectron.evaluate( async ({Menu}) => {
const menu = Menu.getApplicationMenu();
console.log('menu items count:', menu.items.length);
const configMenu = menu.items[6].click();
configMenu.click();
const userConfigMenu = configMenu.getMenuItemById('User Config');
userConfigMenu.click();
});
const popup = await appElectron.evaluateHandle((async ({BrowserWindow}) => {
return BrowserWindow.getFocusedWindow();
}));
const title = await popup.evaluateHandle((configPopup) => {
return configPopup.getTitle();
});
console.log('Popup title:', title);
expect(title).toBeTruthy();
});
... but this doesn't work.
I don't think Electron allows showing menus programmatically. There are some hints that could be relevant here though: https://github.com/electron-userland/spectron/issues/21#issuecomment-373982282
Let me actually bake it into Playwright - it looks useful...
Most helpful comment
Let me actually bake it into Playwright - it looks useful...