From 7d39aca93c78b2026268805cddcd560ab7ff12ba Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 21 Feb 2019 15:56:53 -0800 Subject: [PATCH] test: split out test for "text" option of ElementHandle.press (#4051) --- test/keyboard.spec.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/keyboard.spec.js b/test/keyboard.spec.js index fe3117768b9..aee44bbec20 100644 --- a/test/keyboard.spec.js +++ b/test/keyboard.spec.js @@ -55,16 +55,22 @@ module.exports.addTests = function({testRunner, expect, FFOX}) { await page.keyboard.press('Backspace'); expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('Hello World!'); }); - it_fails_ffox('should send a character with ElementHandle.press', async({page, server}) => { + it('should send a character with ElementHandle.press', async({page, server}) => { await page.goto(server.PREFIX + '/input/textarea.html'); const textarea = await page.$('textarea'); - await textarea.press('a', {text: 'f'}); - expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('f'); + await textarea.press('a'); + expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('a'); await page.evaluate(() => window.addEventListener('keydown', e => e.preventDefault(), true)); - await textarea.press('a', {text: 'y'}); - expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('f'); + await textarea.press('b'); + expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('a'); + }); + it_fails_ffox('ElementHandle.press should support |text| option', async({page, server}) => { + await page.goto(server.PREFIX + '/input/textarea.html'); + const textarea = await page.$('textarea'); + await textarea.press('a', {text: 'ё'}); + expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('ё'); }); it('should send a character with sendCharacter', async({page, server}) => { await page.goto(server.PREFIX + '/input/textarea.html');