import { Page, Frame, Locator, ElementHandle, PageScreenshotOptions, LocatorScreenshotOptions } from '@playwright/test';
import { StabilizationPluginOptions, ViewportOption } from '@argos-ci/browser';
import { ScreenshotMetadata } from '@argos-ci/util';

type ArgosAttachment = {
    name: string;
    contentType: string;
    path: string;
};

type LocatorOptions$1 = Parameters<Page["locator"]>[1];
type ArgosSnapshotOptions = {
    /**
     * `Locator` or string selector of the element to take a snapshot of.
     */
    element?: string | Locator;
    /**
     * Folder where the snapshots will be saved if not using the Argos reporter.
     * @default "./screenshots"
     */
    root?: string;
    /**
     * Wait for the UI to stabilize before taking the snapshot.
     * Set to `false` to disable stabilization.
     * Pass an object to customize the stabilization.
     * @default true
     */
    stabilize?: boolean | StabilizationPluginOptions;
    /**
     * Maximum time in milliseconds. Defaults to `0` - no timeout
     */
    timeout?: number;
} & LocatorOptions$1;
/**
 * Stabilize the UI and takes a snapshot of the application under test.
 *
 * @example
 *    argosAriaSnapshot(page, "my-screenshot")
 * @see https://playwright.dev/docs/aria-snapshots
 */
declare function argosAriaSnapshot(
/**
 * Playwright `page` or `frame` object.
 */
handler: Page | Frame, 
/**
 * Name of the snapshot. Must be unique.
 */
name: string, 
/**
 * Options for the snapshot.
 */
options?: ArgosSnapshotOptions): Promise<ArgosAttachment[]>;

type LocatorOptions = Parameters<Page["locator"]>[1];
type ScreenshotOptions<TBase extends PageScreenshotOptions | LocatorScreenshotOptions> = Omit<TBase, "encoding" | "type" | "omitBackground" | "path">;
type ArgosScreenshotOptions = {
    /**
     * `Locator` or string selector of the element to take a screenshot of.
     * Passing an `ElementHandle` is discouraged, use a `Locator` instead.
     */
    element?: string | ElementHandle | Locator;
    /**
     * Viewports to take screenshots of.
     */
    viewports?: ViewportOption[];
    /**
     * Capture an ARIA snapshot along with the screenshot.
     * Each ARIA snapshot counts as an additional screenshot for billing.
     * When using the viewports setting, one ARIA snapshot is taken per viewport.
     * @see https://playwright.dev/docs/aria-snapshots#aria-snapshots
     * @default false
     */
    ariaSnapshot?: boolean;
    /**
     * Custom CSS evaluated during the screenshot process.
     */
    argosCSS?: string;
    /**
     * Disable hover effects by moving the mouse to the top-left corner of the document.
     * @default true
     */
    disableHover?: boolean;
    /**
     * Sensitivity threshold between 0 and 1.
     * The higher the threshold, the less sensitive the diff will be.
     * @default 0.5
     */
    threshold?: number;
    /**
     * Folder where the screenshots will be saved if not using the Argos reporter.
     * @default "./screenshots"
     */
    root?: string;
    /**
     * Wait for the UI to stabilize before taking the screenshot.
     * Set to `false` to disable stabilization.
     * Pass an object to customize the stabilization.
     * @default true
     */
    stabilize?: boolean | StabilizationPluginOptions;
    /**
     * Run a function before taking the screenshot.
     * When using viewports, this function will run before taking sreenshots on each viewport.
     */
    beforeScreenshot?: (api: {
        /**
         * Run Argos stabilization alorithm.
         * Accepts an object to customize the stabilization.
         * Note that this function is independent of the `stabilize` option.
         */
        runStabilization: (options?: StabilizationPluginOptions) => Promise<void>;
    }) => Promise<void> | void;
    /**
     * Run a function after taking the screenshot.
     * When using viewports, this function will run after taking sreenshots on each viewport.
     */
    afterScreenshot?: () => Promise<void> | void;
} & LocatorOptions & ScreenshotOptions<LocatorScreenshotOptions> & ScreenshotOptions<PageScreenshotOptions>;
/**
 * Stabilize the UI and takes a screenshot of the application under test.
 *
 * @example
 *    argosScreenshot(page, "my-screenshot")
 * @see https://argos-ci.com/docs/playwright#api-overview
 */
declare function argosScreenshot(
/**
 * Playwright `page` or `frame` object.
 */
handler: Page | Frame, 
/**
 * Name of the screenshot. Must be unique.
 */
name: string, 
/**
 * Options for the screenshot.
 */
options?: ArgosScreenshotOptions): Promise<ArgosAttachment[]>;

/**
 * Get the CSP script hash.
 */
declare function getCSPScriptHash(): string;

type MetadataConfig = {
    sdk: ScreenshotMetadata["sdk"];
    playwrightLibraries: string[];
    url?: string;
    test?: ScreenshotMetadata["test"];
    viewport?: ScreenshotMetadata["viewport"];
};
/**
 * Set the metadata config.
 */
declare function setMetadataConfig(metadata: MetadataConfig): void;

export { type ArgosAttachment, type ArgosScreenshotOptions, type ArgosSnapshotOptions, setMetadataConfig as DO_NOT_USE_setMetadataConfig, type MetadataConfig, argosAriaSnapshot, argosScreenshot, getCSPScriptHash };
