Files
waggle-os/tests/e2e/runtime-a11y.spec.ts
shumeiko.it f3eb6b6652 feat(web): ask before sending analytics, drop team screens, hide v1-absent memory features (P1.3a)
- Analytics are opt-in (decision Q7, ADR-0006). PostHog does not start or
  capture anything until the user clicks Allow in a first-run dialog that
  says what is sent. Escape or closing stores nothing and asks again. The
  existing Privacy & Telemetry toggle in Settings withdraws consent at once.
  Builds without VITE_POSTHOG_KEY show no dialog and send nothing.
- Remove the remaining upsell copy: the /team page with its per-seat price,
  Stripe and Teams wording in the erase-data dialog, Teams/Enterprise hints.
- Remove team screens (decision Q3): Waggle Dance, team presence in chat,
  team storage and sharing in workspace creation, storage and files.
- Hide memory features that are not in v1 (decision Q2) behind one map in
  lib/memory-features.ts: the knowledge graph, import history, wiki, agent
  memory hooks and Room launches. The map is the seam P1.5 fills from the
  memory store's capabilities.
- Say Windows, macOS and Linux instead of "Linux soon".
- Update the e2e specs for the removed and hidden screens.

Also logs UF-029: the Settings "Import Data" button has no handler.
2026-10-23 14:51:29 +02:00

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([]);
});
}
});