重构基线
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const { chromium } = require("playwright");
|
||||
const { BASE_URL, UI_TIMEOUT_MS, assert, ensureAuthenticated } = require("./tree-shell-smoke-helpers");
|
||||
|
||||
@@ -12,9 +14,11 @@ if (MNOTE_WEB_ENABLE_DEBUG_SHELL_ROUTES !== "1") {
|
||||
}
|
||||
|
||||
const PAGE_URL = `${BASE_URL}/ui-debug/components`;
|
||||
const OUT_DIR = process.env.MNOTE_UI_COMPONENTS_OUTPUT_DIR || path.resolve(__dirname, "..", "tmp", "ui-components");
|
||||
|
||||
async function main() {
|
||||
console.log("[task500] 启动 UI Debug 组件矩阵 smoke …");
|
||||
fs.mkdirSync(OUT_DIR, { recursive: true });
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
@@ -131,12 +135,17 @@ async function main() {
|
||||
assert(cssVar.length > 0, `--ui-debug-primary 应有值,实际: "${cssVar}"`);
|
||||
console.log("[task500] ✓ CSS 变量 --ui-debug-primary: %s", cssVar);
|
||||
|
||||
const screenshotPath = path.join(OUT_DIR, "ui-debug-components.png");
|
||||
await page.screenshot({ path: screenshotPath, fullPage: true });
|
||||
console.log("[task500] ✓ 截图输出: %s", screenshotPath);
|
||||
|
||||
console.log("[task500] ✅ 全部断言通过");
|
||||
} catch (error) {
|
||||
console.error("[task500] ✗ 失败:", error.message);
|
||||
try {
|
||||
await page.screenshot({ path: "tmp/task500-failure.png", fullPage: true });
|
||||
console.log("[task500] 失败截图: tmp/task500-failure.png");
|
||||
const failurePath = path.join(OUT_DIR, "task500-failure.png");
|
||||
await page.screenshot({ path: failurePath, fullPage: true });
|
||||
console.log("[task500] 失败截图: %s", failurePath);
|
||||
} catch (_) {}
|
||||
process.exitCode = 1;
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user