Files
novalon-website/test-framework/e2e/accessibility.spec.ts
T
zhangxiang 602ed6a671 test(hooks): finalize mutation test improvements and release acceptance
- Raise use-swipe-gesture mutation score to 66.13% (target 65%+)
- Maintain use-reduced-motion mutation score at 76.32% (target 50%+)
- Fix use-reduced-motion.ts ESLint set-state-in-effect warning
- Add UJ-10 deep searcher journey (category browse → article read → content discovery)
- Add 40 new test files (analytics, detail, sections, ui, lib components)
- Update test-strategy-plan.md to v2.0 (sync test count to 1591)
- Sync README.md with final release metrics

Quality gates: TS 0 errors, ESLint 0 errors, 121 suites / 1591 tests passed
2026-08-02 19:39:27 +08:00

33 lines
1.2 KiB
TypeScript

// @ts-nocheck
import { test } from '@playwright/test';
import { AccessibilityTester } from '../../test-framework/shared/utils/accessibility/AccessibilityTester';
import { accessibilityThresholds } from '../../test-framework/shared/config/test-data';
test.describe('可访问性测试', () => {
test('首页应该通过可访问性检查', async ({ page }) => {
const tester = new AccessibilityTester(page);
await page.goto('/');
const result = await tester.runAxeScan('首页', '/');
console.log(`可访问性得分: ${result.score}`);
console.log(`违规数量: ${result.violations.length}`);
expect(result.score).toBeGreaterThanOrEqual(accessibilityThresholds.score);
expect(result.violations.length).toBeLessThanOrEqual(accessibilityThresholds.maxViolations);
});
test('所有图片应该有Alt文本', async ({ page }) => {
const tester = new AccessibilityTester(page);
await page.goto('/');
const result = await tester.checkAltText();
console.log(`图片总数: ${result.total}`);
console.log(`有Alt文本: ${result.withAlt}`);
console.log(`无Alt文本: ${result.withoutAlt}`);
expect(result.withoutAlt).toBe(0);
});
});