- MCP server: stateless JSON-RPC 2.0 with 18 tools (tasks, habits, projects, notes, domains, search, activity) - Webhooks API: CRUD routes under /api/domains/[domainId]/webhooks/ with test endpoint and deliveries log - Webhook delivery: HMAC-SHA256 signed POST with retry (exponential backoff, max 6) - Worker rewrite: Drizzle ORM instead of PocketBase, polls jobs table, handles webhook_delivery, recurring_spawn, ai_dispatch - Rate limiting: token bucket per IP/API key (100 req/min REST, 300 req/min MCP) - Keyboard help overlay: ? opens Radix Dialog with search/filter, Esc closes - AI @mention stub: @agent in command palette dispatches CustomEvent - Mobile responsive: bottom nav, single-column kanban, day view calendar, 44px touch targets - Accessibility: skip-to-content link, focus rings, aria-labels, color contrast - E2E tests: mcp.spec.ts, webhooks.spec.ts, realtime.spec.ts added - Schema: api_keys and webhook_deliveries tables with migration - Removed old PocketBase-style database.ts from worker
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { login } from './helpers/auth';
|
|
|
|
test.describe('Realtime Updates', () => {
|
|
test('should connect to SSE endpoint', async ({ page }) => {
|
|
await login(page);
|
|
|
|
// Navigate to dashboard
|
|
await page.goto('/dashboard');
|
|
await expect(page.getByRole('heading', { name: /dashboard/i })).toBeVisible();
|
|
|
|
// The SSE connection is established automatically via the realtime hook
|
|
// Verify the page loaded without errors
|
|
const consoleMessages: string[] = [];
|
|
page.on('console', (msg) => {
|
|
if (msg.type() === 'error') {
|
|
consoleMessages.push(msg.text());
|
|
}
|
|
});
|
|
|
|
await page.waitForTimeout(2000);
|
|
|
|
// Check for SSE-related errors
|
|
const sseErrors = consoleMessages.filter(
|
|
(m) => m.includes('realtime') || m.includes('SSE') || m.includes('EventSource')
|
|
);
|
|
expect(sseErrors.length).toBe(0);
|
|
});
|
|
|
|
test('should have realtime API endpoint', async ({ page }) => {
|
|
const response = await page.request.get('/api/realtime');
|
|
// SSE endpoint should return 200 with text/event-stream content type
|
|
expect(response.status()).toBe(200);
|
|
const contentType = response.headers()['content-type'] || '';
|
|
expect(contentType).toContain('text/event-stream');
|
|
});
|
|
});
|