/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License", destination); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * https://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. */ /** * Context information for debugging ExTester errors. */ export interface ErrorContext { /** Name of the page object component (e.g., "TextEditor", "ActivityBar") */ component?: string; /** The action being performed when the error occurred */ action?: string; /** VS Code version being tested */ vscodeVersion?: string; /** String representation of the locator used */ locator?: string; /** Additional details about the element or operation */ details?: string; /** The original error that caused this error, if any */ cause?: Error; } /** * Base error class for all ExTester-specific errors. * Provides rich context for debugging test failures. */ export declare class ExTesterError extends Error { readonly context: ErrorContext; readonly timestamp: Date; constructor(message: string, context?: ErrorContext); /** * Get a detailed string representation of the error for logging. */ toDetailedString(): string; toString(): string; } /** * Error thrown when an element cannot be found in the DOM. */ export declare class ElementNotFoundError extends ExTesterError { constructor(message: string, context?: ErrorContext); } /** * Error thrown when an element exists but is not visible. */ export declare class ElementNotVisibleError extends ExTesterError { constructor(message: string, context?: ErrorContext); } /** * Error thrown when an element cannot be interacted with (e.g., blocked, disabled). */ export declare class ElementNotInteractableError extends ExTesterError { constructor(message: string, context?: ErrorContext); } /** * Error thrown when an element reference has become stale (DOM was modified). */ export declare class StaleElementError extends ExTesterError { constructor(message: string, context?: ErrorContext); } /** * Error thrown when element recovery/reinitialization fails. */ export declare class ElementRecoveryError extends ExTesterError { constructor(message: string, context?: ErrorContext); } /** * Error thrown when a timeout occurs waiting for a condition. */ export declare class TimeoutError extends ExTesterError { readonly timeoutMs: number; constructor(message: string, timeoutMs: number, context?: ErrorContext); toDetailedString(): string; } /** * Error thrown when a locator fails to match any elements. */ export declare class LocatorError extends ExTesterError { constructor(message: string, context?: ErrorContext); } /** * Error thrown for platform-specific limitations (e.g., macOS native dialogs). */ export declare class PlatformNotSupportedError extends ExTesterError { readonly platform: string; constructor(message: string, platform?: string, context?: ErrorContext); toDetailedString(): string; } /** * Error thrown when an operation is not supported for the current VS Code version. */ export declare class VersionNotSupportedError extends ExTesterError { readonly requiredVersion: string; readonly currentVersion: string; constructor(message: string, requiredVersion: string, currentVersion: string, context?: ErrorContext); toDetailedString(): string; } /** * Utility to wrap native Selenium errors with ExTester context. */ export declare function wrapError(originalError: Error, context: ErrorContext): ExTesterError;