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>
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Navigation", () => {
|
||||
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)/);
|
||||
});
|
||||
|
||||
test("main nav links navigate correctly", async ({ page }) => {
|
||||
const navRoutes = [
|
||||
{ label: "Dashboard", url: "/dashboard" },
|
||||
{ label: "Timeline", url: "/timeline" },
|
||||
{ label: "Allocations", url: "/allocations" },
|
||||
{ label: "Resources", url: "/resources" },
|
||||
{ label: "Projects", url: "/projects" },
|
||||
];
|
||||
|
||||
for (const route of navRoutes) {
|
||||
const navLink = page.locator(`nav a >> text="${route.label}"`).first();
|
||||
await navLink.click();
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(page).toHaveURL(new RegExp(route.url));
|
||||
}
|
||||
});
|
||||
|
||||
test("sidebar collapse and expand works", async ({ page }) => {
|
||||
await page.goto("/dashboard");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// Find the collapse button (contains "Collapse" text)
|
||||
const collapseBtn = page.locator("nav button", { hasText: "Collapse" });
|
||||
if ((await collapseBtn.count()) > 0) {
|
||||
await collapseBtn.click();
|
||||
await page.waitForTimeout(300);
|
||||
// After collapsing, the sidebar should be narrow (72px)
|
||||
const nav = page.locator("nav").first();
|
||||
const box = await nav.boundingBox();
|
||||
if (box) {
|
||||
expect(box.width).toBeLessThan(100);
|
||||
}
|
||||
|
||||
// Expand again — the button should still be visible as an icon
|
||||
const expandBtn = page.locator("nav button").filter({ has: page.locator("svg") }).last();
|
||||
await expandBtn.click();
|
||||
await page.waitForTimeout(300);
|
||||
const boxExpanded = await nav.boundingBox();
|
||||
if (boxExpanded) {
|
||||
expect(boxExpanded.width).toBeGreaterThan(200);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("preferences modal opens via sidebar button", async ({ page }) => {
|
||||
await page.goto("/dashboard");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
const prefsBtn = page.locator("nav button", { hasText: "Preferences" });
|
||||
if ((await prefsBtn.count()) > 0) {
|
||||
await prefsBtn.click();
|
||||
await expect(page.locator("text=Preferences")).toBeVisible({ timeout: 5000 });
|
||||
// Should show theme/mode controls
|
||||
await expect(
|
||||
page.locator("text=Light").or(page.locator("text=Dark").or(page.locator("text=System"))),
|
||||
).toBeVisible();
|
||||
// Close the modal
|
||||
await page.keyboard.press("Escape");
|
||||
}
|
||||
});
|
||||
|
||||
test("mobile hamburger menu opens sidebar on small viewport", async ({ page }) => {
|
||||
// Set a mobile viewport size
|
||||
await page.setViewportSize({ width: 375, height: 812 });
|
||||
await page.goto("/dashboard");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// The hamburger button should be visible on mobile
|
||||
const hamburgerBtn = page.locator("button").filter({ has: page.locator("svg") }).first();
|
||||
await expect(hamburgerBtn).toBeVisible({ timeout: 5000 });
|
||||
|
||||
await hamburgerBtn.click();
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Mobile sidebar overlay should appear with nav links
|
||||
await expect(page.locator("text=Dashboard")).toBeVisible();
|
||||
await expect(page.locator("text=Timeline")).toBeVisible();
|
||||
|
||||
// Close button should be visible in mobile sidebar
|
||||
const closeBtn = page
|
||||
.locator("nav button")
|
||||
.filter({ has: page.locator("svg") })
|
||||
.first();
|
||||
if ((await closeBtn.count()) > 0) {
|
||||
await closeBtn.click();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user