fix(web): fail setInputFiles on a missing path as INVALID_ARGUMENT before clicking

Merged
KU
3d ago
+92-23

What and why

  • setInputFiles now fails with INVALID_ARGUMENT when a path doesn't exist, a test error, exit 1. same idea as the agent's upload.
  • before, playwright's ENOENT fell through classifyActionError to ENGINE_FAILURE, so a typo'd fixture path made the run exit 3 like an infra failure.
  • the check is a statSync at the top of uploadFiles, 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.mdx and the skill's writing-tests.md updated.

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:

mainthis branch
errorENGINE_FAILURE: ENOENT: no such file or directory, stat '...\fixtures\avatar.png'INVALID_ARGUMENT: setInputFiles path does not exist: ...\fixtures\avatar.png
exit code31

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/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.