test(selectText): restore firefox tests (#1829)

This commit is contained in:
Pavel Feldman 2020-04-16 12:31:22 -07:00 committed by GitHub
parent da24fe12a6
commit 5ec2c58a75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -328,19 +328,29 @@ describe('ElementHandle.fill', function() {
});
describe('ElementHandle.selectText', function() {
it.fail(FFOX)('should select textarea', async({page, server}) => {
it('should select textarea', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html');
const textarea = await page.$('textarea');
await textarea.evaluate(textarea => textarea.value = 'some value');
await textarea.selectText();
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
if (FFOX) {
expect(await textarea.evaluate(el => el.selectionStart)).toBe(0);
expect(await textarea.evaluate(el => el.selectionEnd)).toBe(10);
} else {
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
}
});
it.fail(FFOX)('should select input', async({page, server}) => {
it('should select input', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html');
const input = await page.$('input');
await input.evaluate(input => input.value = 'some value');
await input.selectText();
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
if (FFOX) {
expect(await input.evaluate(el => el.selectionStart)).toBe(0);
expect(await input.evaluate(el => el.selectionEnd)).toBe(10);
} else {
expect(await page.evaluate(() => window.getSelection().toString())).toBe('some value');
}
});
it('should select plain div', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html');