Files
OpenHands/tests/e2e
Rohit Malhotraandopenhands 92b25e0af3 ci: selective E2E test execution based on changed files (#1286)
* ci: add paths filters to E2E workflows to skip irrelevant PRs

Add paths: filters to the pull_request triggers of the three E2E
workflows so they are skipped when a PR only touches files that
cannot affect the test suite (docs, specs, .agents/, unrelated
test directories, etc.).

- mock-llm-e2e.yml: triggers on src/, public/, scripts/, bin/,
  config/, tests/e2e/mock-llm/, tests/e2e/support/, package.json,
  package-lock.json, build/TS/styling configs, and its own workflow
  file.

- snapshot-tests.yml: triggers on src/, public/,
  tests/e2e/snapshots/, tests/e2e/support/, package.json,
  package-lock.json, build/TS/styling/playwright configs, and its
  own workflow file. Both pull_request and push-to-main triggers
  are filtered with the same path set.

- mock-llm-docker-e2e.yml: same paths as mock-llm-e2e.yml plus
  docker/** and playwright.mock-llm-docker.config.ts. The
  workflow_run trigger (post-Docker-build on main) is unaffected
  by path filters and always runs.

workflow_dispatch is unaffected by paths: filters in all three
workflows, so a manual run always executes the full suite.

Co-authored-by: openhands <openhands@all-hands.dev>

* ci: organize mock-LLM E2E tests into feature subdirectories with selective execution

Reorganize the 15 mock-LLM spec files from a flat directory into feature
subdirectories that mirror the source code structure:

  tests/e2e/mock-llm/
    settings/    — LLM profiles, ACP agent, model switching
    conversations/ — core conversation flow, image upload
    automations/ — automation lifecycle, preset cards
    onboarding/  — first-run onboarding flow
    backends/    — auth modes, cross-connect, partial stack
    home/        — workspace selection, folder browser
    skills/      — skill loading and activation
    regressions/ — CSS isolation, event pagination, etc.

Add a test-mapping config (test-mapping.json) and resolver script
(scripts/resolve-affected-tests.mjs) that maps changed source files
to the affected test subdirectories. The resolver has three modes:

  1. Feature-isolated changes (e.g. src/components/features/settings/**)
     → run only the mapped subdirs + regressions
  2. Cross-cutting changes (src/api/**, package.json, shared helpers,
     or any unmapped src/ file) → run the full suite (__ALL__)
  3. Non-relevant changes (docs, specs) → nothing (workflow paths
     filter already skipped)

The mock-llm-e2e.yml workflow now has a 'Resolve affected test
directories' step that queries PR changed files via the GitHub API,
runs the resolver, and passes the result to Playwright. workflow_dispatch
always runs the full suite.

All relative imports in moved spec files are updated. The Playwright
config discovers specs recursively so no config change is needed.

Co-authored-by: openhands <openhands@all-hands.dev>

* fix: update PROJECT_ROOT paths in backend specs moved to subdirectory

The partial-stack and cross-connect specs resolve PROJECT_ROOT from
import.meta.url using ../../.. (3 levels). After moving them from
tests/e2e/mock-llm/ to tests/e2e/mock-llm/backends/, they need
../../../.. (4 levels) to reach the repo root. Without this fix,
bin/agent-canvas.mjs resolves to a nonexistent path and the
backend-only test fails with MODULE_NOT_FOUND.

Co-authored-by: openhands <openhands@all-hands.dev>

* ci: include new mock-LLM specs in selective runs

Co-authored-by: openhands <openhands@all-hands.dev>

* ci: fail closed for mock e2e selection

Co-authored-by: openhands <openhands@all-hands.dev>

* ci: avoid pending skipped e2e checks

Co-authored-by: openhands <openhands@all-hands.dev>

* test: align folder workspace e2e with auto-selection

Co-authored-by: openhands <openhands@all-hands.dev>

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2026-06-13 00:30:09 -04:00
..