From 15ff2a3cacfb4d21c70a249189776c963ff3c56c Mon Sep 17 00:00:00 2001 From: leefer Date: Thu, 22 Oct 2026 09:41:42 +0800 Subject: [PATCH] HEL-774: keep project feedback clear of fixed save and confirm actions Co-authored-by: multica-agent --- .../src/lib/components/ToastHost.svelte | 2 +- .../src/lib/components/workbench/project.css | 2 +- calliope-web/static/themes.css | 7 +++ .../2026-10-22-hel774-secondary-buttons.md | 2 + e2e/hel774-stability.cjs | 45 +++++++++++++++++++ e2e/run-hel774.py | 2 +- 6 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 e2e/hel774-stability.cjs diff --git a/calliope-web/src/lib/components/ToastHost.svelte b/calliope-web/src/lib/components/ToastHost.svelte index 3b78c0c8..bb9cd6b2 100644 --- a/calliope-web/src/lib/components/ToastHost.svelte +++ b/calliope-web/src/lib/components/ToastHost.svelte @@ -61,7 +61,7 @@ .toast-host { position: fixed; right: 24px; - bottom: 24px; + bottom: var(--toast-bottom, 24px); /* Above every overlay, incl. the 10000 lightbox, so feedback stays visible. */ z-index: 10001; display: flex; diff --git a/calliope-web/src/lib/components/workbench/project.css b/calliope-web/src/lib/components/workbench/project.css index 89e34e09..3c039fbb 100644 --- a/calliope-web/src/lib/components/workbench/project.css +++ b/calliope-web/src/lib/components/workbench/project.css @@ -594,7 +594,7 @@ } .project-footer { flex: none; - min-height: 56px; + min-height: var(--project-footer-height); border-top: 1px solid var(--line); display: flex; align-items: center; diff --git a/calliope-web/static/themes.css b/calliope-web/static/themes.css index cdc72d1c..383ddbb3 100644 --- a/calliope-web/static/themes.css +++ b/calliope-web/static/themes.css @@ -45,6 +45,7 @@ --fs-small: 12px; --fs-micro: 11px; --studio-hero-bg: #0b0c11; + --project-footer-height: 56px; --project-side-width: 340px; --project-media-tag-bg: rgba(7, 8, 12, 0.62); --project-media-tag-color: #ddd; @@ -631,6 +632,7 @@ --composer-bg: var(--desk-dock-bg); --composer-focus: var(--bg-2); --float-bg: var(--bg-2); + --toast-bottom: 24px; --on-media: #fff; --on-media-line: #ffffff66; --sel-shadow: 0 0 0 1px var(--gold); @@ -785,3 +787,8 @@ html.theme-anim *::after { animation: none; } } + +/* Keep transient feedback clear of the project’s fixed primary actions. */ +:root:has(.project-workspace) { + --toast-bottom: calc(var(--project-footer-height) + 24px); +} diff --git a/docs/changelogs/2026-10-22-hel774-secondary-buttons.md b/docs/changelogs/2026-10-22-hel774-secondary-buttons.md index 7223b267..64e7e253 100644 --- a/docs/changelogs/2026-10-22-hel774-secondary-buttons.md +++ b/docs/changelogs/2026-10-22-hel774-secondary-buttons.md @@ -10,3 +10,5 @@ HEL-774 在 HEL-731 / PR #10 上按确认 HTML 样本定点返工,目标仍为 pytest 口径:本次只收集 `tests/test_workbench.py`(10项)与 `tests/test_playground_workbench_flowback.py`(8项),合计18项。原 HEL-731 的18项是工作台生命周期+来源回流的合计;HEL-773 单文件10项仅含前者。后端没有变更,不重复运行已通过的整套昂贵行为测试。lint、Svelte check(0错误0警告)、build、前端脚本和本次针对性浏览器验证日志交任务附件;构建的既有依赖导入/包大小提示保持如实记录。 未部署、未合并、无数据迁移或线上数据操作,无新增依赖。清理由 runner 的 finally 停止其启动的精确子进程组并移除隔离库;保留原始证据与校验清单供复审。 + +补充总管在施工中新增的稳定态要求:等待全部有限动画结束、字体和图片就绪后,比较弹层与搜索弹层背景实测为不透明,Escape关闭均恢复触发器焦点,无需改弹层。另复现保存成功提示确实挡住固定保存/确认按钮(1440档toast底876、footer顶844,两按钮中心命中toast)。修复仅在统一`themes.css`中定义项目底栏56px与提示间距token,ToastHost消费原24px默认值;有项目工作区时提示距底为56+24px,其他页面仍24px。底栏复用同一高度token,没有叠加新组件样式。四主题三尺寸补测提示与底栏不重叠、保存/确认命中、实际点击、提示消失后的长滚动底栏;最终24组页面重新拍摄,稳定弹层/提示证据另列stability/。变更后重新lint/check/build,不以旧截图冒充新状态。 diff --git a/e2e/hel774-stability.cjs b/e2e/hel774-stability.cjs new file mode 100644 index 00000000..c31efe59 --- /dev/null +++ b/e2e/hel774-stability.cjs @@ -0,0 +1,45 @@ +// Supplemental requirements added to HEL-774: stable dialogs, focus return and unobstructed actions. +const {chromium}=require(process.env.PLAYWRIGHT_MODULE_PATH||'playwright'); +const fs=require('node:fs'),assert=require('node:assert/strict'),http=require('node:http'); +const WEB='http://127.0.0.1:5173',API='http://127.0.0.1:8247',out='../evidence/stability';fs.mkdirSync(out,{recursive:true}); +const records=[],checks=[];const ok=(name,v)=>{assert(v,name);checks.push(name);console.log('PASS',name)}; +const api=async(path,body,method)=>{const r=await fetch(API+path,{method:method||(body?'POST':'GET'),headers:{'Content-Type':'application/json'},body:body?JSON.stringify(body):undefined,signal:AbortSignal.timeout(15000)});assert(r.ok);return r.json()}; +async function settled(p){await p.evaluate(async()=>{await document.fonts.ready;await Promise.all(document.getAnimations().filter(a=>a.effect?.getTiming().iterations!==Infinity).map(a=>a.finished.catch(()=>{})));await Promise.all([...document.images].filter(i=>!i.complete).map(i=>new Promise(r=>{i.onload=r;i.onerror=r})))})} +(async()=>{ + const b=await chromium.launch({executablePath:process.env.CHROMIUM_EXECUTABLE_PATH,args:['--no-sandbox','--disable-dev-shm-usage']});const c=await b.newContext();await c.tracing.start({screenshots:true,snapshots:true});const p=await c.newPage();p.setDefaultTimeout(15000); + const sample=http.createServer((req,res)=>{res.setHeader('Content-Type','text/html;charset=utf-8');res.end(fs.readFileSync('../attachments/夜片场-多主题交互样本.html'))});await new Promise(r=>sample.listen(0,'127.0.0.1',r));const sp=await c.newPage(); + try{ + const proj=(await api('/api/projects')).find(x=>x.title==='隔离验证 · 海岸来信');const path='/api/workbench/projects/'+proj.id+'/stages/storyboard'; + await api(path+'/confirm',{});const stage=(await api('/api/workbench/projects/'+proj.id)).stages.find(s=>s.stage_key==='storyboard');await api(path,{content:{...stage.content,shots:stage.content.shots.map((s,i)=>i?s:{...s,description:'稳定态对比用实际草稿'})}},'PATCH'); + const sizes=process.env.HEL774_BEFORE==='1'?[[1440,900]]:[[1440,900],[1366,768],[1280,720]],themes=process.env.HEL774_BEFORE==='1'?['night']:['night','day','grade','bluehour']; + for(const [width,height] of sizes)for(const theme of themes){ + const name=theme+'-'+width;await p.setViewportSize({width,height});await sp.setViewportSize({width,height});await p.goto(WEB);await p.evaluate(t=>localStorage.setItem('aigc-theme',t),theme);await p.goto(WEB+'/workbench/'+proj.id+'?stage=storyboard');await p.locator('.storyboard-card').first().waitFor();await settled(p); + // Modal: stable background and finished animation; close by Escape and check exact invoker. + const compare=p.getByRole('button',{name:'对比已确认版',exact:true});await compare.click();await p.getByRole('dialog').waitFor();await settled(p); + let style=await p.locator('.modal-panel').evaluate(e=>{const s=getComputedStyle(e);return {background:s.backgroundColor,opacity:s.opacity,transform:s.transform,float:getComputedStyle(document.documentElement).getPropertyValue('--float-bg')}});records.push({name,kind:'compare',style});await p.screenshot({path:`${out}/${name}-compare-stable.png`});ok(name+' compare opaque after animation',style.opacity==='1'&&!['rgba(0, 0, 0, 0)','transparent'].includes(style.background));await p.keyboard.press('Escape');await p.getByRole('dialog').waitFor({state:'detached'});ok(name+' compare returns focus',await compare.evaluate(e=>document.activeElement===e)); + // Produce a real save toast, then hit-test both primary actions while it is visible. + await p.getByRole('button',{name:'编辑',exact:true}).click();await p.locator('.shot-edit textarea').first().fill('稳定保存 '+name);await p.locator('[data-testid=stage-save-btn]').click();await p.locator('.toast.success').waitFor();await settled(p); + const hit=await p.locator('.project-footer').evaluate(e=>{const footer=e.getBoundingClientRect();return {footerTop:footer.top,toast:[...document.querySelectorAll('.toast')].map(t=>{const r=t.getBoundingClientRect();return {top:r.top,bottom:r.bottom,left:r.left,right:r.right}}),buttons:[...e.querySelectorAll('button')].map(b=>{const r=b.getBoundingClientRect(),x=r.left+r.width/2,y=r.top+r.height/2;const top=document.elementFromPoint(x,y);return {text:b.textContent.trim(),disabled:b.disabled,centerHit:top===b||b.contains(top),topElement:top?.className}})}});records.push({name,kind:'toast',hit});await p.screenshot({path:`${out}/${name}-toast-visible.png`}); + if(process.env.HEL774_BEFORE!=='1'){ + ok(name+' toast above fixed footer',hit.toast.every(t=>t.bottom<=hit.footerTop));ok(name+' save/confirm centers hit actual buttons',hit.buttons.every(b=>b.centerHit)); + // Actual mouse save with toast present proves the overlay does not intercept it. + await p.locator('[data-testid=stage-save-btn]').click();ok(name+' save clickable with toast',true); + } + await p.waitForTimeout(300);while(await p.locator('.toast .dismiss').count())await p.locator('.toast .dismiss').first().click();await p.locator('.toast').waitFor({state:'detached'});await settled(p); + await p.locator('.project-content').evaluate(e=>e.scrollTop=e.scrollHeight);await p.screenshot({path:`${out}/${name}-long-scroll-clear-footer.png`});ok(name+' footer visible after toast clears',await p.locator('[data-testid=stage-confirm-btn]').isVisible()); + await p.goto(WEB);const search=p.locator('.studio-search');await search.click();await p.getByRole('dialog').waitFor();await settled(p);style=await p.locator('.modal-panel').evaluate(e=>{const s=getComputedStyle(e);return {background:s.backgroundColor,opacity:s.opacity,transform:s.transform}});records.push({name,kind:'search',style});await p.screenshot({path:`${out}/${name}-search-stable.png`});ok(name+' search opaque after animation',style.opacity==='1'&&!['rgba(0, 0, 0, 0)','transparent'].includes(style.background));await p.keyboard.press('Escape');await p.getByRole('dialog').waitFor({state:'detached'});ok(name+' search returns focus',await search.evaluate(e=>document.activeElement===e)); + // Re-shoot the complete unmodified sample/app pairs on this exact final product revision. + if(process.env.HEL774_BEFORE!=='1'){ + await sp.goto('http://127.0.0.1:'+sample.address().port);await sp.evaluate(t=>{document.documentElement.dataset.theme=t;document.documentElement.classList.add('reduce')},theme); + for(const page of ['studio','project']){await p.goto(WEB+(page==='studio'?'/':'/workbench/'+proj.id+'?stage=storyboard'));await p.locator(page==='studio'?'.studio-hero':'.storyboard-card').first().waitFor();await sp.evaluate(page=>document.querySelectorAll('.page').forEach(e=>e.classList.toggle('on',e.id==='p-'+page)),page);await settled(p);await settled(sp);await p.mouse.move(0,0);await p.screenshot({path:`../evidence/images/${page}-${theme}-${width}-actual.png`});await sp.screenshot({path:`../evidence/images/${page}-${theme}-${width}-sample.png`})} + } + } + if(process.env.HEL774_BEFORE!=='1'){ + await p.goto(WEB+'/workbench/'+proj.id+'?stage=storyboard');await p.locator('.storyboard-card').first().waitFor(); + await p.locator('[data-testid=stage-save-btn]').click();await p.locator('.toast.success').waitFor();await settled(p);await p.screenshot({path:out+'/confirm-click-with-toast.png'}); + await Promise.all([p.waitForURL('**?stage=assets'),p.locator('[data-testid=stage-confirm-btn]').click()]); + ok('actual confirm clickable with toast and advances only explicitly',(await api('/api/workbench/projects/'+proj.id)).stages.find(s=>s.stage_key==='storyboard').status==='confirmed');await p.screenshot({path:out+'/confirm-click-result.png'}); + } + + }finally{fs.writeFileSync(out+(process.env.HEL774_BEFORE==='1'?'/before.json':'/results.json'),JSON.stringify({records,checks},null,2));await c.tracing.stop({path:out+'/trace.zip'});await b.close();await new Promise(r=>sample.close(r))} +})().catch(e=>{console.error(e);process.exitCode=1}); diff --git a/e2e/run-hel774.py b/e2e/run-hel774.py index c8075c8d..5af66ffb 100644 --- a/e2e/run-hel774.py +++ b/e2e/run-hel774.py @@ -41,7 +41,7 @@ try: if stage in ('script','style'): api(f"/api/workbench/projects/{proj['id']}/stages/{stage}/confirm",({'chosen_style_id':'s1'} if stage=='style' else {})) print('stack ready, project',proj['id']) - result=subprocess.run(['node','e2e/hel774.cjs'],env=env) + result=subprocess.run(['node',os.environ.get('HEL774_SCRIPT','e2e/hel774.cjs')],env=env) raise SystemExit(result.returncode) finally: for p in processes: