/**
 * Copyright (c) Microsoft Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { EventEmitter } from 'events';
import { ModalState } from './tool';
import type { Context, ContextConfig } from './context';
import type * as playwright from '../../..';
type TabEventsInterface = {};
type Download = {
    download: playwright.Download;
    finished: boolean;
    outputFile: string;
};
type ConsoleLogEntry = {
    type: 'console';
    wallTime: number;
    message: ConsoleMessage;
};
type DownloadStartLogEntry = {
    type: 'download-start';
    wallTime: number;
    download: Download;
};
type DownloadFinishLogEntry = {
    type: 'download-finish';
    wallTime: number;
    download: Download;
};
type RequestLogEntry = {
    type: 'request';
    wallTime: number;
    request: playwright.Request;
};
type EventEntry = ConsoleLogEntry | DownloadStartLogEntry | DownloadFinishLogEntry | RequestLogEntry;
export type TabHeader = {
    title: string;
    url: string;
    current: boolean;
    console: {
        total: number;
        warnings: number;
        errors: number;
    };
};
type TabSnapshot = {
    ariaSnapshot: string;
    modalStates: ModalState[];
    events: EventEntry[];
    consoleLink?: string;
};
export declare class Tab extends EventEmitter<TabEventsInterface> {
    readonly context: Context;
    readonly page: playwright.Page;
    private _lastHeader;
    private _downloads;
    private _requests;
    private _onPageClose;
    private _modalStates;
    private _initializedPromise;
    private _recentEventEntries;
    private _consoleLog;
    private _disposables;
    readonly actionTimeoutOptions: {
        timeout?: number;
    };
    readonly navigationTimeoutOptions: {
        timeout?: number;
    };
    readonly expectTimeoutOptions: {
        timeout?: number;
    };
    constructor(context: Context, page: playwright.Page, onPageClose: (tab: Tab) => void);
    dispose(): Promise<void>;
    static forPage(page: playwright.Page): Tab | undefined;
    static collectConsoleMessages(page: playwright.Page): Promise<ConsoleMessage[]>;
    private _initialize;
    modalStates(): ModalState[];
    setModalState(modalState: ModalState): void;
    clearModalState(modalState: ModalState): void;
    private _dialogShown;
    private _downloadStarted;
    private _clearCollectedArtifacts;
    private _resetLogs;
    private _handleRequest;
    private _handleResponse;
    private _handleRequestFailed;
    private _handleConsoleMessage;
    private _addLogEntry;
    private _onClose;
    headerSnapshot(): Promise<TabHeader & {
        changed: boolean;
    }>;
    isCurrentTab(): boolean;
    waitForLoadState(state: 'load', options?: {
        timeout?: number;
    }): Promise<void>;
    checkUrlAndNavigate(url: string): Promise<string>;
    navigate(url: string): Promise<void>;
    consoleMessageCount(): Promise<{
        total: number;
        errors: number;
        warnings: number;
    }>;
    consoleMessages(level: ConsoleMessageLevel, all?: boolean): Promise<ConsoleMessage[]>;
    clearConsoleMessages(): Promise<void>;
    requests(): Promise<playwright.Request[]>;
    clearRequests(): Promise<void>;
    captureSnapshot(root: playwright.Locator | undefined, depth: number | undefined, boxes: boolean | undefined, relativeTo: string | undefined): Promise<TabSnapshot>;
    private _javaScriptBlocked;
    private _raceAgainstModalStates;
    waitForCompletion(callback: () => Promise<void>): Promise<void>;
    targetLocator(params: {
        element?: string;
        target: string;
    }): Promise<{
        locator: playwright.Locator;
        resolved: string;
    }>;
    targetLocators(params: {
        element?: string;
        target: string;
    }[]): Promise<{
        locator: playwright.Locator;
        resolved: string;
    }[]>;
    waitForTimeout(time: number): Promise<void>;
}
export type ConsoleMessage = {
    type: ReturnType<playwright.ConsoleMessage['type']>;
    timestamp: number;
    text: string;
    toString(): string;
};
export declare function renderModalStates(config: ContextConfig, modalStates: ModalState[]): string[];
type ConsoleMessageType = ReturnType<playwright.ConsoleMessage['type']>;
type ConsoleMessageLevel = 'error' | 'warning' | 'info' | 'debug';
export declare function shouldIncludeMessage(thresholdLevel: ConsoleMessageLevel | undefined, type: ConsoleMessageType): boolean;
export {};
//# sourceMappingURL=tab.d.ts.map