Files
archie/e2e/checks/loading-errors.cjs
T
sam 21b3591da1
deploy / gate (push) Successful in 4m48s
Quality / check (push) Successful in 6m11s
deploy / archied-image (push) Successful in 3m31s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
fix(e2e+ui): e2e checks for the audit's failure classes, and the gaps they caught (#1767)
loading-errors now forces each list API (/api/tasks, /api/captures,
/api/event-types, /api/tokens, /api/access/policies) to fail and asserts
the page shows its error surface, never its empty-state copy.
accessibility gains two static-route sweeps: every input/textarea/select/
button must have an accessible name, and every keyboard focus stop's
indicator (ring var, outline, shadow or focus border) must clear 3:1
against the background behind it. phone-overflow sweeps every static
route at 390x844 for horizontal scroll. The sweeps caught real gaps,
fixed here: the DurationInput amount input had no accessible name and
its unit select no focus indicator, and TabsContent and CodeBlockContent
were focusable with outline-none and no ring. The stale 'Sections' list
selector now matches the nav landmark.
2026-11-07 17:08:10 +11:00

37 lines
2.2 KiB
JavaScript

const assert=require('node:assert/strict');
module.exports=async({page,go,shot,tolerate})=>{
// The extension catalogue 502 is a stack-environment issue, not this check.
tolerate(/extensions\/catalogue/);
await page.route('**/api/access/policies',async route=>{await new Promise(r=>setTimeout(r,2200));await route.continue()});
await go('/access/policies');
assert.equal(await page.getByText('No policies yet.',{exact:true}).count(),0);
await page.getByText('Loading policies…',{exact:true}).waitFor({state:'hidden'});
await page.route('**/api/tasks?**',async route=>{
if(new URL(route.request().url()).searchParams.has('workflow')) await route.fulfill({status:200,contentType:'application/json',body:'unreadable response'});
else await route.continue();
});
await go('/workflows');
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor();
await page.getByRole('tab',{name:/^Runs/}).click();
assert.equal(await page.getByText('No runs yet',{exact:true}).count(),0);
await page.unroute('**/api/tasks?**');
await page.getByRole('button',{name:'Retry runs',exact:true}).click();
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor({state:'hidden'});
await shot('recovered');
// A failed list read is an error, never the empty state (#1767): force each
// page's list API to 500 and check its empty-state copy stays hidden.
const failList = async (pattern,path,emptyTexts,errorSel='[role=alert]')=>{
await page.route(pattern,route=>route.fulfill({status:200,contentType:'application/json',body:'unreadable response'}));
await go(path);
await page.locator(errorSel).first().waitFor();
for(const text of emptyTexts) assert.equal(await page.getByText(text,{exact:true}).count(),0,`${path} shows its empty state ("${text}") while the list read fails`);
await page.unroute(pattern);
};
await failList('**/api/tasks*','/tasks',['No tasks yet'],'text=Archie is not responding');
await failList('**/api/captures*','/events',['No captures yet']);
await failList('**/api/event-types*','/events',['No event types yet']);
await failList('**/api/tokens*','/account',['No tokens yet']);
await failList('**/api/access/policies*','/org/policies',['No policies yet']);
await shot('failed-reads-show-errors');
};