chore(repo): initialize planarchy workspace
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Authentication", () => {
|
||||
test("redirects unauthenticated users to sign-in", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page).toHaveURL(/\/auth\/signin/);
|
||||
});
|
||||
|
||||
test("admin can sign in", 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(/\/resources/);
|
||||
});
|
||||
|
||||
test("shows error on invalid credentials", async ({ page }) => {
|
||||
await page.goto("/auth/signin");
|
||||
await page.fill('input[type="email"]', "wrong@example.com");
|
||||
await page.fill('input[type="password"]', "wrongpass");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator("text=Invalid email or password")).toBeVisible();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Projects", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto("/auth/signin");
|
||||
await page.fill('input[type="email"]', "manager@planarchy.dev");
|
||||
await page.fill('input[type="password"]', "manager123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL(/\/resources/);
|
||||
await page.goto("/projects");
|
||||
});
|
||||
|
||||
test("shows projects list", async ({ page }) => {
|
||||
await expect(page.locator("h1")).toContainText("Projects");
|
||||
await expect(page.locator("table")).toBeVisible();
|
||||
});
|
||||
|
||||
test("project wizard — opens and shows step 1", async ({ page }) => {
|
||||
await page.locator("button", { hasText: "New Project" }).click();
|
||||
await expect(page.locator("text=Select Blueprint")).toBeVisible();
|
||||
});
|
||||
|
||||
test("project wizard — completes all 5 steps", async ({ page }) => {
|
||||
await page.locator("button", { hasText: "New Project" }).click();
|
||||
|
||||
// Step 1: Blueprint selection
|
||||
await expect(page.locator("text=Select Blueprint")).toBeVisible();
|
||||
// Select the first available blueprint
|
||||
const blueprintCard = page.locator("[data-blueprint-id]").first()
|
||||
.or(page.locator("button").filter({ hasText: /Blueprint|Production/ }).first());
|
||||
if (await blueprintCard.count() > 0) {
|
||||
await blueprintCard.click();
|
||||
} else {
|
||||
// Click next without blueprint if none shown
|
||||
const nextBtn = page.locator("button", { hasText: "Next" });
|
||||
await nextBtn.click();
|
||||
}
|
||||
|
||||
// Step 2: Timeline — set project dates
|
||||
await expect(page.locator("text=Timeline").or(page.locator("text=Project Dates"))).toBeVisible({ timeout: 5000 });
|
||||
const projectNameInput = page.locator('input[placeholder*="name"]').or(page.locator('input[name="name"]')).first();
|
||||
if (await projectNameInput.count() > 0) {
|
||||
await projectNameInput.fill(`E2E Test Project ${Date.now()}`);
|
||||
}
|
||||
await page.locator("button", { hasText: "Next" }).click();
|
||||
|
||||
// Step 3: Staffing demand
|
||||
await expect(
|
||||
page.locator("text=Staffing").or(page.locator("text=Demand").or(page.locator("text=Roles")))
|
||||
).toBeVisible({ timeout: 5000 });
|
||||
await page.locator("button", { hasText: "Next" }).click();
|
||||
|
||||
// Step 4: Suggestions / Assignment
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator("button", { hasText: "Next" }).click();
|
||||
|
||||
// Step 5: Review
|
||||
await page.waitForTimeout(500);
|
||||
const reviewOrFinish = page.locator("text=Review").or(page.locator("button", { hasText: /Create|Finish|Submit/ }));
|
||||
await expect(reviewOrFinish).toBeVisible({ timeout: 5000 });
|
||||
// Don't actually submit — just close
|
||||
const cancelBtn = page.locator("button", { hasText: /Cancel|Close/ }).first();
|
||||
if (await cancelBtn.count() > 0) {
|
||||
await cancelBtn.click();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Resources", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto("/auth/signin");
|
||||
await page.fill('input[type="email"]', "manager@planarchy.dev");
|
||||
await page.fill('input[type="password"]', "manager123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL(/\/resources/);
|
||||
});
|
||||
|
||||
test("shows resources list", async ({ page }) => {
|
||||
await expect(page.locator("h1")).toContainText("Resources");
|
||||
await expect(page.locator("table")).toBeVisible();
|
||||
});
|
||||
|
||||
test("can search resources", async ({ page }) => {
|
||||
const searchInput = page.locator('input[type="search"]');
|
||||
await searchInput.fill("EMP-001");
|
||||
await page.waitForTimeout(500);
|
||||
// Should show filtered results
|
||||
await expect(page.locator("tbody tr")).toHaveCount(1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Timeline", () => {
|
||||
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(/\/resources/);
|
||||
await page.goto("/timeline");
|
||||
});
|
||||
|
||||
test("loads and displays the timeline", async ({ page }) => {
|
||||
await expect(page.locator("text=Resource view")).toBeVisible();
|
||||
await expect(page.locator("text=Project view")).toBeVisible();
|
||||
// Timeline canvas should be visible
|
||||
await expect(page.locator(".overflow-auto")).toBeVisible();
|
||||
});
|
||||
|
||||
test("can switch between resource and project view", async ({ page }) => {
|
||||
await page.click("text=Project view");
|
||||
await expect(page.locator("text=0 projects").or(page.locator("text=/\\d+ projects/"))).toBeVisible();
|
||||
await page.click("text=Resource view");
|
||||
await expect(page.locator("text=/\\d+ resources/")).toBeVisible();
|
||||
});
|
||||
|
||||
test("can navigate forward and back", async ({ page }) => {
|
||||
const todayBtn = page.locator("button", { hasText: "Today" });
|
||||
await expect(todayBtn).toBeVisible();
|
||||
await page.locator("button", { hasText: "›" }).click();
|
||||
await page.locator("button", { hasText: "‹" }).click();
|
||||
await todayBtn.click();
|
||||
});
|
||||
|
||||
test("filter panel opens and closes", async ({ page }) => {
|
||||
await page.locator("button", { hasText: "Filter" }).click();
|
||||
await expect(page.locator("text=Chapters")).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
test("shows placeholder bars for unassigned allocations", async ({ page }) => {
|
||||
// Filter to show placeholders (enabled by default)
|
||||
// The timeline should have at least one dashed placeholder bar from seed data
|
||||
await page.waitForSelector(".overflow-auto", { state: "visible" });
|
||||
// Check that the timeline loaded (resource rows or empty state visible)
|
||||
await expect(
|
||||
page.locator("text=resources").or(page.locator("text=No allocations"))
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("clicking a placeholder opens the fill placeholder modal", async ({ page }) => {
|
||||
// Wait for timeline to load
|
||||
await page.waitForSelector(".overflow-auto");
|
||||
await page.waitForTimeout(1000); // let tRPC queries settle
|
||||
|
||||
// Try to find and click a placeholder bar (dashed border style)
|
||||
const placeholderBar = page.locator("[style*='dashed']").first();
|
||||
if (await placeholderBar.count() > 0) {
|
||||
await placeholderBar.click();
|
||||
await expect(page.locator("text=Fill Placeholder").or(page.locator("text=Assign Resource"))).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user