ci(storybook): wire test:storybook into CI (#1251) (#1297)

* ci(storybook): wire test:storybook into CI (#1251)

- Add test:storybook:watch to clients/web for interactive iteration; the
  one-shot script already existed.
- Surface test:storybook at the repo root, delegating to the web client.
- Add a separate CI step that installs the Playwright Chromium binary
  and runs the storybook play-function suite after validate. Kept out of
  validate because the suite needs a real browser and is ~10s slower
  than the unit tests.
- Document the new pre-push step in AGENTS.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci(storybook): cache Playwright browsers + tighten AGENTS wording

Cache the Chromium binary keyed on clients/web/package-lock.json so the
~150MB download is a no-op on CI cache hits. Also clarify that CI runs
test:storybook after the unit/lint/build checks (not literal `validate`,
which is a local-only script).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cliff Hall 2026-05-10 15:58:15 -04:00 • committed by GitHub
commit a4215e57b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 4 deletions

View file

@ -1,6 +1,6 @@
name: Run install, format, lint, build, and test on every push or pull request name: Run install, format, lint, build, and test on every push
on: [push, pull_request] on: [push]
jobs: jobs:
build: build:
@ -38,3 +38,17 @@ jobs:
- name: Run tests with coverage - name: Run tests with coverage
working-directory: ./clients/web working-directory: ./clients/web
run: npm run test:coverage run: npm run test:coverage
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('clients/web/package-lock.json') }}
- name: Install Playwright browsers
working-directory: ./clients/web
run: npx playwright install --with-deps chromium
- name: Run Storybook play-function tests
working-directory: ./clients/web
run: npm run test:storybook

View file

@ -77,6 +77,7 @@ All work should be driven by items on the project board.
### Lint-fixed, Formatted code ### Lint-fixed, Formatted code
- ALWAYS do `npm run validate` before pushing any changes, this runs the various lint, build, format checks, etc. - ALWAYS do `npm run validate` before pushing any changes, this runs the various lint, build, format checks, etc.
- Also run `npm run test:storybook` before pushing — it executes every story's `play` function in headless Chromium via `@vitest/browser-playwright` (~10s). CI runs this as a separate step after the unit/lint/build checks; failures block merge. It is kept out of `validate` because it needs the Playwright browser binary and is much slower than the unit suite.
### Typescript instructions ### Typescript instructions
- Use TypeScript for all new code - Use TypeScript for all new code

View file

@ -16,7 +16,8 @@
"test": "vitest run --project=unit", "test": "vitest run --project=unit",
"test:watch": "vitest --project=unit", "test:watch": "vitest --project=unit",
"test:coverage": "vitest run --project=unit --coverage", "test:coverage": "vitest run --project=unit --coverage",
"test:storybook": "vitest run --project=storybook" "test:storybook": "vitest run --project=storybook",
"test:storybook:watch": "vitest --project=storybook"
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.14.0", "@emotion/react": "^11.14.0",

View file

@ -21,7 +21,8 @@
"scripts": { "scripts": {
"validate": "cd ./clients/web/ && npm run validate", "validate": "cd ./clients/web/ && npm run validate",
"test": "cd ./clients/web/ && npm run test", "test": "cd ./clients/web/ && npm run test",
"test:coverage": "cd ./clients/web/ && npm run test:coverage" "test:coverage": "cd ./clients/web/ && npm run test:coverage",
"test:storybook": "cd ./clients/web/ && npm run test:storybook"
}, },
"dependencies": { "dependencies": {
"@modelcontextprotocol/ext-apps": "^1.7.1", "@modelcontextprotocol/ext-apps": "^1.7.1",