WFDASH-WEBAPP/.tmp-inspect-agent-scan.mjs
Dave 59f245d798 feat(collection-confirm): add stock item edits
- Add new POST API endpoints at `/api/v1/stock-purchase-items/[id]/sku` and `/api/v1/stock-purchase-items/[id]/cost` for updating stock purchase item details
- Update ItemsTable to support cost and SKU edits for all row types, add supplier SKU column and editing for stock rows
- Extend PoCard to pass edit callbacks and add stock-specific invoice upload functionality
- Update all related test suites to cover new editing and UI features
- Adjust invoice upload messaging to differentiate between customer and stock purchase orders
2026-08-14 16:39:46 +02:00

53 lines
No EOL
1.9 KiB
JavaScript

import { chromium } from "playwright";
const URL_BASE = "http://localhost:4001";
const browser = await chromium.launch({
executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
headless: true,
args: ["--no-sandbox"],
});
const context = await browser.newContext({
viewport: { width: 1440, height: 900 },
});
const page = await context.newPage();
page.on("console", (msg) => {
if (msg.type() === "error" || msg.text().includes("agent") || msg.text().includes("scan")) {
console.log("[browser]", msg.type(), msg.text());
}
});
page.on("pageerror", (err) => console.log("[pageerror]", err.message));
page.on("response", (res) => {
if (res.url().includes("/api/mcp") || res.url().includes("/api/v1/collection-confirm")) {
console.log("[api]", res.status(), res.url());
}
});
await page.goto(`${URL_BASE}/login`, { waitUntil: "domcontentloaded", timeout: 30000 });
await page.fill("#login-email", "test-tooltip@wfdash.local");
await page.fill("#login-password", "test12345678");
await page.click('button:has-text("Sign In")');
await page.waitForTimeout(2000);
await page.goto(`${URL_BASE}/collection-confirm`, { waitUntil: "domcontentloaded", timeout: 30000 });
await page.waitForTimeout(8000);
console.log("→ clicking Run agent scan…");
await page.locator('[data-testid="collection-confirm-run-agent-scan"]').click();
await page.waitForTimeout(3000);
const panel = page.locator('[data-testid="collection-confirm-agent-scan-result"]');
const panelCount = await panel.count();
console.log("→ result panel count:", panelCount);
if (panelCount > 0) {
console.log("→ panel text:", (await panel.textContent())?.slice(0, 400));
} else {
// Take screenshot to see what's happening
await page.screenshot({ path: "/tmp/cc-no-panel.png", fullPage: false });
console.log("→ no panel rendered, screenshot saved");
}
await browser.close();
console.log("→ done");