/** * Agentic QE v3 - Axe-Core Accessibility Audit * * REAL IMPLEMENTATION using @axe-core/playwright for accessibility testing. * This integrates with Playwright to run axe-core against real web pages. * * Features: * - WCAG 2.0/2.1/2.2 compliance testing * - Section 508 compliance * - Best practices validation * - Custom rule configuration * * @module visual-accessibility/axe-core-audit */ /** * WCAG conformance levels */ export type WCAGLevel = 'A' | 'AA' | 'AAA'; /** * WCAG versions */ export type WCAGVersion = '2.0' | '2.1' | '2.2'; /** * Accessibility issue impact levels */ export type A11yImpact = 'critical' | 'serious' | 'moderate' | 'minor'; /** * Accessibility violation */ export interface A11yViolation { /** Unique rule ID */ id: string; /** Human-readable description */ description: string; /** Detailed help text */ help: string; /** URL to learn more */ helpUrl: string; /** Impact level */ impact: A11yImpact; /** WCAG tags (e.g., 'wcag2a', 'wcag21aa') */ tags: string[]; /** Affected elements */ nodes: A11yNode[]; } /** * DOM node with accessibility issue */ export interface A11yNode { /** HTML snippet */ html: string; /** CSS selector path to element */ target: string[]; /** XPath to element */ xpath?: string[]; /** Failure summary */ failureSummary: string; /** Impact level for this specific node */ impact: A11yImpact; /** Specific check failures */ any?: A11yCheck[]; /** All checks that must pass */ all?: A11yCheck[]; /** None checks (must all fail) */ none?: A11yCheck[]; } /** * Individual accessibility check result */ export interface A11yCheck { /** Check ID */ id: string; /** Check result data */ data?: unknown; /** Related nodes */ relatedNodes?: Array<{ html: string; target: string[]; }>; /** Impact if failed */ impact?: A11yImpact; /** Human-readable message */ message: string; } /** * Accessibility audit configuration */ export interface A11yAuditConfig { /** URL to audit */ url: string; /** WCAG conformance level to test against */ wcagLevel: WCAGLevel; /** WCAG version */ wcagVersion: WCAGVersion; /** Include best practices checks */ includeBestPractices: boolean; /** Include experimental rules */ includeExperimental: boolean; /** CSS selector to scope the audit */ context?: string; /** Rules to exclude */ excludeRules?: string[]; /** Additional rule tags to include */ includeTags?: string[]; /** Timeout for page load in ms */ timeout?: number; /** Wait for selector before auditing */ waitForSelector?: string; } /** * Accessibility audit result */ export interface A11yAuditResult { /** URL that was audited */ url: string; /** Timestamp of the audit */ timestamp: Date; /** Duration in milliseconds */ durationMs: number; /** Whether the audit completed successfully */ success: boolean; /** All violations found */ violations: A11yViolation[]; /** Passing checks */ passes: number; /** Incomplete checks (need manual review) */ incomplete: A11yViolation[]; /** Rules that don't apply */ inapplicable: number; /** Summary statistics */ summary: { critical: number; serious: number; moderate: number; minor: number; total: number; passed: number; }; /** WCAG compliance status */ wcagCompliance: { level: WCAGLevel; version: WCAGVersion; compliant: boolean; violationsBlockingCompliance: number; }; /** Tool information */ toolInfo: { axeCoreAvailable: boolean; playwrightAvailable: boolean; version?: string; }; /** Error messages if any */ errors?: string[]; } /** * Accessibility auditor using axe-core and Playwright */ export declare class AccessibilityAuditor { private config; private toolsAvailable; constructor(config: Partial & { url: string; }); /** * Check if required tools are available */ checkToolAvailability(): Promise; /** * Run accessibility audit */ audit(): Promise; /** * Run actual axe-core audit using Playwright */ private runAxeCoreAudit; /** * Create fallback result when tools are not available */ private createFallbackResult; /** * Get WCAG tags based on configuration */ private getWCAGTags; /** * Convert axe-core violations to our format */ private convertViolations; /** * Calculate summary statistics */ private calculateSummary; /** * Check WCAG compliance based on violations */ private checkWCAGCompliance; } /** * Create an accessibility auditor */ export declare function createAccessibilityAuditor(config: Partial & { url: string; }): AccessibilityAuditor; /** * Quick accessibility audit with default settings */ export declare function quickA11yAudit(url: string): Promise; /** * Run WCAG 2.1 AA compliance check (most common standard) */ export declare function checkWCAG21AA(url: string): Promise; /** * Run comprehensive accessibility audit (all levels) */ export declare function fullA11yAudit(url: string): Promise; /** * Generate accessibility report in markdown format */ export declare function generateA11yReport(result: A11yAuditResult): string; //# sourceMappingURL=axe-core-audit.d.ts.map