HEL-774: wait for navigation, pending saves and theme transitions in focused checks
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
+4
-4
@@ -68,9 +68,9 @@ const wait=ms=>new Promise(r=>setTimeout(r,ms));
|
||||
await p.route('**/api/projects',r=>r.fulfill({json:[]}));await p.goto(WEB);await p.locator('.studio-hero').waitFor();await wait(100);await p.screenshot({path:`${out}/images/empty-${theme}-${width}.png`});ok(`empty ${theme} ${width}`,await p.locator('.studio-display').innerText().then(t=>t.includes('从一个想法开始')));await p.unroute('**/api/projects');
|
||||
}
|
||||
// Meaningful operation checks for the affected buttons, with actual API persistence.
|
||||
await p.goto(WEB);await p.locator('.studio-hero .secondary').waitFor();const heroHref=await p.locator('.studio-hero .secondary').getAttribute('href');await p.locator('.studio-hero .secondary').click();ok('studio secondary opens real project stage',new URL(p.url()).pathname+new URL(p.url()).search===heroHref);
|
||||
await p.goto(WEB+projectPath);await p.locator('.storyboard-card').first().waitFor();await p.getByRole('button',{name:'编辑',exact:true}).click();await p.locator('.shot-edit textarea').first().fill('HEL774 次级保存按钮实际操作');ok('editing prevents stale confirmation',await p.locator('[data-testid=stage-confirm-btn]').isDisabled());await p.route('**/stages/storyboard',async route=>{if(route.request().method()==='PATCH')await wait(1000);await route.continue()});await p.locator('[data-testid=stage-save-btn]').click();ok('save secondary disabled while request pending',await p.locator('[data-testid=stage-save-btn]').isDisabled());await p.screenshot({path:out+'/images/operation-save-pending.png'});for(let n=0;n<50;n++){if(JSON.stringify(await api('/api/workbench/projects/'+proj.id)).includes('HEL774 次级保存按钮实际操作'))break;await wait(100)}ok('secondary saves actual edited draft',JSON.stringify(await api('/api/workbench/projects/'+proj.id)).includes('HEL774 次级保存按钮实际操作'));await p.screenshot({path:out+'/images/operation-save.png'});await p.unroute('**/stages/storyboard');
|
||||
await p.goto(WEB);await p.locator('.confirm-item .secondary').first().click();ok('pending secondary navigates to draft',p.url().includes('/workbench/'));
|
||||
await p.goto(WEB);await p.locator('.studio-hero .secondary').waitFor();const heroHref=await p.locator('.studio-hero .secondary').getAttribute('href');await Promise.all([p.waitForURL(WEB+heroHref),p.locator('.studio-hero .secondary').click()]);ok('studio secondary opens real project stage',new URL(p.url()).pathname+new URL(p.url()).search===heroHref);
|
||||
await p.goto(WEB+projectPath);await p.locator('.storyboard-card').first().waitFor();await p.getByRole('button',{name:'编辑',exact:true}).click();await p.locator('.shot-edit textarea').first().fill('HEL774 次级保存按钮实际操作');ok('editing prevents stale confirmation',await p.locator('[data-testid=stage-confirm-btn]').isDisabled());await p.route('**/stages/storyboard',async route=>{if(route.request().method()==='PATCH')await wait(1000);await route.continue()});await p.locator('[data-testid=stage-save-btn]').click();await p.locator('[data-testid=stage-save-btn]:disabled').waitFor();ok('save secondary disabled while request pending',await p.locator('[data-testid=stage-save-btn]').isDisabled());await p.screenshot({path:out+'/images/operation-save-pending.png'});for(let n=0;n<50;n++){if(JSON.stringify(await api('/api/workbench/projects/'+proj.id)).includes('HEL774 次级保存按钮实际操作'))break;await wait(100)}ok('secondary saves actual edited draft',JSON.stringify(await api('/api/workbench/projects/'+proj.id)).includes('HEL774 次级保存按钮实际操作'));await p.screenshot({path:out+'/images/operation-save.png'});await p.unroute('**/stages/storyboard');
|
||||
await p.goto(WEB);await Promise.all([p.waitForURL('**/workbench/**'),p.locator('.confirm-item .secondary').first().click()]);ok('pending secondary navigates to draft',p.url().includes('/workbench/'));
|
||||
await p.goto(WEB);await p.locator('.studio-search').click();ok('search remains functional',await p.getByRole('dialog').isVisible());await p.keyboard.press('Escape');await p.keyboard.press('Control+k');ok('search shortcut preserved',await p.getByRole('dialog').isVisible());await p.keyboard.press('Escape');
|
||||
// B1/B2: compare live shared controls with exact previous shared declarations applied via CSSOM.
|
||||
const protections=[];
|
||||
@@ -78,7 +78,7 @@ const wait=ms=>new Promise(r=>setTimeout(r,ms));
|
||||
await p.goto(WEB+route);await wait(800);
|
||||
ok(route+' sidebar retained',await p.locator('aside.sidebar').isVisible());
|
||||
for(const theme of ['night','day','grade','bluehour']){
|
||||
await p.evaluate(t=>document.documentElement.dataset.theme=t,theme);await wait(150);
|
||||
await p.mouse.move(0,0);await p.evaluate(t=>document.documentElement.dataset.theme=t,theme);await wait(600);
|
||||
const buttons=p.locator('.a-btn:visible');const count=await buttons.count();
|
||||
const baseline=await buttons.evaluateAll(es=>es.map(e=>{const s=getComputedStyle(e),b=e.getBoundingClientRect();return {text:e.textContent.trim(),bg:s.backgroundColor,border:s.borderTopColor,pad:s.paddingLeft,width:b.width,height:b.height,font:s.fontSize}}));
|
||||
await p.evaluate(()=>{window.hel774Rules=[];for(const sheet of document.styleSheets){let rules;try{rules=sheet.cssRules}catch{continue}for(const r of rules){if(!r.selectorText)continue;const sel=r.selectorText;if(sel==='.a-btn'){window.hel774Rules.push([r,r.style.cssText]);r.style.padding='0 var(--sp-6)'}if(sel==='.a-btn.secondary'){window.hel774Rules.push([r,r.style.cssText]);r.style.borderColor='var(--line)';r.style.removeProperty('--button-padding');r.style.removeProperty('--button-active-transform')}}}});
|
||||
|
||||
Reference in New Issue
Block a user