jacquardSnapshot

← snapshot

1772 bytes
import { chromium } from "@playwright/test";
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1400, height: 1000 }, colorScheme: "dark" });
const errs = [];
p.on("pageerror", e => errs.push(e.message));
p.on("console", m => { if (m.type()==="error") errs.push(m.text()); });

// Count anything that would make sound, and any orb that appears uninvited.
await p.addInitScript(() => { window.__spoke = 0;
  const o = window.speechSynthesis?.speak?.bind(window.speechSynthesis);
  if (o) window.speechSynthesis.speak = (u) => { window.__spoke++; return o(u); };
});

await p.goto("http://localhost:3000/", { waitUntil: "networkidle" });
await p.waitForTimeout(2500);
const landing = await p.evaluate(() => ({
  heading: document.querySelector(".jac-h1")?.textContent,
  items: document.querySelectorAll(".jac-await-row").length,
  asks: [...document.querySelectorAll(".jac-await-asks")].map(x => x.textContent),
  jackieOnLanding: document.querySelectorAll(".jac-orb").length,
  spoke: window.__spoke,
}));
console.log(JSON.stringify(landing, null, 2));
await p.screenshot({ path: "tour/lab/inbox.png", fullPage: true });

// Jackie should materialize only when asked for.
await p.locator("button", { hasText: "Walk it with Jackie" }).first().click();
await p.waitForTimeout(4000);
const during = await p.evaluate(() => ({
  orbs: document.querySelectorAll(".jac-orb").length,
  canGoBack: Boolean([...document.querySelectorAll("button")].find(b => /back to what/.test(b.textContent))),
  spoke: window.__spoke,
}));
console.log("during interview:", JSON.stringify(during));
await p.screenshot({ path: "tour/lab/interview.png", fullPage: true });
console.log("errors:", errs.length ? [...new Set(errs)].slice(0,3) : "none");
await b.close();