import type { Reporter, FullConfig, Suite, TestCase, TestResult, TestStep, FullResult } from '@playwright/test/reporter'; import { TestChimpReporterOptions } from './types'; /** * TestChimp Playwright Reporter * * Reports test execution data to the TestChimp backend for * coverage tracking and traceability. * * @example * // playwright.config.ts * export default defineConfig({ * reporter: [ * ['@testchimp/playwright/reporter', { * verbose: true, * reportOnlyFinalAttempt: true * }] * ] * }); */ export declare class TestChimpReporter implements Reporter { /** * Max Playwright trace .zip size we'll POST as multipart to featureservice `/api/upload_attachment`. * Must stay below the server's Commons multipart limit (see featureservice `FeatureServiceApplication`). * Failure screenshots use the same endpoint but are re-encoded to JPEG first (~viewport KB range). */ private static readonly DEFAULT_TRACE_MAX_BYTES; private static readonly DEFAULT_TRACE_UPLOAD_TIMEOUT_MS; private static readonly DEFAULT_TRACE_UPLOAD_RETRIES; private config; private options; private apiClient; private batchInvocationId; /** Path we wrote for this run; unlinked in onEnd when write succeeded. */ private batchInvocationFileWrittenPath; private shouldUnlinkBatchInvocationFile; private testsFolder; private testExecutions; private testRetryInfo; private jobManifest; private platformStepEndEnabled; private isEnabled; /** * Fire-and-forget HTTP tails keyed by scriptservice job id (manifest jobId for platform/step_end, * TESTCHIMP_REPAIR_JOB_ID for repair_step_end). Drains in onTestEnd only await that job's bucket so * parallel tests in the same worker do not block each other. onEnd drains every bucket. */ private pendingOperationsByJobId; /** Track platform per-test finalization so onEnd can await it even if Playwright doesn't. */ private inFlightPlatformFinalizations; /** Idempotency: same journey execution id must not POST journey_execution_end twice (CI + platform + finally). */ private exploreChimpJourneyEndSentIds; constructor(options?: TestChimpReporterOptions); onBegin(config: FullConfig, suite: Suite): void; private loadJobManifest; /** * Resolve jobId from the platform manifest. * - No describe block: both parser and Playwright use suitePath [] → exact match. * - Global describe(): parser only sees test.describe() so manifest has []; Playwright reports e.g. ["Suite"] → fallback with []. */ private getJobFromManifest; private getManifestDebugCandidates; /** * Build full job detail from all attempts for this test (from in-memory testExecutions). * For step_end: currentAttemptIsFinal=false (current attempt in progress). * For test_end: currentAttemptIsFinal=true, finalStatus/error from result. * Past attempts are marked FAILED (retry implies they did not succeed). */ private buildJobDetailFromAttempts; /** Build current job detail for platform step_end (all attempts so far, current still in progress) */ private buildCurrentJobDetailForPlatform; /** Build final job detail for platform test_end (all attempts with final status) */ private buildFinalJobDetailForPlatform; onTestBegin(test: TestCase, result: TestResult): void; onStepEnd(test: TestCase, result: TestResult, step: TestStep): void; onTestEnd(test: TestCase, result: TestResult): Promise; private _onTestEndInner; onEnd(result: FullResult): Promise; /** Align ExploreChimp workers with suite batch id (env then file); same path as {@link readTestChimpBatchInvocationId}. */ private writeSuiteBatchInvocationFileForExploreChimp; private unlinkSuiteBatchInvocationFileIfWritten; private getTestKey; private platformFinalizeTestEnd; /** * ExploreChimp execution job id: platform manifest job id when resolved, else stable hash of test id + batch + retry. * Must match {@link ensureExploreChimpJourneyExecutionEnd} and the id used for smart test execution ingest. */ private exploreChimpJourneyExecutionJobId; /** * Local ExploreChimp: persist step timeline and mark the journey execution completed. * Only when {@link isExploreChimpEnabled} is true. Idempotent per journeyExecutionId. */ private ensureExploreChimpJourneyExecutionEnd; private pushPendingForJob; /** * Await in-flight HTTP for a single platform/repair job id. Work pushed while draining is picked up * in subsequent loop iterations for the same bucket. */ private drainPendingForJob; private countTotalPendingOperations; /** Run shutdown: wait for every job bucket (parallel tests may each have their own jobId). */ private drainAllPendingBuckets; private scanTestRetries; private buildReport; private mapStatus; /** * Attach failure screenshots: failing steps first; if none, attach to last step (test-level failures e.g. ai.act). */ private attachScreenshotsToFailingSteps; private getTraceMaxBytes; private isTraceAttachment; private uploadTraceAttachmentIfPresent; /** * Generic Playwright pw:api leaf titles; use innermost enclosing test.step title instead. */ private static readonly GENERIC_PW_API_TITLES; private isGenericPwApiTitle; /** Single-line description: test.step / expect use title; generic pw:api uses enclosing test.step title when present. */ /** Must match ExploreChimp `test.step` titles in `explorechimp/index.ts` (stable step id alignment). */ private isExploreChimpAnalyticsStepTitle; /** * Playwright `test.step` wrappers used by ExploreChimp / markScreenState. Nested `pw:api` calls (e.g. axe * internals) must not inherit these titles for ingestion — that produced dozens of duplicate step rows per * checkpoint. Those wrappers are also omitted as "enclosing" steps for generic pw:api description folding. */ private isExploreChimpSyntheticWrapperTitle; /** Nearest enclosing `test.step` that is not an ExploreChimp synthetic wrapper. */ private getInnermostEnclosingTestStepTitle; /** True if any ancestor `test.step` is ExploreChimp DOM/screenshot/etc. or ScreenState wait — suppress child pw:api rows. */ private hasExploreChimpSyntheticWrapperAncestor; private getStepDescription; private toPlaywrightError; } //# sourceMappingURL=testchimp-reporter.d.ts.map