diff --git a/package.json b/package.json index f78fb69..7fc7743 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,11 @@ "scripts": { "validate": "node scripts/validate.mjs", "build": "node scripts/build-plugin.mjs", - "test": "npm run validate && npm run test:album", + "test": "npm run validate && npm run test:album && npm run test:promptlib", "test:album": "node album/tools/harness.mjs", - "test:album:e2e": "node album/tools/viewer-e2e.mjs" + "test:album:e2e": "node album/tools/viewer-e2e.mjs", + "test:promptlib": "node promptlib/tools/harness.mjs && node promptlib/tools/vars-editor-test.mjs", + "test:promptlib:visual": "node promptlib/tools/vars-panel-visual-check.mjs" }, "devDependencies": { "esbuild": "^0.24.2" diff --git a/promptlib/package.json b/promptlib/package.json index 439a9b8..7c67660 100644 --- a/promptlib/package.json +++ b/promptlib/package.json @@ -1,7 +1,7 @@ { "name": "@iwb-plugin/promptlib", "private": true, - "version": "1.13.0", + "version": "1.13.1", "description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供", "ibwPlugin": { "id": "promptlib", diff --git a/promptlib/src/index.js b/promptlib/src/index.js index 001f471..f992b37 100644 --- a/promptlib/src/index.js +++ b/promptlib/src/index.js @@ -1212,11 +1212,11 @@ }) title.title = v.label || v.key var sum = el('span', { class: 'iwb-plp-vsum', text: summaryOf(v) }) - var iBtn = el('button', { class: 'iwb-plp-vi' + (isOpen ? ' is-open' : ''), type: 'button', title: '说明', text: 'i' }) var refreshSum = function () { sum.textContent = summaryOf(v) } - row.appendChild(caret); row.appendChild(title); row.appendChild(sum); row.appendChild(iBtn) + row.appendChild(caret); row.appendChild(title); row.appendChild(sum) + // v1.13.1:整行点击是唯一入口。旧的 i 圆按钮只做「强制展开」,与整行重复, + // 还占掉 22px 把摘要往左挤;展开态由 caret 与 hover 反馈表达。 row.addEventListener('click', function () { open[v.key] = !isOpen; paint() }) - iBtn.addEventListener('click', function (e) { e.stopPropagation(); open[v.key] = true; paint() }) item.appendChild(row) if (isOpen) { var nameIn = el('input', { class: 'iwb-input iwb-plp-vname', placeholder: '变量名称(节点上最多显示 4 字)' }) @@ -2204,7 +2204,7 @@ global.IWBPluginHost.register({ id: 'promptlib', name: '提示词库', - version: '1.13.0', + version: '1.13.1', apiVersion: 1, capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'], data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 }, diff --git a/promptlib/styles.css b/promptlib/styles.css index 4d32d95..fa2ee0a 100644 --- a/promptlib/styles.css +++ b/promptlib/styles.css @@ -416,11 +416,9 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki .iwb-plp-eright{flex:0 0 auto;width:300px;min-width:190px;max-width:460px;display:flex;flex-direction:column;min-height:0;background:var(--iwb-plugin-surface,#fafbfc);border:1px solid var(--iwb-border,#e6e8ec);border-radius:10px;padding:8px} .iwb-plp-vars{flex:1 1 auto;min-height:0;display:flex;flex-direction:column} .iwb-plp-vrows{flex:1 1 auto;min-height:0;overflow:auto} -.iwb-plp-vitem{padding:4px 0;border-bottom:1px dashed var(--iwb-border,#eceef2)} +.iwb-plp-vitem{padding:4px 0} .iwb-plp-vrow2{display:flex;align-items:center;gap:6px} .iwb-plp-vname{flex:1 1 auto;min-width:0;height:32px} -.iwb-plp-vi{flex:0 0 auto;width:24px;height:24px;padding:0;border-radius:50%;border:1px solid var(--iwb-border,#dfe3e9);background: var(--iwb-plugin-card, #fff);color: var(--iwb-text-dim, #9aa1ac);font-size:11px;line-height:22px;text-align:center} -.iwb-plp-vi.is-open{background: var(--iwb-plp-accent-soft, #f1ecff);border-color: var(--iwb-plp-accent-border, #d8cbff);color: var(--iwb-plp-accent, #5a3fd0)} .iwb-plp-vdesc{width:100%;height:28px;margin-top: 6px;border-style:dashed;background: var(--iwb-field, #fbfcfd);font-size: 12px;color: var(--plp-c3, #6b7280)} /* v1.12.0:变量编辑器折叠两态(收起一行名称+摘要,展开四字段)与内容多行框 */ .iwb-plp-vrow2{cursor:pointer} @@ -446,13 +444,10 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki .iwb-plp-dialog .iwb-plp-esplit:hover{background: var(--iwb-plugin-hover, #e7e9ee)} .iwb-plp-dialog .iwb-plp-esplit::before{content:'';display:block;width:2px;height:30px;border-radius: 6px;background: var(--iwb-plugin-hover, #d7dbe2)} .iwb-plp-dialog .iwb-plp-eright{background:transparent;border:0;padding:2px 0 0} -.iwb-plp-dialog .iwb-plp-vitem{border:0;padding:2px 0} +.iwb-plp-dialog .iwb-plp-vitem{padding:2px 0} .iwb-plp-dialog .iwb-plp-vrow2{gap:6px} .iwb-plp-dialog .iwb-plp-vname{background: var(--iwb-field, #fbfcfd);border: 1px solid var(--iwb-plugin-border, #eceef2);border-radius:8px;height:32px;padding:0 10px;font-size: 13px;color: var(--iwb-text, #33383f)} .iwb-plp-dialog .iwb-plp-vname:focus{background: var(--iwb-plugin-card, #fff);border-color: var(--iwb-plp-accent-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)} -.iwb-plp-dialog .iwb-plp-vi{background:transparent;border:0;color: var(--iwb-text-dim, #aab0ba);width:22px;height:22px;line-height:20px} -.iwb-plp-dialog .iwb-plp-vi:hover{background: var(--iwb-plugin-inset, #eef0f4);color: var(--plp-c3, #6b7280)} -.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--iwb-plp-accent-soft, #f1ecff);color: var(--iwb-plp-accent, #5a3fd0)} .iwb-plp-dialog .iwb-plp-vdesc{background: var(--iwb-field, #fbfcfd);border: 1px dashed var(--iwb-plugin-border, #e2e6ec);border-radius: 8px;height:28px;margin-top:4px} .iwb-plp-dialog .iwb-plp-lrow span{color: var(--iwb-text2, #8a919c);font-size: 12px} .iwb-plp-dialog .iwb-plp-lrow .iwb-input{background: var(--iwb-field, #fbfcfd);border: 1px solid var(--iwb-plugin-border, #eceef2);border-radius:8px;height:32px} @@ -464,7 +459,6 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki .iwb-plp-ewrap .iwb-plp-etext:focus{background:transparent;border:0;box-shadow:none} .iwb-plp-hl{position:absolute;inset:0;padding:10px 12px;overflow:hidden;white-space:pre-wrap;word-wrap:break-word;font-size:13px;line-height:1.9;color: var(--iwb-text2, #5b6472);pointer-events:none;z-index:0} .iwb-plp-hlvar{color: var(--iwb-text, #1d2129);font-weight:600} -.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--iwb-plugin-hover, #eef0f3);color: var(--iwb-text2, #5b6472)} .iwb-plp-dialog .iwb-plp-vdesc{background:transparent;border: 1px dashed var(--iwb-plugin-border, #dfe3e9)} .iwb-plp-dvar{background:transparent;color: var(--iwb-text, #1d2129);font-weight:600;padding:0} .iwb-plp-hres{height:6px;margin: -4px 0 0;cursor:ns-resize;flex:0 0 auto;border-radius: 6px} @@ -592,3 +586,13 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki .iwb-plp-dialog .iwb-plp-dvar{color:var(--iwb-plp-accent,#5a3fd0);background:var(--iwb-plp-accent-soft,#f1ecff);border-radius:6px;padding:0 2px} /* 回滚开关:若真机发现任何点击/光标异常,把下行打开即回到 v1.8.20 纯 textarea 状态。 .iwb-plp-ewrap .iwb-plp-hl{display:none!important} */ +/* v1.13.1:变量栏去掉 i 圆按钮,按设计 token 在「行与行之间」画分割线(位置 2)。 + 依据 design-tokens.md §3.11:--iwb-set-divider 是容器内行间线,首行不画线。 + 注意该变量只在 .iwb-settings-modal 作用域定义,插件面板不在其中 ⇒ 按同一公式就地兜底, + 否则会掉到全强度 --iwb-border(比规范深一档)。暗色下 --iwb-border 自动换值。 + 用相邻兄弟选择器,首项自然不画、末项之后也没有线;标题下与展开字段前都不另画线, + 避免一屏出现三层线。整行 hover + 展开态 caret 接替原来 i 按钮的「可点击」提示。 */ +.iwb-plp-vitem + .iwb-plp-vitem{border-top:var(--iwb-bw, 1px) solid var(--iwb-set-divider, color-mix(in srgb, var(--iwb-border) 55%, transparent));padding-top:var(--iwb-space-8)} +.iwb-plp-dialog .iwb-plp-vrow2{padding:0 var(--iwb-space-4)} +.iwb-plp-dialog .iwb-plp-vrow2:hover{background:var(--iwb-plugin-hover);border-radius:var(--iwb-radius-control, var(--iwb-radius-card))} +.iwb-plp-vitem.is-open .iwb-plp-vcaret{color:var(--iwb-plp-accent, var(--iwb-text2))} diff --git a/promptlib/tools/harness.mjs b/promptlib/tools/harness.mjs index bf05100..4ea44ed 100644 --- a/promptlib/tools/harness.mjs +++ b/promptlib/tools/harness.mjs @@ -20,9 +20,9 @@ const ok = (name, cond) => { } // ---- 1) 版本 / manifest ---- -ok("manifest.version = 1.13.0", /version:\s*'1\.13\.0'/.test(src)) -ok('package.json version = 1.13.0', - JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')).version === '1.13.0') +ok("manifest.version = 1.13.1", /version:\s*'1\.13\.1'/.test(src)) +ok('package.json version = 1.13.1', + JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')).version === '1.13.1') ok('manifest 已移除「分享时附带封面图片」开关声明', !/shareWithCover:\s*\{\s*type:\s*'boolean'/.test(src)) ok('源码不再定义/读取 shareWithCover 设置', @@ -240,5 +240,36 @@ ok('v1.12.2 结果重排走 120ms 防抖(打字不再逐键全量重建)', ok('v1.12.2 清空搜索后焦点回到搜索框', /query = ''; render\(\)\s*\n\s*if \(searchEl\)/.test(src)) +// ---- 11) v1.13.1 变量栏:去 i 按钮 + 行间分割线(位置 2) ---- +ok('v1.13.1 源码不再创建 i 圆按钮(iwb-plp-vi / iBtn 全清)', + !/\biwb-plp-vi\b/.test(src) && !/iBtn/.test(src)) +ok('v1.13.1 样式表不再有 .iwb-plp-vi 规则(词边界防误伤 vitem/vin)', + !/\biwb-plp-vi\b/.test(css)) +ok('v1.13.1 变量行只挂 caret / 名称 / 摘要三项(整行点击是唯一入口)', + /row\.appendChild\(caret\); row\.appendChild\(title\); row\.appendChild\(sum\)\s*$/m.test(src)) +// 依据 design-tokens.md §3.11:容器内行间用 --iwb-set-divider,首行不画线。 +ok('v1.13.1 分割线用 --iwb-set-divider(1px 实线,暗色自动跟随)', + /\.iwb-plp-vitem \+ \.iwb-plp-vitem\{[^}]*border-top:var\(--iwb-bw, 1px\) solid var\(--iwb-set-divider/.test(css)) +ok('v1.13.1 该 token 只在设置弹窗作用域定义 ⇒ 按同公式就地兜底,不掉到全强度边框', + /var\(--iwb-set-divider, color-mix\(in srgb, var\(--iwb-border\) 55%, transparent\)\)/.test(css) && + !/var\(--iwb-set-divider, var\(--iwb-plugin-border/.test(css)) +ok('v1.13.1 用相邻兄弟选择器 ⇒ 首行不画线、末行之后也没有线', + /\.iwb-plp-vitem \+ \.iwb-plp-vitem\{/.test(css) && + !/\.iwb-plp-vitem:last-child\{[^}]*border-bottom/.test(css)) +ok('v1.13.1 旧的每行虚线边框已删除', + !/\.iwb-plp-vitem\{[^}]*border-bottom:1px dashed/.test(css)) +ok('v1.13.1 dialog 作用域不再用 border:0 盖掉行间线', + !/\.iwb-plp-dialog \.iwb-plp-vitem\{[^}]*border:0/.test(css)) +ok('v1.13.1 标题下 / 展开字段前都不另画线(一屏只留一层线)', + !/\.iwb-plp-vhead\{[^}]*border/.test(css) && + !/\.iwb-plp-vfield\{[^}]*border-top/.test(css)) +ok('v1.13.1 去掉 i 后补整行 hover 反馈(接替「可点击」提示)', + /\.iwb-plp-dialog \.iwb-plp-vrow2:hover\{[^}]*var\(--iwb-plugin-hover\)/.test(css)) +ok('v1.13.1 展开态 caret 用主色呼应状态', + /\.iwb-plp-vitem\.is-open \.iwb-plp-vcaret\{[^}]*var\(--iwb-plp-accent/.test(css)) +ok('v1.13.1 新增尺寸全走 token(无裸 px/font-size)', + /\.iwb-plp-vitem \+ \.iwb-plp-vitem\{[^}]*padding-top:var\(--iwb-space-8\)/.test(css) && + /\.iwb-plp-dialog \.iwb-plp-vrow2\{padding:0 var\(--iwb-space-4\)/.test(css)) + console.log(failed ? ('✗ ' + failed + ' 项失败') : '✓ 全部通过') if (failed) process.exitCode = 1 diff --git a/promptlib/tools/vars-panel-visual-check.mjs b/promptlib/tools/vars-panel-visual-check.mjs new file mode 100644 index 0000000..a9b1905 --- /dev/null +++ b/promptlib/tools/vars-panel-visual-check.mjs @@ -0,0 +1,162 @@ +// 变量栏视觉核对(v1.13.1):真实 Chromium 挂载 promptlib 编辑弹窗,亮/暗两套截图。 +// 依据 docs/standards/promptlib-style-baseline.md §四「发布前检查清单」: +// 静态渲染截图核对(颜色、滚动、输入框描边)+ 真机连点验证 selectionStart 不漂移。 +// 依赖宿主仓 playwright:node promptlib/tools/vars-panel-visual-check.mjs +import path from 'node:path' +import { fileURLToPath, pathToFileURL } from 'node:url' + +const HERE = path.dirname(fileURLToPath(import.meta.url)) +const HOST = path.resolve(HERE, '..', '..', '..', 'image-workbench-desktop') +const PW = pathToFileURL(path.resolve(HOST, 'node_modules', 'playwright', 'index.mjs')).href +const { chromium } = await import(PW) +const SRC = path.resolve(HERE, '..', 'src', 'index.js') +const CSS = path.resolve(HERE, '..', 'styles.css') +const TOKENS = path.resolve(HOST, 'src', 'design-tokens.css') +const HOSTCSS = path.resolve(HOST, 'style.css') + +let failed = 0 +const ok = (name, cond, actual) => { + if (!cond) failed++ + console.log((cond ? '✓ ' : '✗ ') + name + (actual === undefined ? '' : ' → ' + JSON.stringify(actual))) +} + +const browser = await chromium.launch() +const page = await browser.newPage({ viewport: { width: 1200, height: 900 }, deviceScaleFactor: 2 }) +const errors = [] +page.on('pageerror', (e) => errors.push(String(e))) + +await page.setContent('
') +await page.addStyleTag({ path: TOKENS }) +await page.addStyleTag({ path: HOSTCSS }) +await page.addStyleTag({ path: CSS }) +await page.evaluate(() => { + window.IWBPluginHost = { register: (meta, factory) => { window.__reg = { meta, factory } } } +}) +await page.addScriptTag({ path: SRC }) + +const info = await page.evaluate(() => { + const prompts = [{ id: 'a', name: '示例', text: '风格 {写实摄影}', group: '默认' }] + const groups = [{ id: '默认', name: '默认' }] + const data = { schemaVersion: 3, prompts, groups } + const ctx = { + data: { read: async () => data, write: async () => ({ ok: true }), set: async () => ({ ok: true }), get: async () => null }, + promptlib: { + list: async () => ({ prompts, groups }), save: async () => ({ ok: true }), insert: async () => ({ ok: true }), + notify: () => {}, onChanged: () => () => {}, + filePut: async () => ({ ok: true }), fileGet: async () => '', fileList: async () => [], fileRemove: async () => ({ ok: true }), fileStat: async () => ({ count: 0, bytes: 0 }), + }, + files: { put: async () => ({ ok: true }), get: async () => '', list: async () => [], remove: async () => ({ ok: true }), stat: async () => ({ count: 0, bytes: 0 }) }, + storage: { set: () => {}, get: () => null }, + ui: { registerPanel: (p) => { window.__panel = p }, toast: () => {} }, + nodes: { register: () => {} }, + canvas: { screenToWorld: (x, y) => ({ x, y }) }, + canvasWrite: { createNode: () => 'n1', createImageNode: () => 'n2' }, + } + window.__reg.factory(ctx) + window.__panel.mount(document.getElementById('host')) + return { version: window.__reg.meta.version } +}) +ok('插件版本 = 1.13.1', info.version === '1.13.1', info.version) + +// 打开「新建」弹窗,正文写四个变量,展开第 2 行 +await page.evaluate(() => { + const btn = Array.from(document.querySelectorAll('#host button')).find((b) => b.textContent.trim() === '新建') + btn.click() +}) +await page.waitForTimeout(350) +await page.evaluate(() => { + const ta = document.querySelector('.iwb-plp-etext') + ta.value = '风格 {写实摄影},字体 {手写书法},人物 {女生},卖点 {价格与利益点},画面简洁' + ta.dispatchEvent(new Event('input', { bubbles: true })) +}) +await page.waitForTimeout(450) +await page.evaluate(() => { + const rows = document.querySelectorAll('.iwb-plp-vrow2') + if (rows[1]) rows[1].click() +}) +await page.waitForTimeout(250) + +const geo = await page.evaluate(() => { + const items = Array.from(document.querySelectorAll('.iwb-plp-vitem')) + const rows = Array.from(document.querySelectorAll('.iwb-plp-vrow2')) + const head = document.querySelector('.iwb-plp-vhead') + const caret = document.querySelector('.iwb-plp-vitem.is-open .iwb-plp-vcaret') + const border = (el) => { + const s = getComputedStyle(el) + return { top: s.borderTopWidth, bottom: s.borderBottomWidth, color: s.borderTopColor, padTop: s.paddingTop } + } + return { + iBtn: document.querySelectorAll('.iwb-plp-vi').length, + items: items.length, + rows: rows.length, + borders: items.map(border), + headBorder: head ? getComputedStyle(head).borderBottomWidth : '', + vfieldBorder: getComputedStyle(document.querySelector('.iwb-plp-vfield') || document.body).borderTopWidth, + caretOpen: caret ? getComputedStyle(caret).color : '', + caretClosed: rows[0] ? getComputedStyle(rows[0].querySelector('.iwb-plp-vcaret')).color : '', + rowPad: rows[0] ? getComputedStyle(rows[0]).padding : '', + hlvar: document.querySelectorAll('.iwb-plp-hlvar').length, + inputs: document.querySelectorAll('.iwb-plp-vname, .iwb-plp-vdef, .iwb-plp-vdesc').length, + } +}) +console.log('几何 / 计算样式 =', JSON.stringify(geo)) + +ok('不再渲染 i 圆按钮', geo.iBtn === 0, geo.iBtn) +ok('4 个变量都渲染出来', geo.items === 4 && geo.rows === 4, geo.items) +ok('首行不画线(顶部/底部都 0)', + geo.borders[0] && geo.borders[0].top === '0px' && geo.borders[0].bottom === '0px', geo.borders[0]) +ok('第 2/3/4 行顶部各 1px 实线(位置 2)', + geo.borders.slice(1).every((b) => b && b.top === '1px'), geo.borders.slice(1).map((b) => b.top)) +ok('末行之后没有多余的线', geo.borders[3] && geo.borders[3].bottom === '0px', geo.borders[3]) +// color-mix 在 Chromium 里会解析成 color(srgb … / a),老版本则是 rgba(…, a) +const alphaOf = (s) => { + const str = String(s) + const m = str.match(/rgba\([^)]*,\s*([\d.]+)\)/) || str.match(/color\([^)]*\/\s*([\d.]+)\)/) + return m ? Number(m[1]) : 1 +} +ok('线色是规范 55% 淡线(半透明,没掉到全强度 --iwb-border)', + /^(rgba\(|color\(srgb)/.test(geo.borders[1].color) && Math.abs(alphaOf(geo.borders[1].color) - 0.55) < 0.02, geo.borders[1].color) +ok('标题下不画线(组标题靠间距分层)', geo.headBorder === '0px', geo.headBorder) +ok('展开字段前不另画线', geo.vfieldBorder === '0px', geo.vfieldBorder) +ok('展开态 caret 用主色、与收起态可区分', + geo.caretOpen !== geo.caretClosed && /^rgb\(/.test(geo.caretOpen), { open: geo.caretOpen, closed: geo.caretClosed }) +ok('展开态三个输入框仍在,且输入框描边未丢', geo.inputs === 3, geo.inputs) +ok('正文变量浅主色色块仍在(v1.9.3 两层着色没被破坏)', geo.hlvar >= 1, geo.hlvar) + +// hover:整行反馈接替被删掉的 i 按钮 +await page.locator('.iwb-plp-vrow2').nth(2).hover() +await page.waitForTimeout(80) +const hoverBg = await page.evaluate(() => getComputedStyle(document.querySelectorAll('.iwb-plp-vrow2')[2]).backgroundColor) +ok('整行 hover 有浅底反馈', hoverBg !== 'rgba(0, 0, 0, 0)' && hoverBg !== 'transparent', hoverBg) + +// 基线硬要求:连点正文 textarea 三次,selectionStart 不能逐次左移 +const ta = page.locator('.iwb-plp-etext') +const box = await ta.boundingBox() +const clicks = [] +for (let i = 0; i < 3; i++) { + await page.mouse.click(box.x + 120, box.y + 18) + clicks.push(await page.evaluate(() => document.querySelector('.iwb-plp-etext').selectionStart)) +} +ok('正文连点 3 次 selectionStart 不漂移(两层着色未复发)', + clicks[0] === clicks[1] && clicks[1] === clicks[2], clicks) + +await page.mouse.move(0, 0) +await page.screenshot({ path: '/tmp/plp-vars-1131-light.png', fullPage: true }) + +// 暗色:同一套 token 自动跟随 +await page.evaluate(() => document.documentElement.classList.add('theme-dark')) +await page.waitForTimeout(150) +const dark = await page.evaluate(() => ({ + border: getComputedStyle(document.querySelectorAll('.iwb-plp-vitem')[1]).borderTopColor, + width: getComputedStyle(document.querySelectorAll('.iwb-plp-vitem')[1]).borderTopWidth, + first: getComputedStyle(document.querySelectorAll('.iwb-plp-vitem')[0]).borderTopWidth, +})) +ok('暗色下线宽不变、颜色自动跟随 token', + dark.width === '1px' && dark.first === '0px' && dark.border !== geo.borders[1].color, dark) +await page.screenshot({ path: '/tmp/plp-vars-1131-dark.png', fullPage: true }) + +ok('页面无 JS 报错', errors.length === 0, errors) +console.log('截图:/tmp/plp-vars-1131-light.png、/tmp/plp-vars-1131-dark.png') +console.log(failed ? ('✗ ' + failed + ' 项失败') : '✓ 全部通过') +if (failed) process.exitCode = 1 +await browser.close()