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
test(fill): add test for preventing double-fill in contenteditable with beforeinput handler (#36766)
Max Schmitt0f5fd8fa11de
diff --git a/tests/page/page-fill.spec.ts b/tests/page/page-fill.spec.tsindex d42dd046dc..32dc69f550 100644--- a/tests/page/page-fill.spec.ts+++ b/tests/page/page-fill.spec.ts@@ -210,6 +210,31 @@ it('should fill contenteditable with new lines', async ({ page, server, browserNexpect(await page.locator('div[contenteditable]').innerText()).toBe('John\nDoe');});+it('should not double-fill in contenteditable with beforeinput handler in Firefox', {+ annotation: {+ type: 'issue',+ description: 'https://github.com/microsoft/playwright/issues/36715'+ }+}, async ({ page, browserName }) => {+ it.fixme(browserName === 'firefox', 'https://github.com/microsoft/playwright/issues/36715');++ await page.setContent(`+ <div id="editor" contenteditable="true"></div>+ <script>+ const editor = document.getElementById('editor');+ editor.addEventListener('beforeinput', (event) => {+ event.preventDefault();+ editor.textContent = event.data;+ });+ </script>+ `);++ const locator = page.locator('#editor');+ const testValue = 'Playwright';+ await locator.fill(testValue);+ await expect(locator).toHaveText(testValue);+});+it('should fill elements with existing value and selection', async ({ page, server }) => {await page.goto(server.PREFIX + '/input/textarea.html');