- 后端 ProjectViewSet 加 export-clips action:逐段从 TOS 拉取已采用视频片段、内存 zip 打包返回下载 (单段失败跳过不毁整包;空项目 400);文件名走 RFC5987 UTF-8 编码兼容中文 - 前端视频阶段 queue-bar 在「上传视频」旁加「导出全部」按钮(下载图标 + 导出中/失败态), api.exportProjectClips 取 blob → 触发浏览器下载;仅有已完成片段时可点 - 单测 ExportClipsTests:打包全部片段 + 空项目 400 验收:后端单测绿(基线 4 失败零新增);tsc+build 绿;真打包 补水面膜 项目得 950KB zip;无头 0 报错 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
1.6 KiB
JavaScript
21 lines
1.6 KiB
JavaScript
import { chromium } from "playwright";
|
|
import fs from "node:fs"; import path from "node:path";
|
|
const BASE="http://localhost:5200", PROJ="bdbf39d3-1a89-4135-b1b7-26d3331a7021";
|
|
const OUT=path.resolve("../../../_qa_shots/export"); 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(BASE+"/login"); await p.waitForTimeout(400);
|
|
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(BASE+"/pipeline/"+PROJ); await p.waitForTimeout(2500);
|
|
await p.locator('a[data-stage="4"]').first().click().catch(()=>{}); await p.waitForTimeout(2500);
|
|
const qb=await p.locator(".queue-bar").innerText().catch(()=>"");
|
|
r.queueBar=qb.replace(/\n/g," | ");
|
|
r.hasExportBtn=await p.locator(".queue-bar button",{hasText:"导出全部"}).count();
|
|
r.exportEnabled=r.hasExportBtn? !(await p.locator(".queue-bar button",{hasText:"导出全部"}).first().isDisabled()):false;
|
|
await p.locator('[data-stage-pane="4"] .queue-bar').screenshot({path:path.join(OUT,"queue-bar.png")}).catch(()=>p.screenshot({path:path.join(OUT,"stage4.png"),fullPage:true}));
|
|
await p.screenshot({path:path.join(OUT,"stage4-full.png"),fullPage:true});
|
|
await b.close(); console.log(JSON.stringify(r,null,2));
|