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(codegen): ignore AltGraph when typing (#6086)
Joel Einbinderb3b87f6c6947
diff --git a/src/server/supplements/injected/recorder.ts b/src/server/supplements/injected/recorder.tsindex 081a154d3e..47562d6c60 100644--- a/src/server/supplements/injected/recorder.ts+++ b/src/server/supplements/injected/recorder.ts@@ -492,8 +492,8 @@ export class Recorder {}private _shouldGenerateKeyPressFor(event: KeyboardEvent): boolean {- // Backspace, Delete are changing input, will handle it there.- if (['Backspace', 'Delete'].includes(event.key))+ // Backspace, Delete, AltGraph are changing input, will handle it there.+ if (['Backspace', 'Delete', 'AltGraph'].includes(event.key))return false;// Ignore the QWERTZ shortcut for creating a at sign on MacOSif (event.key === '@' && event.code === 'KeyL')diff --git a/tests/cli/cli-codegen-1.spec.ts b/tests/cli/cli-codegen-1.spec.tsindex cb2e39ac0a..227655aabc 100644--- a/tests/cli/cli-codegen-1.spec.ts+++ b/tests/cli/cli-codegen-1.spec.ts@@ -610,4 +610,18 @@ await Task.WhenAll(expect(page.url()).toContain('about:blank#foo');});++ test('should ignore AltGraph', async ({ openRecorder, isFirefox }, testInfo) => {+ testInfo.skip(isFirefox, 'The TextInputProcessor in Firefox does not work with AltGraph.');+ const recorder = await openRecorder();+ await recorder.setContentAndWait(`<input></input>`);++ await recorder.page.type('input', 'playwright');+ await recorder.page.keyboard.press('AltGraph');+ await recorder.page.keyboard.insertText('@');+ await recorder.page.keyboard.type('example.com');+ await recorder.waitForOutput('<javascript>', 'example.com');+ expect(recorder.sources().get('<javascript>').text).not.toContain(`await page.press('input', 'AltGraph');`);+ expect(recorder.sources().get('<javascript>').text).toContain(`await page.fill('input', '[email protected]');`);+ });});