UNPKG

@birhaus/test-utils

Version:

BIRHAUS Testing & Validation Framework - Comprehensive testing utilities for cognitive load, accessibility, and BIRHAUS principle compliance

131 lines (129 loc) 3.62 kB
/** * BIRHAUS Lighthouse Integration * * Automated Lighthouse performance and accessibility scoring with BIRHAUS-specific metrics * * Features: * - Lighthouse audit integration * - BIRHAUS principle scoring * - Cognitive load performance metrics * - Spanish-first accessibility scoring * - Financial app optimization checks */ interface BirhausLighthouseConfig { url: string; device?: 'desktop' | 'mobile'; throttling?: 'slow-4g' | 'fast-3g' | 'none'; performance?: { score?: number; fcp?: number; lcp?: number; cls?: number; fid?: number; }; accessibility?: { score?: number; contrastRatio?: number; keyboardNav?: boolean; screenReader?: boolean; }; cognitive?: { millerLawCompliance?: boolean; undoPatterns?: boolean; spanishFirst?: boolean; }; } interface BirhausLighthouseResult { url: string; timestamp: number; performance: number; accessibility: number; bestPractices: number; seo: number; pwa: number; cognitiveLoad: number; spanishCoverage: number; undoPatterns: number; birhausCompliance: number; metrics: { firstContentfulPaint: number; largestContentfulPaint: number; cumulativeLayoutShift: number; firstInputDelay: number; timeToInteractive: number; navigationItems: number; formFields: number; confirmationDialogs: number; contrastRatio: number; missingAltText: number; keyboardAccessible: boolean; spanishLabels: number; bilingualSupport: boolean; financialTermsTranslated: number; }; recommendations: Array<{ category: 'performance' | 'accessibility' | 'cognitive' | 'spanish' | 'undo'; priority: 'high' | 'medium' | 'low'; title: string; titleEs: string; description: string; descriptionEs: string; birhausPrinciple?: number; estimatedImpact: number; }>; passed: boolean; overallScore: number; } declare class BirhausLighthouseValidator { private config; constructor(config: BirhausLighthouseConfig); /** * Run comprehensive BIRHAUS Lighthouse audit */ runAudit(): Promise<BirhausLighthouseResult>; /** * Run standard Lighthouse audit */ private runLighthouseAudit; /** * Run BIRHAUS-specific audits */ private runBirhausAudits; /** * Audit cognitive load compliance */ private auditCognitiveLoad; /** * Audit Spanish coverage */ private auditSpanishCoverage; /** * Audit undo patterns */ private auditUndoPatterns; /** * Get page handle for testing */ private getPage; /** * Combine Lighthouse and BIRHAUS results */ private combineResults; /** * Generate improvement recommendations */ private generateRecommendations; /** * Evaluate if audit results meet passing criteria */ private evaluatePassingCriteria; } /** * Run BIRHAUS Lighthouse audit */ declare function runBirhausLighthouseAudit(url: string, config?: Partial<BirhausLighthouseConfig>): Promise<BirhausLighthouseResult>; /** * Assert Lighthouse performance meets BIRHAUS standards */ declare function expectLighthouseScore(url: string, minScore?: number, config?: Partial<BirhausLighthouseConfig>): Promise<void>; export { type BirhausLighthouseConfig, type BirhausLighthouseResult, BirhausLighthouseValidator, expectLighthouseScore, runBirhausLighthouseAudit };