Wire all integrations + production hardening: 15 recommendations
Integration & Wiring: - useStore/useAppState wired into App.tsx (replaces 8 useState calls) - React Router wired at app root (URL-based navigation) - SparklineChart/MetricCard/BarChart integrated into Admin + Ethics pages - useNotifications.handleWSEvent wired into WebSocket handler - Notification center dropdown in header with unread badge - Locale selector added to Settings page (6 languages) - Dashboard data fetching with 10s polling into MetricCards - File drag-and-drop support on chat area Production Hardening: - PostgresStateBackend with connection pooling (psycopg2) - App lifespan wires backend from FUSIONAGI_DB_BACKEND env (memory|sqlite|postgres) - Redis cache wired from FUSIONAGI_REDIS_URL env at startup - Multi-process uvicorn config for horizontal scaling Testing: - Playwright visual regression tests (12 stories x 2 viewports) - k6 load test script with ramp/spike/ramp-down stages - 7 new Python tests (postgres fallback, app wiring) 575 Python tests + 45 frontend tests = 620 total, 0 ruff errors. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
This commit is contained in:
33
frontend/e2e/visual.config.ts
Normal file
33
frontend/e2e/visual.config.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Visual regression testing with Playwright screenshots.
|
||||
*
|
||||
* Run: npx playwright test --config=e2e/visual.config.ts
|
||||
*/
|
||||
|
||||
import { defineConfig, devices } from '@playwright/test'
|
||||
|
||||
export default defineConfig({
|
||||
testDir: '.',
|
||||
testMatch: 'visual.spec.ts',
|
||||
timeout: 30000,
|
||||
expect: {
|
||||
toHaveScreenshot: {
|
||||
maxDiffPixelRatio: 0.05,
|
||||
threshold: 0.2,
|
||||
},
|
||||
},
|
||||
use: {
|
||||
baseURL: 'http://localhost:6006', // Storybook
|
||||
screenshot: 'on',
|
||||
},
|
||||
projects: [
|
||||
{ name: 'desktop', use: { ...devices['Desktop Chrome'] } },
|
||||
{ name: 'mobile', use: { ...devices['iPhone 13'] } },
|
||||
],
|
||||
webServer: {
|
||||
command: 'npx storybook dev -p 6006 --no-open',
|
||||
port: 6006,
|
||||
reuseExistingServer: true,
|
||||
timeout: 60000,
|
||||
},
|
||||
})
|
||||
31
frontend/e2e/visual.spec.ts
Normal file
31
frontend/e2e/visual.spec.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Visual regression tests against Storybook stories.
|
||||
*
|
||||
* Run: npx playwright test --config=e2e/visual.config.ts
|
||||
* First run creates baseline screenshots; subsequent runs compare.
|
||||
*/
|
||||
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
const STORIES = [
|
||||
{ name: 'Avatar', path: '/iframe.html?id=components-avatar--default' },
|
||||
{ name: 'ChatMessage-User', path: '/iframe.html?id=components-chatmessage--user-message' },
|
||||
{ name: 'ChatMessage-Assistant', path: '/iframe.html?id=components-chatmessage--assistant-message' },
|
||||
{ name: 'ChatMessage-Code', path: '/iframe.html?id=components-chatmessage--with-code-block' },
|
||||
{ name: 'Markdown-Basic', path: '/iframe.html?id=components-markdown--basic-text' },
|
||||
{ name: 'Markdown-Code', path: '/iframe.html?id=components-markdown--code-block' },
|
||||
{ name: 'Skeleton-Single', path: '/iframe.html?id=components-skeleton--single-line' },
|
||||
{ name: 'Skeleton-Multi', path: '/iframe.html?id=components-skeleton--multiple-lines' },
|
||||
{ name: 'Toast-Info', path: '/iframe.html?id=components-toast--info' },
|
||||
{ name: 'Toast-Error', path: '/iframe.html?id=components-toast--error' },
|
||||
{ name: 'FilePreview-Text', path: '/iframe.html?id=components-filepreview--text-file' },
|
||||
{ name: 'FilePreview-Image', path: '/iframe.html?id=components-filepreview--image-file' },
|
||||
]
|
||||
|
||||
for (const story of STORIES) {
|
||||
test(`Visual: ${story.name}`, async ({ page }) => {
|
||||
await page.goto(story.path)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await expect(page).toHaveScreenshot(`${story.name}.png`)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user