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,52 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Admin Pages", () => {
|
||||
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("settings page loads", async ({ page }) => {
|
||||
await page.goto("/admin/settings");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(page.locator("h1", { hasText: /System Settings/i })).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("users page loads with user list", async ({ page }) => {
|
||||
await page.goto("/admin/users");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(page.locator("h1", { hasText: /User Management/i })).toBeVisible({ timeout: 10000 });
|
||||
// Should show a table with at least the admin user
|
||||
await expect(page.locator("table")).toBeVisible({ timeout: 10000 });
|
||||
await expect(page.locator("text=admin@planarchy.dev")).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("roles page loads", async ({ page }) => {
|
||||
await page.goto("/roles");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(
|
||||
page.locator("h1").filter({ hasText: /Roles/i }),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
// Should show table or list of roles
|
||||
await expect(
|
||||
page.locator("table").or(page.locator("text=No roles")),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("blueprints page loads", async ({ page }) => {
|
||||
await page.goto("/admin/blueprints");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(
|
||||
page.locator("h1").filter({ hasText: /Blueprints/i }),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
// Should show blueprint cards or list from seed data
|
||||
await expect(
|
||||
page.locator("table")
|
||||
.or(page.locator("text=3D Content Production"))
|
||||
.or(page.locator("text=No blueprints")),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Allocations", () => {
|
||||
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("/allocations");
|
||||
});
|
||||
|
||||
test("allocation list loads with table", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
// The page title should be visible
|
||||
await expect(
|
||||
page.locator("h1").filter({ hasText: /Allocations|Planning/i }),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
// Table or empty state should be present
|
||||
await expect(
|
||||
page.locator("table").or(page.locator("text=No allocations")),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("new planning entry modal opens", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
const newBtn = page.locator("button", { hasText: /New Planning Entry/i });
|
||||
await expect(newBtn).toBeVisible({ timeout: 10000 });
|
||||
await newBtn.click();
|
||||
// Modal should appear with form fields
|
||||
await expect(
|
||||
page.locator("[role='dialog']").or(page.locator("text=Create").or(page.locator("text=Project"))),
|
||||
).toBeVisible({ timeout: 5000 });
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
test("filter by status works", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
// Look for status filter chips or dropdown
|
||||
const statusFilter = page.locator("button", { hasText: /Proposed|Confirmed|Active|Status/i }).first();
|
||||
if ((await statusFilter.count()) > 0) {
|
||||
await statusFilter.click();
|
||||
await page.waitForTimeout(300);
|
||||
// After clicking a status filter, the page should still show the table
|
||||
await expect(
|
||||
page.locator("table").or(page.locator("text=No allocations")),
|
||||
).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("column toggle panel works", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
const colToggle = page.locator("button", { hasText: /Columns/i });
|
||||
if ((await colToggle.count()) > 0) {
|
||||
await colToggle.click();
|
||||
await page.waitForTimeout(300);
|
||||
// A panel or dropdown with column checkboxes should appear
|
||||
await expect(
|
||||
page.locator("input[type='checkbox']").first(),
|
||||
).toBeVisible({ timeout: 3000 });
|
||||
await page.keyboard.press("Escape");
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
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();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Estimates", () => {
|
||||
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("/estimates");
|
||||
});
|
||||
|
||||
test("estimate list loads", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(
|
||||
page.locator("h1").filter({ hasText: /Estimates/i }),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
// Should show either a table/list or an empty state
|
||||
await expect(
|
||||
page.locator("table").or(page.locator("text=No estimates")).or(page.locator("[data-estimate-id]")),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("new estimate wizard opens with setup step", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
const newBtn = page.locator("button", { hasText: /New Estimate/i });
|
||||
await expect(newBtn).toBeVisible({ timeout: 10000 });
|
||||
await newBtn.click();
|
||||
// Wizard step 1 should appear: "Setup"
|
||||
await expect(
|
||||
page.locator("text=Setup").or(page.locator("text=Estimate Name")),
|
||||
).toBeVisible({ timeout: 5000 });
|
||||
});
|
||||
|
||||
test("estimate wizard navigates through steps", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.locator("button", { hasText: /New Estimate/i }).click();
|
||||
|
||||
// Step 1: Setup — fill a name
|
||||
await expect(page.locator("text=Setup")).toBeVisible({ timeout: 5000 });
|
||||
const nameInput = page.locator('input[placeholder*="name"]').or(page.locator('input[name="name"]')).first();
|
||||
if ((await nameInput.count()) > 0) {
|
||||
await nameInput.fill(`E2E Estimate ${Date.now()}`);
|
||||
}
|
||||
|
||||
// Click Next to go to step 2
|
||||
const nextBtn = page.locator("button", { hasText: "Next" });
|
||||
if ((await nextBtn.count()) > 0) {
|
||||
await nextBtn.click();
|
||||
await page.waitForTimeout(500);
|
||||
// Step 2: Assumptions
|
||||
await expect(
|
||||
page.locator("text=Assumptions").or(page.locator("text=Scope")),
|
||||
).toBeVisible({ timeout: 5000 });
|
||||
}
|
||||
|
||||
// Close the wizard without completing
|
||||
const cancelBtn = page.locator("button", { hasText: /Cancel|Close/i }).first();
|
||||
if ((await cancelBtn.count()) > 0) {
|
||||
await cancelBtn.click();
|
||||
} else {
|
||||
await page.keyboard.press("Escape");
|
||||
}
|
||||
});
|
||||
|
||||
test("estimate wizard shows all step labels", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.locator("button", { hasText: /New Estimate/i }).click();
|
||||
|
||||
// The wizard header should show step labels
|
||||
const steps = ["Setup", "Assumptions", "Scope", "Staffing", "Review"];
|
||||
for (const step of steps) {
|
||||
await expect(page.locator(`text=${step}`).first()).toBeVisible({ timeout: 5000 });
|
||||
}
|
||||
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
});
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Staffing", () => {
|
||||
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("/staffing");
|
||||
});
|
||||
|
||||
test("staffing page loads with search form", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(page.locator("h1", { hasText: /Staffing Suggestions/i })).toBeVisible({ timeout: 10000 });
|
||||
// Search form should have skill input, date fields, and a search button
|
||||
await expect(page.locator("text=How scoring works")).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("search form has default skill tags", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
// The StaffingPanel pre-populates with TypeScript and React skill tags
|
||||
await expect(
|
||||
page.locator("text=TypeScript").or(page.locator("text=React")),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("submitting search returns suggestions or empty state", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
// Click the search/submit button
|
||||
const searchBtn = page.locator("button", { hasText: /Search|Find|Suggest/i }).first();
|
||||
await expect(searchBtn).toBeVisible({ timeout: 10000 });
|
||||
await searchBtn.click();
|
||||
await page.waitForTimeout(1000);
|
||||
// After search, should show either suggestion cards or a "no suggestions" message
|
||||
await expect(
|
||||
page.locator("text=/Score|Availability|No suggestions|No matching/i").first()
|
||||
.or(page.locator("[data-suggestion]").first())
|
||||
.or(page.locator("table").first()),
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Vacations", () => {
|
||||
test.describe("My Vacations (self-service)", () => {
|
||||
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("/vacations/my");
|
||||
});
|
||||
|
||||
test("my vacations page loads", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(page.locator("h1", { hasText: "My Vacations" })).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("request vacation button is visible", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
await expect(
|
||||
page.locator("button", { hasText: /Request Vacation/i }),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("request vacation modal opens", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
const reqBtn = page.locator("button", { hasText: /Request Vacation/i });
|
||||
await reqBtn.click();
|
||||
// Modal should show vacation form
|
||||
await expect(
|
||||
page.locator("text=Request Vacation").or(page.locator("text=Vacation Type")),
|
||||
).toBeVisible({ timeout: 5000 });
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Vacation Management", () => {
|
||||
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("/vacations");
|
||||
});
|
||||
|
||||
test("vacation management page loads with tabs", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
// Should show List and Team Calendar tabs
|
||||
await expect(page.locator("text=List").first()).toBeVisible({ timeout: 10000 });
|
||||
await expect(page.locator("text=Team Calendar").first()).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("team calendar tab renders", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.locator("button", { hasText: "Team Calendar" }).or(page.locator("text=Team Calendar")).first().click();
|
||||
await page.waitForTimeout(500);
|
||||
// Calendar view should appear
|
||||
await expect(
|
||||
page.locator("table").or(page.locator("[data-calendar]")).or(page.locator("text=Mon").or(page.locator("text=Week"))),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test("filter chips are visible on list tab", async ({ page }) => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
// Status filter options should be visible
|
||||
await expect(
|
||||
page.locator("button", { hasText: /All|Pending|Approved/i }).first(),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user