Files
canvas-frontend/qa/audit_agent.mjs
T
shad b438e9a664 feat(hubs): Procurement / People / IT hubs over real EA2 catalogue
Single Hub component parameterised by hub key. Each hub:
- Lists quick actions that look up a matching published process and
  start it as a real transaction
- Pulls the full published catalogue from /api/ea2/flow/processes and
  filters via a hub-specific regex (procurement|hr|it)
- Falls back to top-N when no matches, with a Studio CTA when empty

Landing surface gets a hero-hub row of chips: Procurement Hub, People
Hub, IT Hub, Talk to Pi, Team Chat. Same EA2-write doctrine as wizard.
2026-06-14 12:47:24 +04:00

42 lines
1.9 KiB
JavaScript

import { chromium } from "playwright";
const URL = "https://canvas.flow-master.ai/";
const args = ["--host-resolver-rules=MAP canvas.flow-master.ai 65.21.71.186", "--ignore-certificate-errors"];
const b = await chromium.launch({ headless: true, args });
const p = await (await b.newContext({ viewport: { width: 1440, height: 900 } })).newPage();
await p.goto(URL, { waitUntil: "networkidle" });
await p.waitForTimeout(800);
await p.locator(".persona-chip", { hasText: /Mariana/ }).click();
await p.locator(".dev-login-btn").click();
await p.waitForTimeout(2500);
const enter = p.locator("button", { hasText: /Enter Mission Control/i }).first();
if (await enter.count()) { await enter.click(); await p.waitForTimeout(1200); }
const tabs = await p.locator(".tab").allTextContents();
console.log("[debug] visible tabs:", tabs);
await p.locator(".tab", { hasText: /Pi/ }).first().click({ timeout: 5000 }).catch(e => console.log("Pi click err:", e.message));
await p.waitForTimeout(1200);
const welcome = await p.locator(".agent-turn-agent .agent-turn-body").first().textContent();
console.log("[agent] welcome:", welcome?.slice(0, 120));
const tools = await p.locator(".agent-tool-name").allTextContents();
console.log("[agent] visible tools:", tools);
async function ask(text) {
await p.locator(".agent-composer textarea").fill(text);
await p.locator(".agent-composer button", { hasText: /Send/i }).click();
await p.waitForTimeout(2200);
const all = await p.locator(".agent-turn-agent .agent-turn-body").allTextContents();
return all[all.length - 1] || "";
}
console.log("\n[ask] list processes →", (await ask("list processes")).slice(0, 200));
console.log("[ask] open mission →", (await ask("open mission")).slice(0, 120));
console.log("[ask] tell Aisha that the laptop quote is approved →",
(await ask("tell Aisha that the laptop quote is approved")).slice(0, 200));
await b.close();