- 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>
29 lines
1.8 KiB
TypeScript
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([]);
|
|
});
|