import * as playwright_test from 'playwright/test';
import { BrowserContext } from '@playwright/test';
import { C as CurrentsConfig } from './config-C8B7-S4r.js';
export { a as ConsoleOutputPreset, O as OrchestrationStatus } from './config-C8B7-S4r.js';
import { Reporter, FullConfig, TestCase, TestResult, Suite, TestError, TestStep, FullResult } from '@playwright/test/reporter';

type GhaEventData = {
    headRef: string;
    headSha: string;
    baseRef: string;
    baseSha: string;
    issueUrl: string;
    htmlUrl: string;
    prTitle: string;
    senderAvatarUrl: string;
    senderHtmlUrl: string;
};
type Commit = {
    sha: string;
    branch: string;
    authorName: string;
    authorEmail: string;
    message: string;
    remoteOrigin: string;
    defaultBranch: null;
    ghaEventData?: GhaEventData;
};

declare const OPS: {
    readonly EQ: "eq";
    readonly NEQ: "neq";
    readonly IN: "in";
    readonly NOTIN: "notIn";
    readonly ANY: "any";
    readonly EMPTY: "empty";
    readonly INC: "inc";
    readonly NOTINC: "notInc";
    readonly INCALL: "incAll";
    readonly NOTINCALL: "notIncAll";
};
type OP = (typeof OPS)[keyof typeof OPS];
declare const ACTION_TYPE: {
    readonly SKIP: "skip";
    readonly QUARANTINE: "quarantine";
    readonly TAG: "tag";
};
type ACTION_TYPE = (typeof ACTION_TYPE)[keyof typeof ACTION_TYPE];

type RuleSkipAction = {
    op: Extract<RuleActionType, "skip">;
    details?: null;
};
type RuleQuarantineAction = {
    op: Extract<RuleActionType, "quarantine">;
    details?: null;
};
type RuleTagAction = {
    op: Extract<RuleActionType, "tag">;
    details: {
        tags: string[];
    };
};
type RuleAction = RuleSkipAction | RuleQuarantineAction | RuleTagAction;
type RuleCombinator = "AND" | "OR";
type RuleCondOperator = OP;
type RuleActionType = ACTION_TYPE;
type RegexPattern = {
    type: "RegexPattern";
    pattern: string;
};
type DateRange = {
    type: "DateRange";
    inclusive: boolean;
    start: Date;
    end: Date;
};
type ConditionComplexValue = RegexPattern | DateRange;
type ConditionPrimitiveValue = string | string[];
type RuleMatcherValue = ConditionPrimitiveValue | ConditionComplexValue[] | null;
type RuleMatcherCondExactSingleValue = {
    op: Exclude<RuleCondOperator, "inc" | "notInc" | "incAll" | "notIncAll">;
    value: Exclude<RuleMatcherValue, ConditionComplexValue[]>;
    type: "testId" | "project";
};
type RuleMatcherCondComplexSingleValue = {
    op: Exclude<RuleCondOperator, "inc" | "notInc" | "incAll" | "notIncAll">;
    value: RuleMatcherValue;
    type: "title" | "file" | "git_branch" | "git_authorName" | "git_authorEmail" | "git_remoteOrigin" | "git_message";
};
type RuleMatcherCondComplexMultipleValue = {
    op: RuleCondOperator;
    value: RuleMatcherValue;
    type: "error_message" | "titlePath" | "annotation";
};
type RuleMatcherCondExactMultipleValue = {
    op: RuleCondOperator;
    value: Exclude<RuleMatcherValue, ConditionComplexValue[]>;
    type: "tag";
};
type RuleMatcherCond = RuleMatcherCondExactSingleValue | RuleMatcherCondComplexSingleValue | RuleMatcherCondComplexMultipleValue | RuleMatcherCondExactMultipleValue;
type RuleMatcher = {
    cond: RuleMatcherCond[];
    op: RuleCombinator;
};
type BaseAction = {
    v: number;
    name: string;
    description?: string | null;
    action: RuleAction[];
    matcher: RuleMatcher;
};
type Action = BaseAction & {
    _id?: string;
    createdAt: Date;
    createdBy: string;
    updatedAt?: Date;
    updatedBy?: string;
    disabledAt?: Date;
    disabledBy?: string;
    archivedAt?: Date;
    archivedBy?: string;
    expiresAfter?: Date;
};

