test: split out test for "text" option of ElementHandle.press (#4051)

This commit is contained in:
Andrey Lushnikov 2019-02-21 15:56:53 -08:00 committed by GitHub
parent ed984ac479
commit 7d39aca93c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,16 +55,22 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
await page.keyboard.press('Backspace'); await page.keyboard.press('Backspace');
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('Hello World!'); 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'); await page.goto(server.PREFIX + '/input/textarea.html');
const textarea = await page.$('textarea'); const textarea = await page.$('textarea');
await textarea.press('a', {text: 'f'}); await textarea.press('a');
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('f'); expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('a');
await page.evaluate(() => window.addEventListener('keydown', e => e.preventDefault(), true)); await page.evaluate(() => window.addEventListener('keydown', e => e.preventDefault(), true));
await textarea.press('a', {text: 'y'}); await textarea.press('b');
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('f'); 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}) => { it('should send a character with sendCharacter', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html'); await page.goto(server.PREFIX + '/input/textarea.html');