Anti-slop audit-002, item 13 (R-02). Every em dash in text the user sees (web UI labels, toasts, tooltips, empty and error states, chat steps, API messages, notifications and channel replies) became a period, comma, colon or parentheses. Model prompts, logs, comments, regexes and the lone dash that marks an empty value are unchanged. Text the client matches against server copy (the default workspace summary, the quiet-night dream summary) accepts the old wording too, so cached and saved data still match.
138 lines
4.0 KiB
TypeScript
138 lines
4.0 KiB
TypeScript
import { expect, test, type Page } from '@playwright/test';
|
|
import { readFileSync } from 'node:fs';
|
|
import { createRequire } from 'node:module';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const axeSource = readFileSync(require.resolve('axe-core/axe.min.js'), 'utf8');
|
|
|
|
test.use({ bypassCSP: true });
|
|
|
|
const SKIP_PARAMS = 'skipOnboarding=true&skipBoot=true&skipBriefing=true&tier=power';
|
|
|
|
const ROUTES = [
|
|
'/home',
|
|
'/settings',
|
|
'/settings?tab=models',
|
|
'/settings?tab=permissions',
|
|
'/settings?tab=backup',
|
|
'/settings?tab=channels',
|
|
'/settings?tab=advanced',
|
|
'/settings/profile',
|
|
'/settings/vault',
|
|
'/settings/mission-control',
|
|
'/settings/timeline',
|
|
'/settings/events',
|
|
'/settings/usage',
|
|
'/memory',
|
|
'/memory?tab=trust',
|
|
'/memory?tab=memories',
|
|
'/memory?tab=timeline',
|
|
'/memory?tab=weaver',
|
|
'/workspaces',
|
|
'/workspaces/default-workspace/chat',
|
|
'/workspaces/default-workspace/tasks',
|
|
'/agents',
|
|
'/automations',
|
|
'/skills',
|
|
'/room',
|
|
'/launcher',
|
|
'/connectors',
|
|
'/mcps',
|
|
'/marketplace',
|
|
'/files',
|
|
'/approvals',
|
|
'/artifacts',
|
|
'/benchmarks',
|
|
'/platform',
|
|
] as const;
|
|
|
|
const VIEWPORTS = [
|
|
{ name: 'desktop', width: 1440, height: 900 },
|
|
{ name: 'mobile', width: 390, height: 844 },
|
|
] as const;
|
|
|
|
type AxeViolation = {
|
|
id: string;
|
|
impact: string | null;
|
|
description: string;
|
|
help: string;
|
|
nodes: Array<{ target: string[]; html: string; failureSummary?: string }>;
|
|
};
|
|
|
|
type AxeResult = {
|
|
violations: AxeViolation[];
|
|
};
|
|
|
|
function routeWithSkip(route: string) {
|
|
const sep = route.includes('?') ? '&' : '?';
|
|
return `${route}${sep}${SKIP_PARAMS}`;
|
|
}
|
|
|
|
async function gotoApp(page: Page, route: string) {
|
|
await page.goto(routeWithSkip(route), { waitUntil: 'domcontentloaded' });
|
|
await page.waitForSelector('.waggle-sidebar, [role="navigation"], main', { timeout: 15_000 });
|
|
// Let lazy route content and the shell's 200ms entrance transition settle
|
|
// before axe samples transient dialog/backdrop layers.
|
|
await page.waitForTimeout(800);
|
|
}
|
|
|
|
async function runAxe(page: Page): Promise<AxeViolation[]> {
|
|
await page.addScriptTag({ content: axeSource });
|
|
const result = await page.evaluate(async () => {
|
|
const axe = (window as typeof window & {
|
|
axe: { run: (context?: unknown, options?: unknown) => Promise<AxeResult> };
|
|
}).axe;
|
|
return axe.run(document, {
|
|
resultTypes: ['violations'],
|
|
});
|
|
});
|
|
return result.violations;
|
|
}
|
|
|
|
function formatViolations(violations: AxeViolation[]) {
|
|
return violations.map((violation) => ({
|
|
id: violation.id,
|
|
impact: violation.impact,
|
|
help: violation.help,
|
|
nodes: violation.nodes.map((node) => ({
|
|
target: node.target.join(' '),
|
|
html: node.html,
|
|
failureSummary: node.failureSummary,
|
|
})),
|
|
}));
|
|
}
|
|
|
|
test.describe('Runtime accessibility smoke', () => {
|
|
test('milestone toast has no mobile accessibility violations', async ({ page }) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await page.addInitScript(() => {
|
|
window.localStorage.setItem('waggle:session-count', '49');
|
|
window.localStorage.setItem('waggle:dock-nudge-dismissed', '[10]');
|
|
});
|
|
|
|
await gotoApp(page, '/agents');
|
|
await expect(page.getByText('50 sessions in. Nicely done', { exact: true })).toBeVisible();
|
|
await expect(page.getByRole('button', { name: 'Close notification' })).toHaveCSS('opacity', '1');
|
|
|
|
expect(formatViolations(await runAxe(page))).toEqual([]);
|
|
});
|
|
|
|
for (const viewport of VIEWPORTS) {
|
|
test(`axe has no violations across core routes (${viewport.name})`, async ({ page }) => {
|
|
test.setTimeout(150_000);
|
|
await page.setViewportSize({ width: viewport.width, height: viewport.height });
|
|
|
|
const findings: Array<{ route: string; violations: ReturnType<typeof formatViolations> }> = [];
|
|
for (const route of ROUTES) {
|
|
await gotoApp(page, route);
|
|
const violations = await runAxe(page);
|
|
if (violations.length > 0) {
|
|
findings.push({ route, violations: formatViolations(violations) });
|
|
}
|
|
}
|
|
|
|
expect(findings).toEqual([]);
|
|
});
|
|
}
|
|
});
|