fix(codegen): ignore AltGraph when typing (#6086)
This commit is contained in:
parent
b62a436041
commit
b3b87f6c69
|
|
@ -492,8 +492,8 @@ export class Recorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _shouldGenerateKeyPressFor(event: KeyboardEvent): boolean {
|
private _shouldGenerateKeyPressFor(event: KeyboardEvent): boolean {
|
||||||
// Backspace, Delete are changing input, will handle it there.
|
// Backspace, Delete, AltGraph are changing input, will handle it there.
|
||||||
if (['Backspace', 'Delete'].includes(event.key))
|
if (['Backspace', 'Delete', 'AltGraph'].includes(event.key))
|
||||||
return false;
|
return false;
|
||||||
// Ignore the QWERTZ shortcut for creating a at sign on MacOS
|
// Ignore the QWERTZ shortcut for creating a at sign on MacOS
|
||||||
if (event.key === '@' && event.code === 'KeyL')
|
if (event.key === '@' && event.code === 'KeyL')
|
||||||
|
|
|
||||||
|
|
@ -610,4 +610,18 @@ await Task.WhenAll(
|
||||||
|
|
||||||
expect(page.url()).toContain('about:blank#foo');
|
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');`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue