Fix file input in tests

This commit is contained in:
adroitwhiz 2020-03-08 08:12:40 -04:00
parent fdd02a6bd6
commit 34072d2f53
5 changed files with 79 additions and 65 deletions
test/integration

View file

@ -13,9 +13,12 @@ const runFile = async (file, action, page, script) => {
await page.goto(`file://${indexHTML}`);
const fileInput = await page.$('#file');
await fileInput.uploadFile(testDir(file));
// the index.html handler for file input will add a #loaded element when it
// finishes.
await page.waitForSelector('#loaded');
await page.evaluate(() =>
// `loadFile` is defined on the page itself.
// eslint-disable-next-line no-undef
loadFile()
);
return page.evaluate(`(function () {return (${script})(${action});})()`);
};