test: package HEL-806 evidence and verify genuine empty state

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-10-23 13:36:32 +08:00
co-authored by multica-agent
parent 6d6552e011
commit cb410fbdea
3 changed files with 41 additions and 14 deletions
+4 -1
View File
@@ -37,6 +37,9 @@ const metrics=(p,sels)=>p.evaluate(sels=>Object.fromEntries(Object.entries(sels)
if(process.env.HEL806_SEED_TASKS==='1'){
const seeded=[];for(const mode of ['ok','fail']){fs.writeFileSync('e2e/fake_mode.json',JSON.stringify({mode,delay_sec:0,unique_filename:true,image_file:path.resolve('calliope-web/static/refract/coast.jpg')}));const created=await api('/api/playground/generate',{workflow_id:f.dual,source:'studio-image',input_values:{'1':'HEL806 isolated '+mode,'2':'模糊','3':42}});let job;for(let i=0;i<200;i++){job=await api('/api/jobs/'+created.job.id);if(!['running','pending'].includes(job.status))break;await wait(150)}assert.equal(job.status,mode==='ok'?'done':'failed');seeded.push(job)}fs.writeFileSync(OUT+'/seed-jobs.json',JSON.stringify(seeded,null,2));
}
if(process.env.HEL806_REAL_EMPTY==='1'){
assert.equal((await api('/api/jobs')).length,0,'empty-state run must start without jobs');const owned=await api('/api/projects');for(const project of owned){const r=await fetch(API+'/api/projects/'+project.id,{method:'DELETE'});assert(r.ok,'delete only disposable fixture project')};const after={projects:await api('/api/projects'),jobs:await api('/api/jobs')};assert.equal(after.projects.length,0);assert.equal(after.jobs.length,0);fs.writeFileSync(OUT+'/real-empty.json',JSON.stringify({removedFixtureIds:owned.map(p=>p.id),after},null,2));
}
const sample=http.createServer((req,res)=>{res.setHeader('Content-Type','text/html;charset=utf-8');res.end(fs.readFileSync('../materials/夜片场-多主题交互样本.html'))});await new Promise(r=>sample.listen(0,'127.0.0.1',r));
const browser=await chromium.launch({args:['--no-sandbox','--disable-dev-shm-usage']});
try{
@@ -55,7 +58,7 @@ const metrics=(p,sels)=>p.evaluate(sels=>Object.fromEntries(Object.entries(sels)
{name:'video-output',ref:'create',run:()=>generate(videoWf.id,'video'),creative:true},
{name:'image-failed',ref:'create',run:async()=>{await creative(f.dual);await p.locator('#desk-prompt').fill('HEL806 fake failure');fs.writeFileSync('e2e/fake_mode.json',JSON.stringify({mode:'fail',delay_sec:0}));await p.locator('.gen').click();await p.locator('.stage-empty').filter({hasText:'失败'}).waitFor({timeout:45000})},creative:true},
{name:'studio-real',ref:'studio',run:()=>goto('/'),basis:'approved-cover-exception'},
{name:'studio-empty',ref:'studio',run:()=>emptyRoute('/','**/api/projects',[]),missing:'原件没有无项目空态'},
{name:'studio-empty',ref:'studio',run:async()=>{if(process.env.HEL806_REAL_EMPTY==='1')await goto('/');else{await p.route('**/api/jobs',r=>r.fulfill({json:[]}));await emptyRoute('/','**/api/projects',[])}},missing:'原件没有无项目空态'},
{name:'image-text-empty',ref:'create',run:async()=>{await p.route('**/api/playground/jobs',r=>r.fulfill({json:[]}));await creative(f.dual)},creative:true},
{name:'image-long-prompt',ref:'create',run:async()=>{await creative(f.dual);await p.locator('#desk-prompt').fill('海边女孩、晨光、纸船与灯塔,保持人物和空间连续。'.repeat(70));const btn=p.getByRole('button',{name:'展开提示词',exact:true});if(await btn.count())await btn.click()},creative:true},
{name:'image-edit-upload',ref:'create',run:async()=>{await creative(edit.id);await upload()},creative:true},