Skip to content

Commit 3786c1a

Browse files
authored
Merge pull request #26 from DDecoene/chore/ci-e2e
ci: gate PRs with Playwright e2e + fix release-branch triggers
2 parents c7c42d7 + 9ab0197 commit 3786c1a

3 files changed

Lines changed: 38 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, 'release/**']
66
pull_request:
7-
branches: [main]
7+
branches: [main, 'release/**']
88

99
jobs:
10-
test:
10+
unit:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
@@ -22,3 +22,27 @@ jobs:
2222
- run: npm test
2323

2424
- run: npm run build
25+
26+
e2e:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 20
34+
cache: npm
35+
36+
- run: npm ci
37+
38+
- run: npx playwright install --with-deps chromium
39+
40+
# playwright.config.ts auto-starts the dev server (webServer block).
41+
- run: npx playwright test
42+
43+
- uses: actions/upload-artifact@v4
44+
if: failure()
45+
with:
46+
name: playwright-report
47+
path: playwright-report/
48+
retention-days: 7

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,9 @@ Playwright suites: `tests/integration.spec.ts` (20 tests — full REPL scenario)
246246
Complete these steps **in order** — do not skip or reorder:
247247

248248
1. **Branch correctly** — work sits on a `feature/<name>` branched off the milestone's `release/vX.Y.Z`; the PR is based on that release branch, **not** `main` (see Git conventions → GitFlow). Confirm the issue is assigned to the matching milestone.
249-
2. `npm test` passes — all tests green
250-
- **Every user-facing command/feature gets a Playwright e2e case, not just a vitest unit/integration test.** A REPL command needs at least one `tests/*.spec.ts` case that types it and asserts the rendered terminal/UI result; browser-only behavior (downloads, uploads, grid, wizards) must be exercised in a real browser. Unit coverage alone is not "done".
249+
2. `npm test` (vitest) **and** `npx playwright test` (e2e) both pass — all green.
250+
- **Every user-facing command/feature ships with a Playwright e2e case in the same PR, not just a vitest unit/integration test.** A REPL command needs at least one `tests/*.spec.ts` case that types it and asserts the rendered terminal/UI result; browser-only behavior (downloads, uploads, grid, wizards) must be exercised in a real browser. Unit coverage alone is not "done" — the #4 built-ins shipped broken because only unit tests (which bypass the parser) covered them.
251+
- **CI gates this.** `.github/workflows/ci.yml` runs a `unit` job (vitest + build) and an `e2e` job (Playwright, auto-starting the dev server via the `webServer` block in `playwright.config.ts`) on every push/PR to `main` and `release/**`. A PR is not mergeable until both jobs are green — do not merge a release-branch PR with red or missing CI.
251252
3. `package.json` version = the milestone's version (set on the `release/vX.Y.Z` branch); patch bumps for hotfixes
252253
4. `CHANGELOG.md` — add entry (Added / Fixed / Changed sections) under the milestone version heading
253254
5. `README.md` — command tables and feature list reflect what was built

playwright.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,12 @@ export default defineConfig({
1111
video: 'retain-on-failure',
1212
},
1313
reporter: [['list'], ['html', { open: 'never', outputFolder: 'playwright-report' }]],
14+
// Auto-start the dev server (Vite :5173 + WS :3000) for the e2e run. In CI a
15+
// fresh server is always started; locally an already-running server is reused.
16+
webServer: {
17+
command: 'npm run dev',
18+
url: 'http://localhost:5173',
19+
reuseExistingServer: !process.env.CI,
20+
timeout: 120_000,
21+
},
1422
});

0 commit comments

Comments
 (0)