← snapshot
2346 bytes
import { chromium } from "@playwright/test";
const API = "http://localhost:8787";
const BASE = "http://localhost:3000";
const decs = await (await fetch(`${API}/api/repos/meridian-systems/decisions`)).json();
const dec = decs.decisions[0].id;
const url = `${BASE}/repos/meridian-systems/decisions/${dec}`;
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1280, height: 1100 }, colorScheme: "dark" });
const errs = [];
p.on("console", m => { if (m.type()==="error") errs.push(m.text()); });
p.on("pageerror", e => errs.push("pageerror: "+e.message));
await p.goto(url, { waitUntil: "networkidle" });
await p.waitForTimeout(1200);
const bodyText = await p.evaluate(() => document.body.innerText);
console.log("shows suggestion:", bodyText.includes("thundering herd"));
console.log("shows the quote :", bodyText.includes("transient network errors"));
console.log("offers to draft :", bodyText.includes("Draft this as a decision"));
await p.evaluate(() => {
const el = document.querySelector(".jac-rationale");
const r = document.createRange();
r.selectNodeContents(el);
const s = window.getSelection();
s.removeAllRanges(); s.addRange(r);
document.dispatchEvent(new Event("selectionchange"));
});
await p.waitForTimeout(600);
console.log("selection pin :", (await p.locator(".jac-remark-pin").count()) > 0);
await p.screenshot({ path: "tour/lab/remarks.png", fullPage: true });
await p.locator("button", { hasText: "Draft this as a decision" }).first().click();
await p.waitForTimeout(500);
const title = await p.locator("#draft-title").inputValue();
console.log("prefilled title :", JSON.stringify(title));
console.log("rationale quotes:", (await p.locator("#draft-rationale").inputValue()).includes("Raised against"));
await p.locator("#draft-scope").fill("src/net");
await p.locator("button", { hasText: "Propose it" }).click();
await p.waitForTimeout(2500);
const after = await (await fetch(`${API}/api/repos/meridian-systems/remarks`)).json();
const settled = after.remarks.find(r => r.body.includes("thundering herd"));
console.log("remark state :", settled?.state, "->", settled?.outcome?.decision?.slice(0,12));
console.log("errors:", errs.length ? [...new Set(errs)].slice(0,3) : "none");
await p.screenshot({ path: "tour/lab/remarks-drafted.png", fullPage: true });
await b.close();