/**
 * Currents test fixtures for playwright test runner
 *
 * @property {Action[]} currentsActions - All the actions for your Currents project
 * @property {BrowserContext} context - The playwright browser context used for coverage
 *
 * @example
 * ```typescript
 * import { fixtures, CurrentsFixtures, CurrentsWorkerFixtures } from "@currents/playwright";
 * import { test as base } from "@playwright/test";
 *
 * export const test = base.extend<CurrentsFixtures, CurrentsWorkerFixtures>({...fixtures.baseFixtures, ...fixtures.coverageFixtures, ...fixtures.actionsFixtures});
 * ```
 */
type CurrentsFixtures = {
    currentsActions: Action[];
    context: BrowserContext;
    currentsBatchSize?: "auto" | number;
};
/**
 * Currents worker fixtures for playwright test runner
 *
 * @property {Partial<CurrentsConfig>} currentsConfig - The fully parsed Currents configuration
 * @property {Partial<CurrentsConfig>} currentsConfigOptions - Currents configuration provided through the playwright config
 * @property {boolean} currentsFixturesEnabled - Whether the Currents fixtures are enabled, defaults to true
 * @property {Commit} gitInfo - The git commit information if available
 *
 * @example
 * ```typescript
 * import { fixtures, CurrentsFixtures, CurrentsWorkerFixtures } from "@currents/playwright";
 * import { test as base } from "@playwright/test";
 *
 * export const test = base.extend<CurrentsFixtures, CurrentsWorkerFixtures>(fixtures.baseFixtures);
 * ```
 */
type CurrentsWorkerFixtures = {
    currentsConfig: Partial<CurrentsConfig>;
    currentsConfigOptions: Partial<CurrentsConfig>;
    currentsFixturesEnabled: boolean;
    gitInfo: Commit;
};

declare class DefaultReporter implements Reporter {
    private configLoader;
    private errors;
    private _testActor;
    private readonly startTime;
    private fullConfig;
    private remoteDebug;
    private orchestratedTaskReporterCompleteSent;
    /**
     * Output emitted before `onBegin` (e.g. `webServer` startup logs forwarded by
     * Playwright during global setup) arrives while `testActor` does not exist yet.
     * Buffer it and flush once the actor is initialized in `onBegin`.
     */
    private deferredOutput;
    constructor(reporterOptions?: Partial<CurrentsConfig>);
    printsToStdio(): boolean;
    version(): "v2";
    onConfigure(config: FullConfig): void;
    onStdOut(chunk: string | Buffer, test: void | TestCase, result: void | TestResult): void;
    onStdErr(chunk: string | Buffer, test: void | TestCase, result: void | TestResult): void;
    /** Supports v2 (`onBegin(suite)`) and published TS shape (`onBegin(config, suite)`). */
    onBegin(configOrSuite: FullConfig | Suite, suite?: Suite): void;
    private flushDeferredOutput;
    onError(error: TestError): void;
    onStepBegin(test: TestCase, result: TestResult, step: TestStep): void;
    onStepEnd(test: TestCase, result: TestResult, step: TestStep): void;
    onTestBegin(test: TestCase): void;
    onTestEnd(test: TestCase, result: TestResult): void;
    onEnd(fullResult: FullResult): Promise<FullResult | {
        status: "failed" | "passed";
    }>;
    private sendOrchestrationTaskReporterComplete;
    private onConfigLoaded;
    private get testActor();
    private isOr8nEventMode;
}

type CurrentsTestState = "failed" | "passed" | "pending" | "skipped";

