fix: allow email type in input for fill action (#353)

This commit is contained in:
Arjun Attam 2020-01-02 14:10:01 -08:00 committed by Joel Einbinder
parent 347123e6cc
commit 682e2be15f
2 changed files with 2 additions and 2 deletions

View file

@ -339,7 +339,7 @@ export const fillFunction = (node: Node) => {
if (element.nodeName.toLowerCase() === 'input') {
const input = element as HTMLInputElement;
const type = input.getAttribute('type') || '';
const kTextInputTypes = new Set(['', 'password', 'search', 'tel', 'text', 'url']);
const kTextInputTypes = new Set(['', 'email', 'password', 'search', 'tel', 'text', 'url']);
if (!kTextInputTypes.has(type.toLowerCase()))
return 'Cannot fill input of type "' + type + '".';
if (input.disabled)

View file

@ -977,7 +977,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
});
it('should throw on non-text inputs', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html');
for (const type of ['email', 'number', 'date']) {
for (const type of ['color', 'number', 'date']) {
await page.$eval('input', (input, type) => input.setAttribute('type', type), type);
let error = null;
await page.fill('input', '').catch(e => error = e);