Files
CapaKraken/apps/web/e2e/dashboard.spec.ts
T
Hartmut 6e5b9ec85b feat: Sprint 2 — test coverage, Dependabot, coverage gates, E2E expansion
API Router Integration Tests (43 new tests):
- dashboard-router.test.ts: 11 tests (all 5 queries + RBAC)
- project-router.test.ts: 17 tests (full CRUD + batch ops + RBAC)
- resource-router-crud.test.ts: 15 tests (CRUD + hover card + skill import)
- Fix: mock budget-alerts + cache in existing allocation/timeline tests

E2E Test Suite Expansion (29 new tests, 7 spec files):
- dashboard.spec.ts: widget grid, stat cards, add widget modal
- allocations.spec.ts: list, create modal, filters, column toggle
- estimates.spec.ts: list, wizard steps, navigation
- vacations.spec.ts: self-service, management, team calendar
- staffing.spec.ts: search, suggestions, skill tags
- admin.spec.ts: settings, users, roles, blueprints
- navigation.spec.ts: nav links, sidebar collapse, theme, mobile menu

Coverage Gates:
- api package: 80% lines, 75% branches
- application package: 80% lines, 75% branches (new vitest.config.ts)
- shared package: 70% lines, 65% branches
- CI updated to run per-package vitest --coverage

Dependabot:
- Weekly npm dependency checks with grouped minor+patch
- GitHub Actions version checks
- 10 PR limit for npm, 5 for Actions

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-19 21:29:58 +01:00

47 lines
1.8 KiB
TypeScript

import { expect, test } from "@playwright/test";
test.describe("Dashboard", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/auth/signin");
await page.fill('input[type="email"]', "admin@planarchy.dev");
await page.fill('input[type="password"]', "admin123");
await page.click('button[type="submit"]');
await expect(page).toHaveURL(/\/(dashboard|resources)/);
await page.goto("/dashboard");
});
test("loads with widget grid", async ({ page }) => {
await page.waitForLoadState("networkidle");
// Dashboard should render the react-grid-layout container
await expect(page.locator(".react-grid-layout")).toBeVisible({ timeout: 10000 });
});
test("shows at least one widget", async ({ page }) => {
await page.waitForLoadState("networkidle");
// Each widget is wrapped in a WidgetContainer inside the grid
const widgets = page.locator(".react-grid-item");
await expect(widgets.first()).toBeVisible({ timeout: 10000 });
const count = await widgets.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test("add widget modal opens and closes", async ({ page }) => {
await page.waitForLoadState("networkidle");
// Look for the "Add Widget" button
const addBtn = page.locator("button", { hasText: /Add Widget/i });
if ((await addBtn.count()) > 0) {
await addBtn.click();
await expect(page.locator("text=Add Widget").or(page.locator("text=Available Widgets"))).toBeVisible();
await page.keyboard.press("Escape");
}
});
test("reset layout button is available", async ({ page }) => {
await page.waitForLoadState("networkidle");
const resetBtn = page.locator("button", { hasText: /Reset Layout/i });
if ((await resetBtn.count()) > 0) {
await expect(resetBtn).toBeVisible();
}
});
});