veza/apps/web/playwright.config.storybook.ts
senke 1efafe0cc5 test(storybook): Playwright suite for full Storybook + Spotify/Discord polish
- Add playwright.config.storybook.ts: runs against storybook-static on :6007
- Add e2e/tests/storybook/storybook-all.spec.ts: one test per story (load iframe, no errors)
- Add scripts/serve-storybook-static.cjs: serves build or stub (empty index) when no build
- npm run test:storybook:playwright (after build-storybook) for full coverage
- Storybook decorator: use bg-background / design tokens for dark (#121212)
- Preview: default dark background #121212
- Button: secondary/ghost/glass aligned to Spotify/Discord (white/5, white/10 hover)
- KodoEmptyState: softer orbs, compact copy, primary CTA without heavy glow

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-07 20:30:49 +01:00

59 lines
1.4 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
/**
* Playwright config for testing the full Storybook (all stories).
*
* Prerequisite: build Storybook first:
* npm run build-storybook
*
* Then run:
* npm run test:storybook:playwright
*
* The config starts a static server for storybook-static on port 6007
* (reuse existing if already running). Tests load each story iframe and
* assert no console errors / page crashes.
*/
const STORYBOOK_PORT = 6007;
const STORYBOOK_BASE = `http://localhost:${STORYBOOK_PORT}`;
export default defineConfig({
testDir: './e2e/tests/storybook',
testMatch: /.*\.spec\.ts/,
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? 2 : 4,
timeout: 25000,
outputDir: 'e2e/test-results-storybook',
reporter: [
['html', { outputFolder: 'e2e/playwright-report-storybook', open: 'never' }],
['list'],
],
use: {
baseURL: STORYBOOK_BASE,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'off',
viewport: { width: 1280, height: 720 },
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 720 },
},
},
],
webServer: {
command: 'node scripts/serve-storybook-static.cjs',
url: `${STORYBOOK_BASE}/index.json`,
reuseExistingServer: true,
timeout: 60_000,
cwd: process.cwd(),
},
});