feat(style): 全站无彩灰阶收尾——清理 legacy 别名与硬编码色漂移 (HEL-685 S6)

- app.css 删除 8 个无引用 legacy 别名,新增 --id-1..5 身份灰阶实色阶
- 画布去紫罗兰二级 palette(tokens.css 删除,改用全站 token)
- 画布/镜头台/智能体/omni/视频组件硬编码色全部归位 token
- agentPalette 彩色身份色改为显影灰阶 --id 阶;修复 3 处相纸白底白字不可读
- WorkflowLibrary 试运行抽屉焦点还原(异步禁用触发键丢焦)修复
- e2e: fpages/import 色值断言对齐现行 token;新增 hel685 走查脚本
  (1440/1024/390 截图 + 控制台错误 + 减动效 + 键盘焦点 + 对比度探针);
  pagination 空库自举;fpages 增加逐页控制台错误检查

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
施工员
2026-10-11 17:26:12 +08:00
co-authored by multica-agent
parent 2f267a751f
commit bc24370233
32 changed files with 405 additions and 156 deletions
+10 -3
View File
@@ -96,7 +96,7 @@ const editedColor = await page
.first()
.evaluate((el) => getComputedStyle(el).color)
.catch(() => '');
ok('已编辑标签用琥珀 rgb(240,180,92)', editedColor === 'rgb(240, 180, 92)', editedColor);
ok('已编辑标签用琥珀例外 rgb(163,145,95)', editedColor === 'rgb(163, 145, 95)', editedColor);
// 复制提示词(镜头段 prompt 复制按钮存在性在 UI 层检查 ShotStagePanel)
await page.goto(`${BASE}/workbench/${pid}`, { waitUntil: 'networkidle' });
@@ -115,7 +115,12 @@ const railLibrary = await page.locator('.rail a[href="/library"], .nav a[href="/
ok('图标轨/更多含素材库入口', railLibrary >= 1, `count=${railLibrary}`);
await shot(page, 'library-1440');
// ---------- per-page 3-width walk + overflow ----------
// ---------- per-page 3-width walk + overflow + console errors ----------
let consoleErrors = [];
page.on('console', (m) => {
if (m.type() === 'error') consoleErrors.push(m.text().slice(0, 160));
});
page.on('pageerror', (e) => consoleErrors.push(String(e).slice(0, 160)));
const PAGES = [
['home', '/'],
['workbench', `/workbench/${pid}`],
@@ -131,8 +136,10 @@ const PAGES = [
for (const [name, route] of PAGES) {
for (const [wname, w] of WIDTHS) {
await page.setViewportSize({ width: w, height: 900 });
consoleErrors = [];
await page.goto(`${BASE}${route}`, { waitUntil: 'networkidle' }).catch(() => {});
await page.waitForTimeout(700);
ok(`${name} ${wname} 无控制台错误`, consoleErrors.length === 0, consoleErrors[0] ?? '');
if (wname !== '1440') await shot(page, `${name}-${wname}`);
if (w === 390) {
const overflow = await page.evaluate(
@@ -155,7 +162,7 @@ await page.waitForTimeout(600);
const runGradBar = await page.locator('.a-progress').count();
ok('任务页进度条组件(a-progress)', runGradBar >= 0);
const testTagNeutral = await page.locator('.tag-test').first().evaluate((el) => getComputedStyle(el).color).catch(() => '');
ok('测试标签为中性灰', testTagNeutral === '' || testTagNeutral === 'rgb(170, 178, 197)', testTagNeutral);
ok('测试标签为中性灰阶', testTagNeutral === '' || testTagNeutral === 'rgb(168, 166, 156)', testTagNeutral);
// ---------- agent chat bubbles ----------
await page.goto(`${BASE}/agents`, { waitUntil: 'networkidle' });
+210
View File
@@ -0,0 +1,210 @@
/* HEL-685 S6 全站走查:1440/1024/390 截图 + 减动效 / 键盘焦点 / 对比度探针。
* Runs against the isolated stack (vite 5173 → backend 8247 → fake ComfyUI
* 18188). Screenshots land in e2e/shots/hel685-*.png. */
import { chromium } from 'playwright';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const ROOT = path.dirname(fileURLToPath(import.meta.url));
const SHOTS = path.join(ROOT, 'shots');
fs.mkdirSync(SHOTS, { recursive: true });
const BASE = 'http://127.0.0.1:5173';
const API = 'http://127.0.0.1:8247';
let failures = 0;
function ok(name, cond, extra = '') {
const line = `${cond ? 'PASS' : 'FAIL'} ${name}${extra ? ' — ' + extra : ''}`;
console.log(line);
if (!cond) failures++;
}
const api = async (p, init) => {
const r = await fetch(API + p, { headers: { 'Content-Type': 'application/json' }, ...init });
const body = await r.text();
try {
return JSON.parse(body);
} catch {
return { raw: body, status: r.status };
}
};
// ---------- fixtures: project + confirmed script + canvas ----------
const proj = await api('/api/projects', {
method: 'POST',
body: JSON.stringify({ title: 'S6走查·灯塔', idea: '灯塔看守人的短篇' }),
});
const pid = proj.id;
await api(`/api/workbench/projects/${pid}/stages/script/import`, {
method: 'POST',
body: JSON.stringify({
text: '灯塔看守人老周在暴风雨夜发现一封三十年前的信。\n\n他修好旧船,横过海峡,把回信送到对岸。',
}),
});
const canvas = await api('/api/canvas', { method: 'POST', body: JSON.stringify({ project_id: pid }) });
const cid = canvas.canvas?.id ?? canvas.id;
ok('走查项目与画布就绪', !!pid && !!cid, `pid=${pid} cid=${cid}`);
const browser = await chromium.launch();
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
const page = await ctx.newPage();
const consoleErrors = [];
page.on('console', (m) => {
if (m.type() === 'error') consoleErrors.push(m.text().slice(0, 160));
});
page.on('pageerror', (e) => consoleErrors.push(String(e).slice(0, 160)));
const shot = (name) => page.screenshot({ path: `${SHOTS}/hel685-${name}.png` });
// ---------- 1440 desktop set (compare against HEL-679 / theme-1) ----------
const DESK = [
['home-1440', '/'],
['workbench-1440', `/workbench/${pid}`],
['image-desk-1440', '/image'],
['video-desk-1440', '/video'],
['agents-1440', '/agents'],
['models-1440', '/models'],
['connections-1440', '/connections'],
['tasks-1440', '/tasks'],
['library-1440', '/library'],
['canvas-1440', `/canvas/${cid}`],
['build-scene-1440', '/build-scene'],
];
for (const [name, route] of DESK) {
consoleErrors.length = 0;
await page.goto(`${BASE}${route}`, { waitUntil: 'networkidle' }).catch(() => {});
await page.waitForTimeout(700);
ok(`${name} 无控制台错误`, consoleErrors.length === 0, consoleErrors[0] ?? '');
await shot(name);
}
// ---------- 1024 / 390 usability set ----------
const NARROW = [
['home', '/'],
['workbench', `/workbench/${pid}`],
['image-desk', '/image'],
['video-desk', '/video'],
['agents', '/agents'],
['tasks', '/tasks'],
['canvas', `/canvas/${cid}`],
];
for (const [name, route] of NARROW) {
for (const w of [1024, 390]) {
await page.setViewportSize({ width: w, height: 900 });
await page.goto(`${BASE}${route}`, { waitUntil: 'networkidle' }).catch(() => {});
await page.waitForTimeout(600);
await shot(`${name}-${w}`);
if (w === 390) {
const overflow = await page.evaluate(
() => document.documentElement.scrollWidth - document.documentElement.clientWidth,
);
ok(`${name} 390 无横向溢出`, overflow <= 1, `overflow=${overflow}px`);
}
}
}
await page.setViewportSize({ width: 1440, height: 900 });
// ---------- reduce-motion probes (顶栏开关 data-reduce=1) ----------
await page.goto(`${BASE}/`, { waitUntil: 'networkidle' }).catch(() => {});
await page.waitForTimeout(400);
await page.evaluate(() => (document.documentElement.dataset.reduce = '1'));
const dur = await page.locator('.a-btn').first().evaluate((el) => getComputedStyle(el).transitionDuration);
ok('减动效:过渡时长塌缩到 ≤120ms', parseFloat(dur) <= 0.12, dur);
const spinRule = await page.evaluate(() => {
const ring = document.createElement('div');
ring.className = 'a-tile-ring';
ring.innerHTML = '<i></i>';
document.body.appendChild(ring);
const name = getComputedStyle(ring.firstChild).animationName;
ring.remove();
return name;
});
ok('减动效:上传旋转动画禁用(animation-name=none)', spinRule === 'none', spinRule);
await page.evaluate(() => delete document.documentElement.dataset.reduce);
// ---------- keyboard focus probe ----------
await page.goto(`${BASE}/tasks`, { waitUntil: 'networkidle' }).catch(() => {});
await page.waitForTimeout(400);
await page.keyboard.press('Tab');
const focusRing = await page.evaluate(() => {
const el = document.activeElement;
if (!el) return null;
const cs = getComputedStyle(el);
return cs.outlineStyle !== 'none' && parseFloat(cs.outlineWidth) >= 1.5 ? cs.outlineColor : null;
});
ok('键盘焦点显示相纸白焦点圈', focusRing === 'rgb(245, 244, 238)', String(focusRing));
// ---------- text contrast probes (WCAG AA on real elements) ----------
await page.goto(`${BASE}/`, { waitUntil: 'networkidle' }).catch(() => {});
await page.waitForTimeout(600);
const lum = (rgbStr) => {
const m = rgbStr.match(/\d+/g).map(Number);
const [r, g, b] = m.map((v) => {
const c = v / 255;
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
});
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
};
const ratio = (a, b) => {
const l1 = lum(a);
const l2 = lum(b);
const [hi, lo] = l1 > l2 ? [l1, l2] : [l2, l1];
return (hi + 0.05) / (lo + 0.05);
};
const probeText = async (sel, label, min = 4.5) => {
const el = page.locator(sel).first();
if (!(await el.count())) return ok(`${label} 探针元素存在`, false, sel);
const { color, bg } = await el.evaluate((e) => {
const bgOf = (node) => {
let n = node;
while (n && n !== document.documentElement) {
const bg = getComputedStyle(n).backgroundColor;
if (bg && bg !== 'rgba(0, 0, 0, 0)' && bg !== 'transparent') return bg;
n = n.parentElement;
}
return 'rgb(33, 33, 32)';
};
return { color: getComputedStyle(e).color, bg: bgOf(e) };
});
const r = ratio(color, bg);
ok(`${label} 对比度 ${r.toFixed(2)}:1 ≥ ${min}`, r >= min, `${color} on ${bg}`);
};
await probeText('body', '首页正文文字');
await page.goto(`${BASE}/settings`, { waitUntil: 'networkidle' }).catch(() => {});
await page.waitForTimeout(600);
await probeText('.a-panel-lead', '面板次要文字(--text-2 级)');
await page.goto(`${BASE}/`, { waitUntil: 'networkidle' }).catch(() => {});
await page.waitForTimeout(400);
// .a-btn.primary 用渐变背景(backgroundColor 透明),对 --accent 实色计算
const btnContrast = await page.evaluate(() => {
const cs = getComputedStyle(document.documentElement);
const hex = (h) => {
const s = h.replace('#', '');
const n = parseInt(s.length === 3 ? s.split('').map((c) => c + c).join('') : s, 16);
return `rgb(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255})`;
};
return { ink: hex(cs.getPropertyValue('--accent-ink').trim()), accent: hex(cs.getPropertyValue('--accent').trim()) };
});
const btnRatio = ratio(btnContrast.ink, btnContrast.accent);
ok(`主按钮文字对比度 ${btnRatio.toFixed(2)}:1 ≥ 4.5`, btnRatio >= 4.5, `${btnContrast.ink} on ${btnContrast.accent}`);
// agent identity steps all ≥ text-3 floor (computed from :root tokens)
const idSteps = await page.evaluate(() =>
['--id-1', '--id-2', '--id-3', '--id-4', '--id-5', '--text-3'].map((v) =>
getComputedStyle(document.documentElement).getPropertyValue(v).trim(),
),
);
const bg2 = await page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--bg-2').trim());
const toRgb = (hex) => {
const h = hex.replace('#', '');
const n = parseInt(h.length === 3 ? h.split('').map((c) => c + c).join('') : h, 16);
return `rgb(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255})`;
};
for (let i = 0; i < idSteps.length; i++) {
const r = ratio(toRgb(idSteps[i]), toRgb(bg2));
const label = i < 5 ? `身份灰阶 --id-${i + 1}` : '--text-3 下限';
ok(`${label} 在面板底上 ≥4.5:1(${r.toFixed(2)}:1)`, r >= 4.5);
}
await browser.close();
console.log(failures === 0 ? 'ALL HEL-685 WALKTHROUGH CHECKS PASSED' : `${failures} CHECKS FAILED`);
process.exit(failures === 0 ? 0 : 1);
+7 -7
View File
@@ -213,8 +213,8 @@ const run = async () => {
})),
);
ok(
"① 解析 JSON 绿 ✓",
states[0].ok && states[0].color === "rgb(73, 203, 144)",
"① 解析 JSON 亮灰 ✓",
states[0].ok && states[0].color === "rgb(221, 221, 215)",
states[0].color,
);
ok(
@@ -227,8 +227,8 @@ const run = async () => {
.textContent(),
);
ok(
"③ 核对模型全绿(假 object_info 装齐)",
states[2].ok && states[2].color === "rgb(73, 203, 144)",
"③ 核对模型全亮灰(假 object_info 装齐)",
states[2].ok && states[2].color === "rgb(221, 221, 215)",
states[2].color,
);
ok("④ 建立输入槽(1 参数 0 媒体)", states[3].ok);
@@ -311,7 +311,7 @@ const run = async () => {
.evaluate((el) => getComputedStyle(el).color);
ok(
"无法核查 = 琥珀(非绿非红)",
warnColor === "rgb(240, 180, 92)",
warnColor === "rgb(163, 145, 95)",
warnColor,
);
ok(
@@ -392,7 +392,7 @@ const run = async () => {
const chipColor = await page
.locator(".drawer-panel .wft-active .chip.run")
.evaluate((el) => getComputedStyle(el).color);
ok("进行中状态为信号青", chipColor === "rgb(84, 223, 210)", chipColor);
ok("进行中状态为运行灰", chipColor === "rgb(184, 182, 172)", chipColor);
ok(
"进行中显示进度条",
(await page.locator(".drawer-panel .wft-active .track").count()) === 1,
@@ -450,7 +450,7 @@ const run = async () => {
.evaluate((el) => getComputedStyle(el).color);
ok(
"失败判定为红 + 中文标题",
badColor === "rgb(240, 100, 90)",
badColor === "rgb(208, 122, 107)",
await page
.locator(".drawer-panel .wft-result.bad .wft-verdict")
.textContent(),
+22
View File
@@ -16,6 +16,28 @@ const run = async () => {
const base = 'http://127.0.0.1:5173';
let realJobs = [];
// HEL-685 harness fix: fan-out needs ≥1 real take to clone; on a fresh DB
// the list is empty — kick one quick fake-ComfyUI image job, wait for it,
// and only then start intercepting.
{
const probe = await fetch('http://127.0.0.1:8247/api/playground/jobs').then((r) => r.json());
if (!Array.isArray(probe) || probe.length === 0) {
await fetch('http://127.0.0.1:8247/api/playground/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
workflow_id: 1,
input_values: { 1: { text: 'pagination 基准' }, 2: 42 },
source: 'studio-image',
}),
});
for (let i = 0; i < 60; i++) {
await page.waitForTimeout(500);
const jobs = await fetch('http://127.0.0.1:8247/api/playground/jobs').then((r) => r.json());
if (Array.isArray(jobs) && jobs.some((j) => j.status === 'done')) break;
}
}
}
await page.route('**/api/playground/jobs**', async (route) => {
const r = await route.fetch();
realJobs = await r.json();