Phase 0 (CI/CD): fix root typecheck to cover api+worker+web; reconcile migration story into idempotent db:migrate (db:sync + db:triggers); add Gitea Actions quality/deploy/smoke workflow; rewrite README/AGENTS/DEPLOY docs; add requireWorkspaceAccess + recordActivityForEntity conventions. Phase 1 (critical fixes): calendar delete + drag/resize DnD; canvas card CRUD + bulk save + debounced autosave; logout route; graph edge workspaceId derivation; real analytics endpoints (drop Math.random); task board droppable columns + reorder persistence; Tiptap notes editor with sanitized HTML rendering; remove insecure passkey auth; domain/owner scoping (IDOR) on all by-ID routes + search/ export/realtime scoping; command palette routing + agent mention fetch; agent activity SSE handler; graph fly-to with tracked positions. Phase 2 (UX polish): login on design system; Sonner toasts app-wide; shared Loading/Empty/Error state components; working density/sidebarPos/reduce-motion settings; Inter typography; consolidated status-colors lib; unified detail routes; dashboard sort/realtime/responsive fixes; mobile responsive; a11y (radiogroups, sanitized snippets, badge labels). Phase 3 (features): daily notes timezone fix + delete + autosave + mood/energy create; active-domain store + topbar picker; graph domain picker + navigable entity links; tag assign/remove UI + server-side tag filter; real CSV export + import validation; custom fields on tasks. Phase 4 (advanced): migrate job worker into apps/worker (webhook delivery with HMAC, recurring spawn, ai_dispatch disabled); webhook queue helper + entity event enqueuing + test endpoint fix; recurring scheduledJobs pipeline; agents CRUD + permission editing + activity filters; real notifications feed; MCP polish (validation, error codes, domain scoping, dead sql leftover). Phase 5 (E2E + docs): rewrite Playwright suite for the Vite SPA (15 specs, new auth helpers, chromium-only in CI); add ephemeral-Postgres e2e CI job; rewrite docs/API.md for the real Hono API.
76 lines
3.3 KiB
TypeScript
76 lines
3.3 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { login } from './helpers/auth';
|
|
import { testCalendarEvents } from './helpers/fixtures';
|
|
|
|
test.describe('Calendar', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await login(page);
|
|
await page.goto('/calendar');
|
|
await expect(page.getByRole('heading', { name: /calendar/i })).toBeVisible();
|
|
});
|
|
|
|
/** Fill the New Event dialog and submit it, returning the POST response. */
|
|
async function createEvent(page: import('@playwright/test').Page, title: string) {
|
|
await page.getByRole('button', { name: /new event/i }).first().click();
|
|
|
|
const dialog = page.getByRole('dialog');
|
|
await expect(dialog).toBeVisible();
|
|
await expect(dialog.getByRole('heading', { name: 'New Event' })).toBeVisible();
|
|
|
|
await dialog.getByLabel('Title').fill(title);
|
|
|
|
// The API requires an ISO start time; schedule the event for today so it
|
|
// lands in the current month view.
|
|
const pad = (n: number) => String(n).padStart(2, '0');
|
|
const start = new Date();
|
|
const end = new Date(start.getTime() + 60 * 60 * 1000);
|
|
const toLocal = (d: Date) =>
|
|
`${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
await dialog.getByLabel('Start').fill(toLocal(start));
|
|
await dialog.getByLabel('End').fill(toLocal(end));
|
|
|
|
const createResponse = page.waitForResponse(
|
|
(resp) => resp.url().includes('/api/calendar/events') && resp.request().method() === 'POST',
|
|
);
|
|
await dialog.getByRole('button', { name: /create event/i }).click();
|
|
await createResponse;
|
|
await expect(dialog).toBeHidden();
|
|
}
|
|
|
|
test('renders the calendar page', async ({ page }) => {
|
|
// react-big-calendar only mounts once events exist; otherwise a friendly
|
|
// empty state is shown. Accept either so a fresh DB still passes.
|
|
await expect(
|
|
page.getByText(/no events yet/i).or(page.locator('.rbc-calendar-container')),
|
|
).toBeVisible({ timeout: 10_000 });
|
|
});
|
|
|
|
test('creates an event via the New Event dialog', async ({ page }) => {
|
|
await createEvent(page, testCalendarEvents.title);
|
|
|
|
// The calendar now renders and the event shows up on it.
|
|
await expect(page.locator('.rbc-calendar-container')).toBeVisible({ timeout: 10_000 });
|
|
await expect(
|
|
page.locator('.rbc-event').filter({ hasText: testCalendarEvents.title }),
|
|
).toBeVisible({ timeout: 10_000 });
|
|
});
|
|
|
|
test('switches between month, week, and day views', async ({ page }) => {
|
|
// The toolbar only exists when the calendar is rendered, so make sure at
|
|
// least one event exists first.
|
|
if (!(await page.locator('.rbc-calendar-container').isVisible().catch(() => false))) {
|
|
await createEvent(page, `${testCalendarEvents.title} view`);
|
|
}
|
|
|
|
await expect(page.locator('.rbc-calendar-container')).toBeVisible({ timeout: 10_000 });
|
|
await page.getByRole('button', { name: 'Week', exact: true }).click();
|
|
await expect(page.locator('.rbc-calendar-container')).toBeVisible();
|
|
|
|
await page.getByRole('button', { name: 'Day', exact: true }).click();
|
|
await expect(page.locator('.rbc-calendar-container')).toBeVisible();
|
|
|
|
await page.getByRole('button', { name: 'Month', exact: true }).click();
|
|
await expect(page.locator('.rbc-calendar-container')).toBeVisible();
|
|
});
|
|
});
|