import type { Reporter, FullConfig, Suite, TestCase, TestResult, FullResult, TestStep } from "@playwright/test/reporter"; /** Reporter configuration with sane defaults. */ interface OracleReporterConfig { /** Directory for generated report output. @default "playwright-oracle-report" */ outputDir: string; /** Directory for history storage. @default ".playwright-oracle-history" */ historyDir: string; /** Whether to open the HTML report automatically. Defaults to true locally and false in CI. */ openReport: boolean; /** Optional human-readable label for this run. */ runLabel?: string; /** Telemetry sampling interval in seconds. @default 3 */ telemetryInterval: number; /** AI analysis mode. @default "auto" */ aiMode: "auto" | "rules" | "openai" | "claude" | "off"; /** Hard timeout for AI enrichment in milliseconds. @default 90000 */ aiTimeoutMs: number; } /** * Playwright Oracle Reporter — main entry point. * * Implements the Playwright {@link Reporter} interface. All heavy * lifting (HTML rendering, markdown generation, artifact copying, * terminal output) is delegated to dedicated modules under `src/report/`. */ export default class PlaywrightOracleReporter implements Reporter { private readonly config; private readonly aiTimeoutExplicit; private startTime; private readonly tests; private runSummary; private readonly sampler; private readonly historyStore; private totalTests; private currentTestIndex; private aiAttempted; private aiProvider; private baseReportOpened; private reportFinalized; private onEndPromise; /** Active enricher instance, kept for partial result recovery on timeout. */ private activeEnricher; private isDebugEnabled; private readonly htmlGenerator; private readonly markdownGenerator; private readonly artifactCopier; private readonly terminal; /** * @param options - Partial configuration; missing keys fall back to * environment variables then hard-coded defaults. */ constructor(options?: Partial); private computeAutoAiTimeoutMs; /** Called once before running tests. */ onBegin(_config: FullConfig, suite: Suite): void; /** Called when a test starts. */ onTestBegin(test: TestCase, _result: TestResult): void; /** Called when a test step begins. */ onStepBegin(_test: TestCase, _result: TestResult, step: TestStep): void; /** Called for each test result. */ onTestEnd(test: TestCase, result: TestResult): void; /** Called after all tests complete. Orchestrates report generation. */ onEnd(_result: FullResult): Promise; private onEndInner; /** * Install SIGTERM/SIGINT handlers that finalize the report * if the process is killed before onEnd completes (e.g. global-teardown). */ private installSignalHandlers; /** * Generate the complete report: analysis → JSON → artifacts → HTML → Markdown. * * @returns AI response if provider enrichment was invoked successfully, otherwise `null`. */ private generateReport; /** Try to enrich analysis with an external AI provider; returns null on skip/failure. */ private tryAIEnrichment; /** Create an OpenAI enricher, store it for partial-result recovery, and run enrichment. */ private enrichWithOpenAI; /** Create a Claude enricher, store it for partial-result recovery, and run enrichment. */ private enrichWithClaude; private resolveAIProviders; private getProviderApiKey; private getProviderKeyEnvVar; private getProviderLabel; /** Build a TestSummary from Playwright's native types. */ private static extFromContentType; private static buildTestSummary; /** Increment pass/fail/skip/flaky counters from a test result. */ private updateRunSummary; /** Finalise timing on the run summary. */ private finaliseRunSummary; /** Build a HistoryRecord for the JSONL store. */ private buildHistoryRecord; /** Map TestSummary[] → TestResultLite[] for analysis APIs. */ private mapToTestLites; /** Generate a minimal fallback report when normal generation fails. */ private generateFallbackReport; /** Write JSON data to the report output directory. */ private writeJSON; /** Ensure a directory exists, creating recursively if needed. */ private ensureDir; /** Log without ever throwing (reporter must never break Playwright). */ private safeLog; /** Open the HTML report in the default browser. */ private openReportInBrowser; /** Parse an integer from process.env, returning `undefined` on failure. */ private static parseEnvInt; /** Type-guard for valid AI mode strings. */ private static isValidAiMode; } export {}; //# sourceMappingURL=index.d.ts.map