- mcn-dou-analysis: 功能三产出设定后自动生成设定卡(Step7); 设定md与卡片SVG双向联动维护规则固化(06文档+03文档+SKILL.md); 浅色系配色定稿玫瑰金(#D6A3A9→#9A5563)+背景文字提亮规则; 新增06生成账号设定卡片文档+模板样例 - mcn-work-shop: 首页数据预览条/周榜预览表加宽/改名AI脚本诊断/tab切换/添加账号弹窗等优化 - 新增 cdp-*.mjs 验证脚本14个(可复用); .gitignore 忽略运行日志/截图/tmp
42 lines
2.9 KiB
JavaScript
42 lines
2.9 KiB
JavaScript
// 验证:「AI写作复盘」→「AI脚本诊断」全量改名 + 首页周榜列表底色
|
|
const list = await fetch('http://localhost:9223/json').then((r) => r.json());
|
|
let page = list.find((t) => t.type === 'page' && t.url.includes('localhost:8899'));
|
|
if (!page) { console.log('ERR: no workbuddy page open'); process.exit(1); }
|
|
const ws = new WebSocket(page.webSocketDebuggerUrl);
|
|
let id = 0; const pending = new Map();
|
|
const send = (method, params = {}) => new Promise((res, rej) => { const i = ++id; pending.set(i, { res, rej }); ws.send(JSON.stringify({ id: i, method, params })); });
|
|
ws.onmessage = (e) => { const m = JSON.parse(e.data); if (m.id && pending.has(m.id)) { const p = pending.get(m.id); pending.delete(m.id); m.error ? p.rej(new Error(m.error.message)) : p.res(m.result); } };
|
|
await new Promise((r) => (ws.onopen = r));
|
|
const ev = async (expr) => { const r = await send('Runtime.evaluate', { expression: expr, returnByValue: true, awaitPromise: true }); if (r.exceptionDetails) return { __err: (r.exceptionDetails.exception?.description || r.exceptionDetails.text).slice(0, 200) }; return r.result.value; };
|
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
await send('Page.enable'); await send('Runtime.enable');
|
|
const goto = async (hash) => { await send('Page.navigate', { url: 'http://localhost:8899/' + hash }); await sleep(1500); await send('Page.reload', { ignoreCache: true }); await sleep(3000); };
|
|
|
|
// 1) 首页:数据预览 label + 快捷卡片 + 周榜列表底色 + 残留检查
|
|
await goto('#/');
|
|
const home = await ev(`(() => {
|
|
const stats = [...document.querySelectorAll('#homeStats .home-stat-item')].map((i) => i.querySelector('.home-stat-label').textContent);
|
|
const cards = [...document.querySelectorAll('.data-card')].map((c) => c.querySelector('.data-card-title').textContent);
|
|
const rk = document.getElementById('rankPreviewList');
|
|
const rkBg = rk ? getComputedStyle(rk).backgroundColor : null;
|
|
const bodyTxt = document.body.textContent;
|
|
return { stats, cards, rkBg, residualOld: bodyTxt.includes('AI写作复盘'), residualNew: bodyTxt.includes('AI脚本诊断') };
|
|
})()`);
|
|
console.log('【首页】');
|
|
console.log(' 数据预览 label:', home.stats.join(' / '));
|
|
console.log(' 快捷卡片:', home.cards.join(' / '));
|
|
console.log(' 周榜列表底色:', home.rkBg);
|
|
console.log(' 残留旧名:', home.residualOld, '| 出现新名:', home.residualNew);
|
|
|
|
// 2) 功能页 #/reviews:页面标题
|
|
await goto('#/reviews');
|
|
const rv = await ev(`(() => {
|
|
const t = document.querySelector('.page-title');
|
|
return { title: t ? t.textContent : null, hasOld: document.body.textContent.includes('AI写作复盘') };
|
|
})()`);
|
|
console.log('【功能页 #/reviews】页面标题:', rv.title, '| 残留旧名:', rv.hasOld);
|
|
|
|
ws.close();
|
|
const ok = !home.residualOld && home.residualNew && home.rkBg && home.rkBg !== 'rgba(0, 0, 0, 0)' && rv.title === 'AI脚本诊断' && !rv.hasOld;
|
|
console.log(ok ? 'PASS' : 'CHECK');
|