/** * QA360 Playwright UI Adapter (Extended) * Complete UI E2E testing with all Playwright actions * * Playwright++ Features: * - Video recording (always/retain-on-fail/never) * - Automatic screenshots (before/after steps, on error) * - Trace capture for debugging * - Artifacts management with CAS * - HTML report generation */ import type { WebTarget, PackBudgets, UiTestDefinition, UiTestStep } from '../types/pack-v1.js'; import { AuthCredentials } from '../auth/index.js'; export interface UiTestConfig { target: WebTarget; budgets?: PackBudgets; timeout?: number; auth?: AuthCredentials; login?: { url?: string; username?: string; password?: string; usernameSelector?: string; passwordSelector?: string; submitSelector?: string; }; /** CLI override for headed mode */ cliHeaded?: boolean; /** Playwright++: Artifacts configuration */ artifacts?: { screenshots?: 'always' | 'only-on-failure' | 'never'; video?: 'always' | 'retain-on-failure' | 'never'; trace?: 'always' | 'retain-on-failure' | 'never' | 'on-first-failure'; outputDir?: string; }; /** Playwright++: HTML report generation */ htmlReport?: string; /** Playwright++: Bail after N failures */ bail?: number; } export interface UiTestResult { page: string; success: boolean; loadTime: number; error?: string; screenshot?: string; video?: string; /** Playwright++: Artifacts paths */ artifacts?: { screenshots: string[]; videos: string[]; traces: string[]; }; accessibility?: { score: number; violations: Array<{ id: string; impact: 'minor' | 'moderate' | 'serious' | 'critical'; description: string; nodes: number; }>; }; domSnapshot?: { title: string; url: string; elements: { buttons: number; links: number; forms: number; inputs: number; }; }; } export interface UiTestStepResult { step: UiTestStep; success: boolean; error?: string; duration: number; screenshot?: string; } export interface UiE2eResult { test: UiTestDefinition; success: boolean; steps: UiTestStepResult[]; duration: number; error?: string; } export interface UiSmokeResult { success: boolean; results: UiTestResult[]; e2eResults?: UiE2eResult[]; summary: { total: number; passed: number; failed: number; avgLoadTime: number; avgA11yScore: number; }; junit?: string; } export declare class PlaywrightUiAdapter { private browser?; private context?; private page?; private redactor; private auth?; private assertions?; private artifactDir; private videoDir; private traceDir; private artifactsManager?; private failureCount; private currentTestId?; private allScreenshots; private allVideos; private allTraces; private lastDialog?; private dialogBehavior; private dialogPromptValue; private openPages; private currentPageIndex; private globalDialogHandler?; private pendingDialogHandler?; private siteProfiler; private siteAnalysis?; private siteProfile?; private selectorGenerator; private consentHandler; private currentFrame?; constructor(); /** * Set authentication credentials for requests */ setAuth(credentials?: AuthCredentials): void; /** * Execute UI smoke tests with accessibility * Playwright++: Supports artifacts, screenshots, video, trace, HTML reporting */ runSmokeTests(config: UiTestConfig): Promise; /** * Run a single E2E test * Playwright++: Takes before/after screenshots, captures artifacts on failure */ runE2eTest(test: UiTestDefinition, config: UiTestConfig): Promise; /** * Execute a single UI test step * Playwright++: Enhanced error handling with artifacts */ private executeStep; /** * Verify expected outcomes after a step */ private verifyExpected; /** * Test single page with accessibility */ private testPage; /** * Test page with actions (for user journeys) */ private testPageWithActions; /** * Smart click with automatic hover/scroll fallback for invisible elements * Handles dropdown menus that require hover to reveal clickable items */ private smartClick; private sleep; /** * Execute a single page action */ private executeAction; /** * Setup browser with all options * Playwright++: Enhanced video/trace recording support */ private setupBrowser; /** * Determine if video should be recorded */ private shouldRecordVideo; /** * Playwright++: Generate HTML report */ private generateHtmlReport; /** * Perform login if configured */ private performLogin; /** * Run accessibility tests using axe-core */ private runAccessibilityTests; /** * Get DOM snapshot for debugging */ private getDomSnapshot; /** * Take screenshot for debugging */ private takeScreenshot; /** * Calculate test summary */ private calculateSummary; /** * Generate JUnit XML fragment */ private generateJUnit; /** * Escape XML special characters */ private escapeXml; /** * Cleanup browser resources and manage artifacts */ private cleanup; /** * Validate UI target configuration */ static validateConfig(target: WebTarget): { valid: boolean; errors: string[]; }; }