fix: improve browser upload triggering

This commit is contained in:
Peter Steinberger
2026-01-01 09:35:20 +00:00
parent fbcbc60e85
commit bf0bee58b3
9 changed files with 50 additions and 0 deletions
+14
View File
@@ -283,6 +283,20 @@ export async function armFileUploadViaPlaywright(opts: {
return;
}
await fileChooser.setFiles(opts.paths);
try {
const input =
typeof fileChooser.element === "function"
? await fileChooser.element()
: null;
if (input) {
await input.evaluate((el) => {
el.dispatchEvent(new Event("input", { bubbles: true }));
el.dispatchEvent(new Event("change", { bubbles: true }));
});
}
} catch {
// Best-effort for sites that don't react to setFiles alone.
}
})
.catch(() => {
// Ignore timeouts; the chooser may never appear.