diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 56010eef..93444d21 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: build: @@ -38,3 +38,17 @@ jobs: - name: Run tests with coverage working-directory: ./clients/web 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 diff --git a/AGENTS.md b/AGENTS.md index 71f9493e..aeb445a4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -77,6 +77,7 @@ All work should be driven by items on the project board. ### Lint-fixed, Formatted code - 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 - Use TypeScript for all new code diff --git a/clients/web/package.json b/clients/web/package.json index cae64f53..0684d21c 100644 --- a/clients/web/package.json +++ b/clients/web/package.json @@ -16,7 +16,8 @@ "test": "vitest run --project=unit", "test:watch": "vitest --project=unit", "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": { "@emotion/react": "^11.14.0", diff --git a/package.json b/package.json index 2ad3d018..ceb784e6 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "scripts": { "validate": "cd ./clients/web/ && npm run validate", "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": { "@modelcontextprotocol/ext-apps": "^1.7.1",