Files
workinf_Blender_Wasm/web/tests/e2e/parts-tutorial-accessibility.spec.ts
mes123456 d1e6b63d54
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender feature-gap work, docs and tests
- update native web_engine sources and rebuilt wasm artifacts
- add task cards, status notes and tooling scripts
- add web e2e specs, tutorial UI sources and tutorial assets
- sync golden task manifests and audit records

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-11 10:46:55 +08:00

29 lines
1.8 KiB
TypeScript

import AxeBuilder from "@axe-core/playwright";
import { test, expect } from "@playwright/test";
type AxeViolation = { id: string; help: string; impact?: string | null; nodes: unknown[] };
const severity = (violations: AxeViolation[]) =>
violations.filter((violation) => violation.impact === "critical" || violation.impact === "serious")
.map((violation) => `${violation.id}: ${violation.help} (${violation.nodes.length} nodes)`);
test("parts tutorial landing and guided overlay are accessible", async ({ page }) => {
test.setTimeout(240_000);
await page.goto("/?tutorial=parts");
await expect(page.getByRole("heading", { name: /从零制作/ })).toBeVisible({ timeout: 60_000 });
const landing = await new AxeBuilder({ page }).withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"]).analyze();
expect(severity(landing.violations)).toEqual([]);
await page.getByRole("button", { name: /开始学习/ }).click();
const panel = page.locator("[data-tutorial-step]");
await expect(panel).toBeVisible({ timeout: 120_000 });
await expect(page.getByRole("button", { name: /^下一步/ })).toBeEnabled({ timeout: 180_000 });
await expect(panel.locator("progress.tutorial-progress")).toHaveAttribute("aria-label", "教程完成进度");
// The guide card has no checks; audit the first practice step instead.
await page.getByRole("button", { name: /^下一步/ }).click();
await expect(page.locator('[data-tutorial-step="base-rename"]')).toBeVisible({ timeout: 30_000 });
await expect(panel.locator(".tutorial-checks")).toHaveAttribute("aria-live", "polite");
const overlay = await new AxeBuilder({ page }).include(".parts-tutorial-overlay").withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"]).analyze();
expect(severity(overlay.violations)).toEqual([]);
});