chore: make fresh worktrees run e2e out of the box#243
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A freshly created
wtworktree of crit-web couldn't run the Playwright e2e suite without manual setup:[post-start] copy = "wt step copy-ignored"hook only copies git-ignored files that exist in the source checkout. The canonicalcrit-web/checkout has no rootnode_modules— the rootpackage.jsonPlaywright deps (@playwright/test,@axe-core/playwright,@types/node) were never installed there, so there was nothing to copy. A fresh worktree hitCannot find module '@playwright/test'..github/workflows/e2e.yml) installs deps inline, but a developer got nothing — manualnpm 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 chromiumnpm install --prefix assetsMIX_ENV=test E2E=true mix deps.compilethenmix 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.builddepends = ["db:start"]ensures the Postgres container is up (DB_PORT 5433 host → 5432 container, viamise.toml)npx playwright test— extra args forward through (e.g.mise run e2e e2e/accessibility.spec.ts)playwright.config.ts's managedwebServerstarts 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-ignoredcan only copy what already exists in the source checkout.Review
Test plan
node_modules) and ranmise 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 manualnpm install. 2 specs passed; the 1 dark-theme color-contrast failure is pre-existing onmain(subject of a separate task) and unrelated to this diff (which touches onlymise.toml+AGENTS.md).usagefield replaces the deprecatedarg()template function (no mise deprecation warning) and arg passthrough to a spec path works.🤖 Generated with Claude Code