chore(web): record timeline evidence and push blocker
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
43
tools/web/complete/probe-timeline.mjs
Normal file
43
tools/web/complete/probe-timeline.mjs
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: Timeline play/pause and frame stepping in the ?ui=web entry.
|
||||
*
|
||||
* node tools/web/complete/probe-timeline.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(60_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
frame: document.querySelector('input[aria-label="当前帧"]')?.value ?? null,
|
||||
max: document.querySelector('input[aria-label="当前帧"]')?.max ?? null,
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3),
|
||||
playDisabled: document.querySelector('button[aria-label="播放"]')?.hasAttribute('disabled') ?? null,
|
||||
}));
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
log("start", JSON.stringify(await state()));
|
||||
await page.getByRole("button", { name: "下一帧", exact: true }).click();
|
||||
await page.waitForTimeout(800);
|
||||
log("step", JSON.stringify(await state()));
|
||||
await page.locator('button[aria-label="播放"]').first().click();
|
||||
await page.waitForTimeout(2500);
|
||||
const during = await state();
|
||||
await page.locator('button[aria-label="播放"]').first().click();
|
||||
await page.waitForTimeout(800);
|
||||
log("play", JSON.stringify(during));
|
||||
log("paused", JSON.stringify(await state()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
Reference in New Issue
Block a user