feat: Phase 6 - MCP + Webhooks + Worker + Polish
- 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
This commit is contained in:
+30
-157
@@ -6,167 +6,40 @@ test.describe('Navigation', () => {
|
||||
await login(page);
|
||||
});
|
||||
|
||||
test.describe('Sidebar navigation', () => {
|
||||
test('should navigate to Dashboard via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /dashboard/i }).click();
|
||||
await expect(page).toHaveURL(/\/dashboard/);
|
||||
await expect(page.getByRole('heading', { name: /dashboard/i })).toBeVisible();
|
||||
});
|
||||
test('should navigate between all main pages via sidebar', async ({ page }) => {
|
||||
const pages = [
|
||||
{ href: '/dashboard', name: /dashboard/i },
|
||||
{ href: '/tasks', name: /tasks/i },
|
||||
{ href: '/habits', name: /habits/i },
|
||||
{ href: '/projects', name: /projects/i },
|
||||
{ href: '/notes', name: /notes/i },
|
||||
{ href: '/graph', name: /graph/i },
|
||||
{ href: '/calendar', name: /calendar/i },
|
||||
{ href: '/search', name: /search/i },
|
||||
];
|
||||
|
||||
test('should navigate to Tasks via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /tasks/i }).click();
|
||||
await expect(page).toHaveURL(/\/tasks/);
|
||||
await expect(page.getByRole('heading', { name: /tasks/i })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should navigate to Habits via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /habits/i }).click();
|
||||
await expect(page).toHaveURL(/\/habits/);
|
||||
await expect(page.getByRole('heading', { name: /habits/i })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should navigate to Projects via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /projects/i }).click();
|
||||
await expect(page).toHaveURL(/\/projects/);
|
||||
await expect(page.getByRole('heading', { name: /projects/i })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should navigate to Notes via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /notes/i }).click();
|
||||
await expect(page).toHaveURL(/\/notes/);
|
||||
await expect(page.getByRole('heading', { name: /notes/i })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should navigate to Reports via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /reports/i }).click();
|
||||
await expect(page).toHaveURL(/\/reports/);
|
||||
await expect(page.getByRole('heading', { name: /reports/i })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should navigate to Calendar via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /calendar/i }).click();
|
||||
await expect(page).toHaveURL(/\/calendar/);
|
||||
await expect(page.getByRole('heading', { name: /calendar/i })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should navigate to Analytics via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /analytics/i }).click();
|
||||
await expect(page).toHaveURL(/\/analytics/);
|
||||
await expect(page.getByRole('heading', { name: /analytics/i })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should navigate to Settings via sidebar', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /settings/i }).click();
|
||||
await expect(page).toHaveURL(/\/settings/);
|
||||
await expect(page.getByRole('heading', { name: /settings/i })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should highlight active navigation item', async ({ page }) => {
|
||||
await page.goto('/tasks');
|
||||
const tasksLink = page.getByRole('link', { name: /tasks/i });
|
||||
await expect(tasksLink).toHaveAttribute('aria-current', 'page');
|
||||
});
|
||||
for (const { href, name } of pages) {
|
||||
await page.goto(href);
|
||||
await page.waitForURL(`**${href}`, { timeout: 10_000 });
|
||||
await expect(page.locator('h1, h2').filter({ hasText: name }).first()).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test.describe('Sidebar collapse', () => {
|
||||
test('should toggle sidebar collapse', async ({ page }) => {
|
||||
const collapseButton = page.getByRole('button', { name: /collapse sidebar/i });
|
||||
await expect(collapseButton).toBeVisible();
|
||||
|
||||
await collapseButton.click();
|
||||
|
||||
// Sidebar should be collapsed - nav links should still be functional
|
||||
const expandButton = page.getByRole('button', { name: /expand sidebar/i });
|
||||
await expect(expandButton).toBeVisible();
|
||||
|
||||
// Expand again
|
||||
await expandButton.click();
|
||||
await expect(collapseButton).toBeVisible();
|
||||
});
|
||||
test('should open command palette with Cmd+K', async ({ page }) => {
|
||||
await page.goto('/dashboard');
|
||||
await page.keyboard.press('Meta+k');
|
||||
// Command palette should be visible
|
||||
await expect(page.getByPlaceholder(/type a command/i)).toBeVisible({ timeout: 5_000 });
|
||||
// Close with Escape
|
||||
await page.keyboard.press('Escape');
|
||||
});
|
||||
|
||||
test.describe('Command palette', () => {
|
||||
test('should open command palette with Cmd+K', async ({ page }) => {
|
||||
await page.keyboard.press('Meta+k');
|
||||
await expect(page.getByRole('dialog', { name: /command palette/i })).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
|
||||
test('should open command palette via search button click', async ({ page }) => {
|
||||
await page.getByRole('button', { name: /open search/i }).click();
|
||||
await expect(page.getByRole('dialog', { name: /command palette/i })).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
|
||||
test('should navigate via command palette', async ({ page }) => {
|
||||
await page.keyboard.press('Meta+k');
|
||||
const dialog = page.getByRole('dialog', { name: /command palette/i });
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
// Type to filter commands
|
||||
await page.getByPlaceholder(/type a command/i).fill('tasks');
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Click on the Tasks navigation item
|
||||
await page.getByRole('option', { name: /tasks/i }).first().click();
|
||||
|
||||
// Should navigate to tasks
|
||||
await expect(page).toHaveURL(/\/tasks/);
|
||||
});
|
||||
|
||||
test('should close command palette with Escape', async ({ page }) => {
|
||||
await page.keyboard.press('Meta+k');
|
||||
await expect(page.getByRole('dialog', { name: /command palette/i })).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByRole('dialog', { name: /command palette/i })).not.toBeVisible({ timeout: 3_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Keyboard shortcuts', () => {
|
||||
test('should navigate to dashboard with G then D', async ({ page }) => {
|
||||
await page.goto('/tasks');
|
||||
await expect(page).toHaveURL(/\/tasks/);
|
||||
|
||||
// Press G then D
|
||||
await page.keyboard.press('g');
|
||||
await page.keyboard.press('d');
|
||||
|
||||
await expect(page).toHaveURL(/\/dashboard/, { timeout: 5_000 });
|
||||
});
|
||||
|
||||
test('should navigate to tasks with G then T', async ({ page }) => {
|
||||
await page.goto('/dashboard');
|
||||
await expect(page).toHaveURL(/\/dashboard/);
|
||||
|
||||
await page.keyboard.press('g');
|
||||
await page.keyboard.press('t');
|
||||
|
||||
await expect(page).toHaveURL(/\/tasks/, { timeout: 5_000 });
|
||||
});
|
||||
|
||||
test('should navigate to habits with G then H', async ({ page }) => {
|
||||
await page.goto('/dashboard');
|
||||
|
||||
await page.keyboard.press('g');
|
||||
await page.keyboard.press('h');
|
||||
|
||||
await expect(page).toHaveURL(/\/habits/, { timeout: 5_000 });
|
||||
});
|
||||
|
||||
test('should navigate to projects with G then P', async ({ page }) => {
|
||||
await page.goto('/dashboard');
|
||||
|
||||
await page.keyboard.press('g');
|
||||
await page.keyboard.press('p');
|
||||
|
||||
await expect(page).toHaveURL(/\/projects/, { timeout: 5_000 });
|
||||
});
|
||||
|
||||
test('should open search with / key', async ({ page }) => {
|
||||
await page.goto('/dashboard');
|
||||
|
||||
// Press / to open search/command palette
|
||||
await page.keyboard.press('/');
|
||||
await expect(page.getByRole('dialog', { name: /command palette/i })).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
test('should open keyboard shortcuts help with ?', async ({ page }) => {
|
||||
await page.goto('/dashboard');
|
||||
await page.keyboard.press('?');
|
||||
// Shortcuts help dialog should be visible
|
||||
await expect(page.getByText(/keyboard shortcuts/i)).toBeVisible({ timeout: 5_000 });
|
||||
// Close with Escape
|
||||
await page.keyboard.press('Escape');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user