import type { Locator, Page, TestInfo } from '@playwright/test'; import type { Observed } from './evidence.js'; import type { RasterStore, Renderer } from '@variance-authority/raster'; import type { MaterializationOptions, VarianceOptions } from './options.js'; import { type ExecutionRecording } from './execution.js'; import { type VarianceRun } from './run.js'; export interface CreateVarianceOptions { /** Defaults to `.variance/baselines`. */ readonly baselines?: string; /** * Where each baseline goes under `baselines`, as `baselines.path` in the * config spells it. Defaults to `{title}/{name}-{engine}`. */ readonly baselinePath?: string; /** Supply an existing renderer when the suite already owns its lifetime. */ readonly renderer?: Renderer; /** Supply an existing store when baselines do not live in a directory. */ readonly store?: RasterStore; /** Override only when the suite deliberately builds its own page agent. */ readonly bundle?: string; /** Defaults to deferred document rendering. */ readonly materialization?: MaterializationOptions; /** * Record what this session's page executed, for the next run's `--since`. * * Off by default. The application must be built with `testSelectionProbes()` * from `@variance-authority/sense/journal`; without a collector in the page * the session says so on stderr and records nothing. */ readonly tests?: boolean | ExecutionRecording; /** * Directory to write the compared images into, for every subject a person * would stop on -- `changed` and `ignored`. * * Off by default, and off is a real choice: the images are the largest thing a * run can produce, and a suite that reads the verdict in CI and never opens a * picture should not pay for one. On, the observation says where they went. */ readonly evidence?: string; } export interface DirectObservationOptions extends VarianceOptions { /** Defaults to `.variance/baselines`. */ readonly baselines?: string; /** * Where each baseline goes under `baselines`, as `baselines.path` in the * config spells it. Defaults to `{title}/{name}-{engine}`. */ readonly baselinePath?: string; /** Defaults to deferred document rendering. */ readonly materialization?: MaterializationOptions; /** * Record what this observation executed. Off by default. * * One-shot: the session it opens closes immediately, so each call merges the * index once. A test with several observations should hold a * {@link createVariance} session instead and pay that once. */ readonly tests?: boolean | ExecutionRecording; /** * Directory to write the compared images into, for every subject a person * would stop on -- `changed` and `ignored`. * * Off by default, and off is a real choice: the images are the largest thing a * run can produce, and a suite that reads the verdict in CI and never opens a * picture should not pay for one. On, the observation says where they went. */ readonly evidence?: string; } export interface VarianceSession { readonly observe: (locator: Locator, options?: VarianceOptions) => Promise; readonly close: () => Promise; } /** * Add Variance to the Page and TestInfo the suite already owns. * * This is deliberately a helper rather than an exported `test`: an extension * must not make every existing fixture and matcher route through this package. * Callers with several observations may keep the returned renderer alive for * the test and close it once; the one-shot {@link observe} does that lifecycle * automatically. */ export declare function createVariance(page: Page, within: TestInfo | VarianceRun, options?: CreateVarianceOptions): Promise; /** Observe one locator without extending or replacing Playwright's test API. */ export declare function observe(page: Page, locator: Locator, within: TestInfo | VarianceRun, options?: DirectObservationOptions): Promise; //# sourceMappingURL=direct.d.ts.map