fix(e2e): keep runner errors from a config-loaded engine classified
An engine loaded from e2e.config.ts comes from a second copy of the runner, so its TestError fails instanceof E2EError. translateEngineError only had the instanceof check, so it turned the engine's INVALID_LOCATOR (and any other runner code an engine throws) into an infrastructure ENGINE_FAILURE with exit 3. In-process runs were fine, which is why the in-process web-platform test never caught it.
isForeignE2EErrorbecomesisE2EError(packages/e2e/src/internal/errors.ts), the one predicate for "runner error from any module copy". It matches local instances too, since they carry the sameSymbol.formarker.- Every runner-error
instanceofinpackages/e2e/srcthat can see a foreign error now uses it:translateEngineError,translateProvisioningError,codedMessage,classifyError, config load, engine session normalize,expect.pollnot-yet, agent phase codes,isModelUnreachable,toAgentError, and collection (isCollectionError, keyed onCOLLECTION_ERROR). - Collection had the same bug: a test file collects in its own copy, so its
CollectionErrorwas reported asfailed to collect <file>: ...instead of<file>: .... classifyAttemptStatusdropsinstanceof TestTimeoutError; theTEST_TIMEOUTcode check already covered it.@e2e-dev/weband@e2e-dev/mobilealready fall back tonamechecks for foreign errors, so they are unchanged.
Tests: tests/integration/foreign-engine-errors.test.ts runs through runProjectWithConfigFile and asserts the caught code, the reported code and category, and the collection message. A unit test pins translateEngineError. Mutation-checked: reverting either translateEngineError or isCollectionError fails them.
Follow-up: oskar/tests-integration loosened the *css= case in web-platform.test.ts to assert the message because of this bug. Once both land it can assert INVALID_LOCATOR again, like the in-process version on main does.
Verified
Ran it locally: yes
- testbed, built CLI, a scratch test running
browser.locator('*css=ul[aria-label="Todo column"] >> li').count()on/board:node node_modules/e2e/dist/cli/bin.js run tests/zz-foreign-errors.e2e.ts
| main | this branch |
|---|---|
ENGINE_FAILURE: a selector that captures with * (*css=article >> text=Hello) is not supported: use filter({ has }) instead, exit 3 | INVALID_LOCATOR: a selector that captures with * (*css=article >> text=Hello) is not supported: use filter({ has }) instead, exit 1 |
- New integration test fails on main (both
INVALID_LOCATORcases getENGINE_FAILURE) and passes here.