type ProjectId = string;
type ExecutionJSONSummary = {
    runId: string | null;
    url: string | null;
    ciBuildId: string | null;
    discovery?: any;
    results: {
        tests: {
            overall: number;
            flaky: number;
            failed: number;
            skipped: number;
            passed: number;
        };
    };
    details: {
        projectId: ProjectId;
        url: string | null;
        specName: string;
        title: string[];
        status: CurrentsTestState;
        isFlaky: boolean;
        durationMs: number;
        attempts: {
            attemptIndex: number;
            status: string;
            errorMessage: string | null;
        }[];
    }[];
};

/**
 * Create {@link https://currents.dev/playwright | Currents Reporter} to be used with playwright test runner
 *
 * @augments CurrentsConfig
 * @param {CurrentsConfig} config - Currents Reporter {@link https://docs.currents.dev/integration-with-playwright/currents-playwright | configuration}
 * @returns {["@currents/playwright", CurrentsConfig]} a tuple of reporter name and config
 */
declare const currentsReporter: (config?: CurrentsConfig) => [string, CurrentsConfig];
/**
 * @namespace fixtures
 * @description Currents fixtures for playwright test runner
 */
declare const fixtures: {
    /**
     * Default Currents fixtures for playwright test runner
     *
     * @property {Partial<CurrentsConfig>} currentsConfig - The fully parsed Currents configuration
     * @property {Partial<CurrentsConfig>} currentsConfigOptions - Currents configuration provided through the playwright config
     * @property {boolean} currentsFixturesEnabled - Whether the Currents fixtures are enabled, defaults to true
     * @property {Commit} gitInfo - The git commit information if available
     *
     * @example
     * ```typescript
     * import { fixtures, CurrentsFixtures, CurrentsWorkerFixtures } from "@currents/playwright";
     * import { test as base } from "@playwright/test";
     *
     * export const test = base.extend<CurrentsFixtures, CurrentsWorkerFixtures>({...fixtures.baseFixtures, ...coverageFixtures});
     * ```
     */
    baseFixtures: playwright_test.Fixtures<CurrentsFixtures, CurrentsWorkerFixtures, playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
    /**
     * Coverage Fixtures for playwright test runner
     *
     * @property {BrowserContext} context - The playwright browser context used for coverage
     */
    coverageFixtures: playwright_test.Fixtures<CurrentsFixtures, CurrentsWorkerFixtures, playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
    /**
     * Currents Actions Fixtures for playwright test runner
     *
     * @property {Action[]} currentsActions - All the actions for your Currents project
     */
    actionFixtures: playwright_test.Fixtures<CurrentsFixtures, CurrentsWorkerFixtures, playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
};
/**
 * @namespace configHelpers
 * @description Currents configuration helpers
 */
declare const configHelpers: {
    /**
     * Include Currents wrappers by wrapping your `use` statements in this helper
     *
     * @param {Partial<CurrentsConfig>} config - Currents config to be used
     * @param {PlaywrightTestConfig["use"]} use - Your normal playwright `use` configuration
     * @returns {PlaywrightTestConfig["use"]} The playwright `use` configuration with Currents wrappers
     *
     * @example
     * ```typescript
     * import { configHelpers } from "@currents/playwright";
     * import { defineConfig, devices } from "@playwright/test";
     *
     *
     * const config = defineConfig({
     *   reporter: [currentsReporter({})],
     *
     *   use: configHelpers.includeCurrentsWrappers({}, {
     *     trace: "retain-on-failure-and-retries",
     *   }),
     *
     *   projects: [
     *     {
     *       name: "chromium",
     *       use: {
     *         ...devices["Desktop Chrome"],
     *       },
     *     },
     *   ],
     * });
     *
     * export default config;
     * ```
     */
    includeCurrentsWrappers: <T, W>(use?: playwright_test.PlaywrightTestConfig<T & CurrentsFixtures, W & CurrentsWorkerFixtures>["use"]) => (Partial<playwright_test.PlaywrightWorkerOptions & {}> & Partial<playwright_test.PlaywrightTestOptions & {}>) | undefined;
};

export { type Commit, CurrentsConfig, type CurrentsFixtures, type CurrentsWorkerFixtures, type ExecutionJSONSummary, configHelpers, currentsReporter, DefaultReporter as default, fixtures };
