import { Locator, Page } from "@playwright/test"; import { TestEngine, TestEnvironment } from "@accesslint/core"; //#region ../matchers-internal/dist/audit.d.ts //#region src/audit.d.ts type Impact = "critical" | "serious" | "moderate" | "minor"; /** * Option shape shared between matcher packages. Packages extend this with * platform-specific fields — e.g. jest/vitest add `additionalRules` (which * requires the Node-DOM runner), Playwright adds `includeFrames` / * `includeShadowDom`. */ interface BaseAccessibleMatcherOptions { /** Rule IDs to disable for this assertion. */ disabledRules?: string[]; /** Include AAA-level rules (excluded by default). */ includeAAA?: boolean; /** * Skip page-level rules (html-has-lang, document-title, landmarks, etc.) * that don't apply to components rendered in isolation. */ componentMode?: boolean; /** Locale for translated rule messages (e.g. "en", "es"). */ locale?: string; /** * Minimum impact that causes the assertion to fail. * Violations below the threshold are ignored. */ failOn?: Impact; } //#endregion //#region src/audit.d.ts interface AccessibleMatcherOptions extends BaseAccessibleMatcherOptions { /** Also audit iframe content. Defaults to true for Page targets. */ includeFrames?: boolean; /** Also audit shadow DOM content. Defaults to true. */ includeShadowDom?: boolean; } interface AuditViolation { ruleId: string; selector: string; html: string; impact: Impact; message: string; } interface AuditResult { url: string; timestamp: number; testEngine: TestEngine; testEnvironment: TestEnvironment; violations: AuditViolation[]; ruleCount: number; skippedRules: { ruleId: string; error: string; }[]; } declare function accesslintAudit(target: Page | Locator, options?: AccessibleMatcherOptions): Promise; /** * Format an audit violation into the shared failure-message block used across * @accesslint/jest, @accesslint/vitest, and @accesslint/playwright. * * Adapts the Playwright `AuditViolation` shape (which doesn't carry `element` * or structured `fix` fields — those are stripped when the audit result * crosses the page boundary) to the `Violation` shape that the shared * formatter expects. */ declare function formatViolation(v: AuditViolation): string; //#endregion //#region src/matchers.d.ts interface SnapshotMatcherOptions extends AccessibleMatcherOptions { /** Name for the snapshot file (e.g. "homepage"). */ snapshot?: string; /** Directory to store snapshot files. Defaults to `{cwd}/accessibility-snapshots/`. */ snapshotDir?: string; /** * Capture per-violation PNG screenshots alongside the baseline so the * "likely moved" failure hint can show visual context. Defaults to true. */ visualSnapshots?: boolean; } declare function toBeAccessible(target: Page | Locator, options?: SnapshotMatcherOptions): Promise<{ pass: boolean; name: string; message: () => string; }>; declare const accesslintMatchers: { toBeAccessible: typeof toBeAccessible; }; //#endregion //#region ../matchers-internal/dist/snapshot-CRp4f8xk.d.ts //#endregion //#region src/snapshot.d.ts interface SnapshotViolation { ruleId: string; selector: string; anchor?: string; role?: string; visualFingerprint?: string; screenshotPath?: string; htmlFingerprint?: string; relativeLocation?: string; tag?: string; } //#endregion //#region src/index.d.ts declare global { namespace PlaywrightTest { interface Matchers { toBeAccessible(options?: SnapshotMatcherOptions): Promise; } } } //#endregion export { type AccessibleMatcherOptions, type AuditResult, type AuditViolation, type SnapshotMatcherOptions, type SnapshotViolation, accesslintAudit, accesslintMatchers, formatViolation, toBeAccessible };