docs(alpha): simplify native setup and verify generic starter creation
This commit is contained in:
@@ -246,7 +246,9 @@ export async function launchChrome({ width = 1440, height = 900, chromePath } =
|
||||
return api.evaluate(`(() => {
|
||||
const el = document.querySelector(${JSON.stringify(selector)});
|
||||
if (!el) return null;
|
||||
el.scrollIntoView({ block: "center", inline: "center" });
|
||||
// CSS smooth scrolling is asynchronous; measuring immediately after
|
||||
// it can click outside the viewport instead of the target control.
|
||||
el.scrollIntoView({ block: "center", inline: "center", behavior: "instant" });
|
||||
const r = el.getBoundingClientRect();
|
||||
return { x: r.x + r.width / 2, y: r.y + r.height / 2 };
|
||||
})()`);
|
||||
@@ -267,7 +269,7 @@ export async function launchChrome({ width = 1440, height = 900, chromePath } =
|
||||
const all = [...document.querySelectorAll(${JSON.stringify(selector)})];
|
||||
const el = all.find((node) => (node.textContent ?? "").includes(wanted));
|
||||
if (!el) return false;
|
||||
el.scrollIntoView({ block: "center" });
|
||||
el.scrollIntoView({ block: "center", behavior: "instant" });
|
||||
el.setAttribute("data-test-click", "1");
|
||||
return true;
|
||||
})()`);
|
||||
|
||||
@@ -1453,6 +1453,19 @@ async function runScratchCreate() {
|
||||
await ensureConnected();
|
||||
await openTemplates();
|
||||
await page.waitForSelector(".cards button.card", { timeout: 25000 });
|
||||
const starterKeys = await page.evaluate(`Array.from(document.querySelectorAll('[data-template-key]'), node => node.dataset.templateKey)`);
|
||||
for (const key of ["task", "research", "summarize", "compare", "plan", "three-stage", "review", "debug"]) {
|
||||
if (!starterKeys.includes(key)) throw new Error(`Missing alpha starter ${key}`);
|
||||
}
|
||||
await shot("54-alpha-starter-gallery-desktop.png");
|
||||
await page.resize(390, 844);
|
||||
await settle();
|
||||
if (await page.evaluate("document.documentElement.scrollWidth > innerWidth")) throw new Error("Starter gallery overflows at 390px");
|
||||
const clipped = await page.evaluate(`Array.from(document.querySelectorAll('[data-template-key]')).filter(card => card.querySelector('.card-meta')?.getBoundingClientRect().bottom > card.getBoundingClientRect().bottom).map(card => card.dataset.templateKey)`);
|
||||
if (clipped.length) throw new Error(`Starter metadata outside cards: ${clipped.join(", ")}`);
|
||||
await shot("55-alpha-starter-gallery-mobile.png");
|
||||
await page.resize(1440, 900);
|
||||
await settle();
|
||||
await page.click(".cards button.card");
|
||||
await page.waitForSelector("#detailTitle", { timeout: 25000 });
|
||||
await page.waitForSelector(".template-create-open", { timeout: 15000 });
|
||||
|
||||
Reference in New Issue
Block a user