fix: automate GLB compression and real viewport smoke

This commit is contained in:
2026-07-10 13:19:47 +08:00
parent 78ec1fbdcc
commit cab4d320c0
6 changed files with 43 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ const failedRequests = [];
const checks = [];
async function inspect(viewport, name) {
const page = await browser.newPage({ viewportSize: viewport });
const page = await browser.newPage({ viewport });
page.on("console", (message) => {
if (message.type() === "error") consoleErrors.push(message.text());
});
@@ -39,6 +39,13 @@ async function inspect(viewport, name) {
page.on("requestfailed", (request) => failedRequests.push(`${request.url()} ${request.failure()?.errorText || "failed"}`));
await page.goto(url, { waitUntil: "networkidle", timeout: 60000 });
await page.waitForSelector("#loading", { state: "hidden", timeout: 60000 });
const actualViewport = await page.evaluate(() => ({ width: window.innerWidth, height: window.innerHeight }));
const viewportMatches = actualViewport.width === viewport.width && actualViewport.height === viewport.height;
checks.push({
name: `${name}:viewport`,
status: viewportMatches ? "PASS" : "FAIL",
detail: `${actualViewport.width}x${actualViewport.height} expected ${viewport.width}x${viewport.height}`,
});
const selectors = ["#floor-controls", "#category-controls", "#explode", "#section", "#snapshot"];
for (const selector of selectors) {
const visible = await page.locator(selector).isVisible();