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.
70 lines
2.6 KiB
JavaScript
70 lines
2.6 KiB
JavaScript
// Phone-width sweep of the views the November audit flagged (#1757): at
|
|
// 390x844 each must fit without horizontal scroll or clipped controls. The
|
|
// topbar (with its instance badge) is on every page; /account holds the
|
|
// token form, /org/agents the agent rows and the grants card, /events the
|
|
// sources table, the event-type rule editor and the mapping editor dialog.
|
|
const assert = require('node:assert/strict');
|
|
const { staticRoutes } = require('./helpers/routes.cjs');
|
|
|
|
module.exports = async ({ page, go, shot, fail, settled, tolerate }) => {
|
|
// The extension catalogue 502 is a stack-environment issue, not this check.
|
|
tolerate(/extensions\/catalogue/);
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
|
|
const assertNoOverflow = async (label) => {
|
|
const { scrollWidth, innerWidth } = await page.evaluate(() => ({
|
|
scrollWidth: document.documentElement.scrollWidth,
|
|
innerWidth: window.innerWidth,
|
|
}));
|
|
if (scrollWidth > innerWidth) {
|
|
fail(`${label} overflows 390px: scrollWidth=${scrollWidth} > innerWidth=${innerWidth}`);
|
|
}
|
|
};
|
|
|
|
const visit = async (path, label, waitFor) => {
|
|
await go(path);
|
|
if (waitFor) await settled(waitFor);
|
|
await assertNoOverflow(label);
|
|
await shot(label);
|
|
};
|
|
|
|
await visit('/account', 'account-tokens', 'text=API tokens');
|
|
await visit('/org/agents', 'org-agents', 'text=Credential grants');
|
|
|
|
await go('/events');
|
|
await settled('[role=tab]');
|
|
await assertNoOverflow('events');
|
|
await shot('events');
|
|
|
|
// The seeded event type's rule editor (RuleEditor's condition row) opens
|
|
// from the Edit button on its row.
|
|
const editType = page.locator('button[aria-label^="Edit "]').first();
|
|
if (await editType.count()) {
|
|
await editType.click();
|
|
await page.getByRole('dialog').first().waitFor();
|
|
await settled();
|
|
await assertNoOverflow('event-type rule editor');
|
|
await shot('rule-editor');
|
|
await page.keyboard.press('Escape');
|
|
await settled();
|
|
}
|
|
|
|
// The mappings tab's editor dialog carries the payload tree.
|
|
await page.getByRole('tab', { name: 'Map' }).click();
|
|
await settled('text=New mapping');
|
|
await assertNoOverflow('mappings list');
|
|
const editMapping = page.locator('button', { hasText: 'Edit' }).first();
|
|
if (await editMapping.count()) {
|
|
await editMapping.click();
|
|
await page.getByRole('dialog').first().waitFor();
|
|
await settled();
|
|
await assertNoOverflow('mapping editor dialog');
|
|
await shot('mapping-editor');
|
|
}
|
|
|
|
// Every static route fits 390px (#1767): horizontal scroll fails.
|
|
for (const r of staticRoutes()) {
|
|
await visit(r, `route ${r}`, null);
|
|
}
|
|
};
|