Skip to content

chore: make fresh worktrees run e2e out of the box#243

Merged
tomasz-tomczyk merged 1 commit into
mainfrom
chore/worktree-e2e-out-of-box
May 30, 2026
Merged

chore: make fresh worktrees run e2e out of the box#243
tomasz-tomczyk merged 1 commit into
mainfrom
chore/worktree-e2e-out-of-box

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

A freshly created wt worktree of crit-web couldn't run the Playwright e2e suite without manual setup:

  • The [post-start] copy = "wt step copy-ignored" hook only copies git-ignored files that exist in the source checkout. The canonical crit-web/ checkout has no root node_modules — the root package.json Playwright deps (@playwright/test, @axe-core/playwright, @types/node) were never installed there, so there was nothing to copy. A fresh worktree hit Cannot find module '@playwright/test'.
  • crit-web had no local e2e runner. CI (.github/workflows/e2e.yml) installs deps inline, but a developer got nothing — manual npm install + asset build was required first.

This adds a single documented command, mise run e2e, that is idempotent and self-bootstrapping, mirroring .github/workflows/e2e.yml:

  • npm ci (root Playwright deps — the robust fix, since copy-ignored can only copy what already exists in the source)
  • npx playwright install chromium
  • npm install --prefix assets
  • MIX_ENV=test E2E=true mix deps.compile then mix compile (deps.compile guards against a stale copied _build/test — a fresh worktree's copied build can be missing a dep's Erlang parser .beam; CI never hits this since it builds the test tree fresh from cache)
  • mix assets.build
  • depends = ["db:start"] ensures the Postgres container is up (DB_PORT 5433 host → 5432 container, via mise.toml)
  • npx playwright test — extra args forward through (e.g. mise run e2e e2e/accessibility.spec.ts)

playwright.config.ts's managed webServer starts Phoenix and runs ecto.create/migrate itself.

Mirrors the intent of tomasz-tomczyk/crit#621 ("chore: make fresh worktrees and e2e work out of the box") for crit-web — an install step in the runner is the robust fix because copy-ignored can only copy what already exists in the source checkout.

Review

  • Code review: N/A (config + docs only; no app/test/CSS code)
  • Parity audit: N/A

Test plan

  • Simulated a fresh worktree (no root node_modules) and ran mise run e2e e2e/accessibility.spec.ts. The task bootstrapped everything (npm ci, playwright install, asset deps, test-env compile, assets.build, DB), started Phoenix, and ran the suite with no manual npm install. 2 specs passed; the 1 dark-theme color-contrast failure is pre-existing on main (subject of a separate task) and unrelated to this diff (which touches only mise.toml + AGENTS.md).
  • Confirmed the usage field replaces the deprecated arg() template function (no mise deprecation warning) and arg passthrough to a spec path works.

🤖 Generated with Claude Code

A freshly created `wt` worktree of crit-web couldn't run the Playwright
e2e suite without manual setup. The `[post-start] copy-ignored` hook only
copies git-ignored files that exist in the source checkout, but the
canonical checkout has no root `node_modules` — the root `package.json`
Playwright deps (`@playwright/test`, `@axe-core/playwright`, `@types/node`)
were never installed there, so there was nothing to copy. A fresh worktree
hit `Cannot find module '@playwright/test'`, and there was no local e2e
runner (CI installs deps inline, developers got nothing).

Add a `mise run e2e` task that is idempotent and self-bootstrapping,
mirroring `.github/workflows/e2e.yml`: `npm ci`, `npx playwright install
chromium`, `npm install --prefix assets`, test-env compile, `mix
assets.build`, ensures the Postgres container is up (`depends = db:start`,
DB_PORT 5433), then `npx playwright test` (extra args forward through to a
spec path). It also runs `mix deps.compile` before `mix compile` because a
copied `_build/test` can be stale (e.g. missing a dep's Erlang parser
.beam); CI never hits this since it builds the test tree fresh from cache.

Document the one command in AGENTS.md. Mirrors the intent of crit#621 for
crit-web (an install step in the runner is the robust fix, since copy-ignored
can only copy what already exists in the source checkout).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.42%. Comparing base (10b2fd7) to head (9b35ddf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #243   +/-   ##
=======================================
  Coverage   82.42%   82.42%           
=======================================
  Files          89       89           
  Lines        3089     3089           
=======================================
  Hits         2546     2546           
  Misses        543      543           
Flag Coverage Δ
unit 82.42% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomasz-tomczyk tomasz-tomczyk merged commit 6200f40 into main May 30, 2026
4 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the chore/worktree-e2e-out-of-box branch May 30, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant