fix(input): send keypress event for enter key in chromium (#3796)

This commit is contained in:
Joel Einbinder 2020-09-08 20:04:14 -07:00 committed by GitHub
parent b28ed214ca
commit 1791be6d16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -53,6 +53,8 @@ export class RawKeyboardImpl implements input.RawKeyboard {
let commands = macEditingCommands[shortcut] || [];
if (isString(commands))
commands = [commands];
// Commands that insert text are not supported
commands = commands.filter(x => !x.startsWith('insert'));
// remove the trailing : to match the Chromium command names.
return commands.map(c => c.substring(0, c.length - 1));
}

View file

@ -237,9 +237,7 @@ it('page.press should work', async ({page, server}) => {
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('a');
});
it('page.press should work for Enter', test => {
test.fail(options.CHROMIUM && MAC, 'page.press() does not emit keypress event on Enter');
}, async ({page, server}) => {
it('page.press should work for Enter', async ({page, server}) => {
await page.setContent(`<input onkeypress="console.log('press')"></input>`);
const messages = [];
page.on('console', message => messages.push(message));