Files
yingqing/core/qa/visual-parity/_extract-gate.mjs
T
seaislee1209 fda0385d2f feat(pipeline): 基础资产页提取闸门简化为单按钮 + 卡式 loading + 顶栏重新提取
- 进资产页遮罩上从「3 个按钮(只提取/提取+生成/全套)」简化为单个醒目 CTA「提取角色 / 场景」
  (走 only 模式:只提取不出图,生成仍由用户后续手动点);提取时用脚本同款卡式 loading
  (spinner + 标题 + 跳点 + 扫光进度条;sgv-* 样式解作用域以复用)
- 内容区右上角(团队头像正下方)加「重新提取」按钮 —— 仅基础资产页且已提取过时露出,点击重提

验收:tsc+build 绿;无头核对(空项目显单按钮闸门「提取角色/场景」、已提取项目显「重新提取」、0 console error)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 14:12:39 +08:00

24 lines
1.8 KiB
JavaScript

import { chromium } from "playwright";
import path from "node:path"; import fs from "node:fs";
const OUT=path.resolve("../../../_qa_shots/gate"); fs.mkdirSync(OUT,{recursive:true});
const b=await chromium.launch({headless:true}); const r={consoleErrors:[]};
const p=await (await b.newContext({viewport:{width:1440,height:900}})).newPage();
p.on("console",m=>{if(m.type()==="error")r.consoleErrors.push(m.text())}); p.on("pageerror",e=>r.consoleErrors.push("PE:"+e.message));
await p.goto("http://localhost:5200/login"); await p.waitForTimeout(300);
await p.fill("#auth-username","airshelf"); await p.fill("#auth-pwd","Restraint2026");
await p.click("button.btn-cta"); await p.waitForFunction(()=>!location.pathname.startsWith("/login"),{timeout:12000});
// ① 未提取项目 → 闸门单按钮
await p.goto("http://localhost:5200/pipeline/f0eef1aa-5182-438e-b44c-f549326f7fd8"); await p.waitForTimeout(2200);
await p.locator('a[data-stage="2"]').first().click().catch(()=>{}); await p.waitForTimeout(2000);
r.gateVisible=await p.locator(".extract-gate").count();
r.gateBtns=await p.locator(".extract-gate-btns button, .eg-extract-btn").count();
r.gateBtnText=await p.locator(".eg-extract-btn").innerText().catch(()=>"");
await p.screenshot({path:path.join(OUT,"gate-single.png")});
// ② 已提取项目 → 重新提取按钮
await p.goto("http://localhost:5200/pipeline/bdbf39d3-1a89-4135-b1b7-26d3331a7021"); await p.waitForTimeout(2200);
await p.locator('a[data-stage="2"]').first().click().catch(()=>{}); await p.waitForTimeout(2000);
r.reextractBtn=await p.locator(".pipeline-reextract").count();
r.reextractText=await p.locator(".pipeline-reextract").innerText().catch(()=>"");
await p.screenshot({path:path.join(OUT,"reextract.png")});
await b.close(); console.log(JSON.stringify(r,null,2));