← snapshot
2337 bytes
import { chromium } from "@playwright/test";
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1500, height: 980 }, colorScheme: "dark" });
const errs = [];
p.on("pageerror", e => errs.push(e.message));
p.on("console", m => { if (m.type()==="error") errs.push(m.text()); });
await p.goto("http://localhost:3000/", { waitUntil: "networkidle" });
await p.waitForTimeout(2000);
// Jackie starts on a repo picker; step onto the floor of the seeded repo.
const pick = p.locator("button, a").filter({ hasText: /meridian/i }).first();
if (await pick.count()) { await pick.click(); await p.waitForTimeout(4000); }
else await p.waitForTimeout(3500);
// Find any control that opens a diff.
const opener = p.locator("button", { hasText: /Read what changed|Read the diff|See what changed/ }).first();
const n = await opener.count();
console.log("diff opener present:", n > 0);
if (!n) {
console.log(await p.evaluate(() => document.body.innerText.slice(0, 500)));
await p.screenshot({ path: "tour/lab/diff-none.png", fullPage: true });
await b.close(); process.exit(1);
}
await opener.click();
await p.waitForSelector(".jac-diffm", { timeout: 15000 });
await p.waitForTimeout(2500);
const info = await p.evaluate(() => ({
rows: document.querySelectorAll(".jac-diffm-row").length,
adds: document.querySelectorAll('.jac-diffm-row[data-kind="add"]').length,
dels: document.querySelectorAll('.jac-diffm-row[data-kind="del"]').length,
words: document.querySelectorAll(".jac-diffm-word").length,
files: document.querySelectorAll(".jac-diffm-file").length,
gaps: document.querySelectorAll(".jac-diffm-gap").length,
govern: document.querySelector(".jac-diffm-govern")?.textContent?.trim().slice(0, 60),
path: document.querySelector(".jac-diffm-path")?.textContent,
}));
console.log(JSON.stringify(info, null, 2));
await p.screenshot({ path: "tour/lab/diff-unified.png" });
// Split view.
await p.locator('.jac-diffm .jac-seg button', { hasText: "split" }).click();
await p.waitForTimeout(700);
await p.screenshot({ path: "tour/lab/diff-split.png" });
// Esc closes.
await p.keyboard.press("Escape");
await p.waitForTimeout(400);
console.log("esc closes:", (await p.locator(".jac-diffm").count()) === 0);
console.log("errors:", errs.length ? [...new Set(errs)].slice(0,3) : "none");
await b.close();