chore(scripts): 族谱截图工具支持两节点子树(E2E_CAPTURE_MIN_NODES)
Project CI / AI game creator shell Rust crates (pull_request) Successful in 5m52s
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled

This commit is contained in:
2026-10-07 00:34:40 +08:00
parent 626dc6d185
commit 4fdcdc4935
+9 -6
View File
@@ -509,6 +509,9 @@ async function captureExistingUrls() {
const lineageUrl = (process.env.E2E_CAPTURE_LINEAGE_URL ?? '').trim();
const themeUrl = (process.env.E2E_CAPTURE_THEME_URL ?? '').trim();
const selectTitle = (process.env.E2E_CAPTURE_SELECT_TITLE ?? '').trim();
// 最小节点数:两节点的子树(例如「母版 → 一个衍生」)也要能截,默认 3。
const minNodes =
Number.parseInt((process.env.E2E_CAPTURE_MIN_NODES ?? '').trim(), 10) || 3;
// 视口可配:全树总览常常比 960 高,给个高的窗口才能真的「一眼看全」。
const sizeMatch = /^(\d{3,4})x(\d{3,4})$/u.exec(
(process.env.E2E_CAPTURE_WINDOW ?? '').trim(),
@@ -555,8 +558,8 @@ async function captureExistingUrls() {
const page = await desktop.newPage();
await page.goto(lineageUrl, { waitUntil: 'commit', timeout: 120_000 });
await page.waitForFunction(
() => document.querySelectorAll('.game-lineage-node').length >= 3,
undefined,
(min) => document.querySelectorAll('.game-lineage-node').length >= min,
minNodes,
{ timeout: 120_000 },
);
await page.waitForTimeout(1400);
@@ -564,7 +567,7 @@ async function captureExistingUrls() {
const nodeCount = await page.locator('.game-lineage-node').count();
check(
'截图模式:/games/lineage 已渲染多代节点',
nodeCount >= 3,
nodeCount >= minNodes,
`nodes=${nodeCount} url=${lineageUrl}`,
);
// 首屏视野契约(与 lineage 工具同口径):要么真的全览,要么按可读缩放下限 + 提示。
@@ -645,8 +648,8 @@ async function captureExistingUrls() {
timeout: 120_000,
});
await mobilePage.waitForFunction(
() => document.querySelectorAll('.game-lineage-node').length >= 3,
undefined,
(min) => document.querySelectorAll('.game-lineage-node').length >= min,
minNodes,
{ timeout: 120_000 },
);
await mobilePage.waitForTimeout(1400);
@@ -668,7 +671,7 @@ async function captureExistingUrls() {
}));
check(
'截图模式:窄屏下族谱画布可见、节点已渲染且页面不横向溢出',
narrow.canvas && narrow.nodes >= 3 && !narrow.overflow,
narrow.canvas && narrow.nodes >= minNodes && !narrow.overflow,
`canvas=${narrow.canvas} nodes=${narrow.nodes} overflow=${narrow.overflow}`,
);
await take(mobilePage, '03-lineage-narrow.png');