fix(codegen): ignore AltGraph when typing (#6086)

This commit is contained in:
Joel Einbinder 2021-04-12 09:00:29 -07:00 committed by GitHub
parent b62a436041
commit b3b87f6c69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -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 MacOS
if (event.key === '@' && event.code === 'KeyL')

View file

@ -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', 'playwright@example.com');`);
});
});