fix(web): fail setInputFiles on a missing path as INVALID_ARGUMENT before clicking
Merged
KU
3d ago+92+92+01234567890123456789-23-23-01234567890123456789
What and why
setInputFilesnow fails withINVALID_ARGUMENTwhen a path doesn't exist, a test error, exit 1. same idea as the agent'supload.- before, playwright's
ENOENTfell throughclassifyActionErrortoENGINE_FAILURE, so a typo'd fixture path made the run exit 3 like an infra failure. - the check is a
statSyncat the top ofuploadFiles, so it runs before the element lookup and before a chooser button is clicked. a directory still goes through to playwright as before. - Throws row in
docs/reference/screen.mdxand the skill'swriting-tests.mdupdated.
Issue
Fixes #2038
Verified
Ran it locally: yes. the missing-upload repro (setInputFiles('fixtures/avatar.png') with no such file), published 0.16.1 vs a build of this branch:
| main | this branch | |
|---|---|---|
| error | ENGINE_FAILURE: ENOENT: no such file or directory, stat '...\fixtures\avatar.png' | INVALID_ARGUMENT: setInputFiles path does not exist: ...\fixtures\avatar.png |
| exit code | 3 | 1 |
pnpm --filter @e2e-dev/web exec vitest run tests/integration/upload-actions.test.ts: 16/16. the 4 new cases (a file input and a chooser button, each through a locator and an element, with a missing file and a path under a file) fail on main and check that nothing got set or clicked.
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.