Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

test(e2e): make the colour gates fail loudly when they stop measuring

Sergey Kozyrenkod012819f6b05
diff --git a/frontend/e2e/helpers/contrast.ts b/frontend/e2e/helpers/contrast.ts
index ed54da58..28ab7a76 100644
--- a/frontend/e2e/helpers/contrast.ts
+++ b/frontend/e2e/helpers/contrast.ts
@@ -62,6 +62,16 @@ export const mountEditorProbes = async (page: Page, probes: Record<string, strin
host.append(surface);
document.body.append(host);
+
+ // Both token rules paint a chip via color-mix, so a transparent probe
+ // means its class matched nothing — a rename, or the rule moving out
+ // from under the ancestor chain above. Without this the measurement
+ // silently falls back to the page's default text pair, which clears AA.
+ for (const probe of surface.children) {
+ if (getComputedStyle(probe).backgroundColor === 'rgba(0, 0, 0, 0)') {
+ throw new Error(`editor contrast probe "${probe.className}" matched no style rule`);
+ }
+ }
},
{ entries: Object.entries(probes), hostId: HOST_ID },
);
diff --git a/frontend/e2e/routes.ts b/frontend/e2e/routes.ts
index f90d8344..bd1a71f4 100644
--- a/frontend/e2e/routes.ts
+++ b/frontend/e2e/routes.ts
@@ -110,7 +110,9 @@ export const ROUTE_MANIFEST: RouteManifestEntry[] = [
// target floor — widening them is a density decision for the file manager.
a11yWaivers: [
{ rule: 'color-contrast', target: /text-muted-foreground\\?\/80/ },
- { rule: 'target-size', target: /\.rounded|aria-label="Select / },
+ // `.rounded` unanchored would also match every rounded-* utility, so a
+ // future under-sized control anywhere on the page would be waived too.
+ { rule: 'target-size', target: /\.rounded(?![-\w])|aria-label="Select / },
],
cassette: resourcesCassette,
path: routes.resources,
diff --git a/frontend/e2e/specs/cross/a11y.spec.ts b/frontend/e2e/specs/cross/a11y.spec.ts
index 307c0928..c3d90ae3 100644
--- a/frontend/e2e/specs/cross/a11y.spec.ts
+++ b/frontend/e2e/specs/cross/a11y.spec.ts
@@ -35,6 +35,9 @@ for (const theme of THEMES) {
test('has no axe violations', async ({ page }) => {
await page.goto(entry.path);
await expect(entry.ready(page)).toBeVisible();
+ // A seed that stops taking effect would otherwise re-run the light
+ // theme under a dark label and pass.
+ await expect(page.locator('html')).toHaveClass(theme === 'dark' ? /dark/ : /light/);
await scanA11y(page, entry.path, entry.a11yWaivers);
});
});
diff --git a/frontend/e2e/specs/cross/contrast.spec.ts b/frontend/e2e/specs/cross/contrast.spec.ts
index 26eda8f2..5c11ff2e 100644
--- a/frontend/e2e/specs/cross/contrast.spec.ts
+++ b/frontend/e2e/specs/cross/contrast.spec.ts
@@ -42,6 +42,7 @@ for (const theme of THEMES) {
test('every badge variant clears AA at rest and on hover', async ({ page }) => {
await page.goto('/flows');
await expect(page.getByRole('row', { name: /E2E Alpha/ })).toBeVisible();
+ await expect(page.locator('html')).toHaveClass(theme === 'dark' ? /dark/ : /light/);
await mountContrastProbes(
page,
@@ -63,6 +64,7 @@ for (const theme of THEMES) {
test('the destructive button clears AA at rest and on hover', async ({ page }) => {
await page.goto('/flows');
await expect(page.getByRole('row', { name: /E2E Alpha/ })).toBeVisible();
+ await expect(page.locator('html')).toHaveClass(theme === 'dark' ? /dark/ : /light/);
await mountContrastProbes(page, { destructive: buttonVariants({ variant: 'destructive' }) });
@@ -77,6 +79,7 @@ for (const theme of THEMES) {
test('editor highlight tokens clear AA on the editor surface', async ({ page }) => {
await page.goto('/flows');
await expect(page.getByRole('row', { name: /E2E Alpha/ })).toBeVisible();
+ await expect(page.locator('html')).toHaveClass(theme === 'dark' ? /dark/ : /light/);
await mountEditorProbes(page, EDITOR_TOKENS);