Files
CapaKraken/apps/web/e2e/estimates.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

79 lines
2.9 KiB
TypeScript

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");
});
});