import { test, expect } from "@playwright/test" test("Complete admin navigation", async ({ page }) => { // Login await page.goto("http://localhost:5173/login") await page.fill("input[type='text']", "admin") await page.fill("input[type='password']", "password") await page.click("button[type='submit']") await page.waitForURL(/admin\/dashboard/, { timeout: 5000 }) console.log("✅ Logged in") // Test all sidebar links const links = [ { text: "Dashboard", path: /admin\/dashboard/ }, { text: "Orders", path: /admin\/orders/ }, { text: "Products", path: /admin\/products/ }, { text: "Customers", path: /admin\/customers/ }, { text: "Inventory", path: /admin\/inventory/ }, { text: "Warehouses", path: /admin\/warehouses/ } ] for (const link of links) { await page.click(`text=${link.text}`) await page.waitForURL(link.path, { timeout: 5000 }) const heading = await page.locator("h2.page-title, h1").first() expect(heading).toBeTruthy() console.log(`✅ ${link.text} page loaded`) } })