Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(chromium): report numpad location on keyup (#42913)
Yuriy Mikityuk6b37d04cf3dc
diff --git a/packages/playwright-core/src/server/chromium/crInput.ts b/packages/playwright-core/src/server/chromium/crInput.tsindex 5e8843244e..e8598f3432 100644--- a/packages/playwright-core/src/server/chromium/crInput.ts+++ b/packages/playwright-core/src/server/chromium/crInput.ts@@ -81,7 +81,8 @@ export class RawKeyboardImpl implements input.RawKeyboard {key,windowsVirtualKeyCode: description.keyCodeWithoutLocation,code,- location+ location,+ isKeypad: location === input.keypadLocation}));}diff --git a/tests/page/page-keyboard.spec.ts b/tests/page/page-keyboard.spec.tsindex 5c18214b26..98e7e32a93 100644--- a/tests/page/page-keyboard.spec.ts+++ b/tests/page/page-keyboard.spec.ts@@ -306,6 +306,15 @@ it('should specify location', async ({ page, server }) => {expect.soft(await lastEvent.evaluate(e => e.code)).toBe('NumpadSubtract');});+it('should specify numpad location on keyup', async ({ page, server }) => {+ await page.goto(server.PREFIX + '/input/keyboard.html');+ await page.keyboard.press('NumpadSubtract');+ expect(await page.evaluate('getResult()')).toBe(+ ['Keydown: - NumpadSubtract NUMPAD []',+ 'Keypress: - NumpadSubtract NUMPAD 45 []',+ 'Keyup: - NumpadSubtract NUMPAD []'].join('\n'));+});+it('should press Enter', async ({ page, server }) => {await page.setContent('<textarea></textarea>');await page.focus('textarea');