/** * @file * * Captures a screenshot of the Obsidian instance the current test context is * already driving. * * The transport-level `captureScreenshot` needs a transport in hand, which a * test running under the harness's global setup never has — the instance is * owned by that setup and reached through the context provider. This is the * context-resolving entry point, the screenshot counterpart of * `evalInObsidian` / `pollInObsidian`: with no arguments at all it captures * whatever instance the active project is driving, desktop or mobile. * * It also makes the frame REPRODUCIBLE before taking it, by hiding the vault's * name — see `hide-vault-name.ts` for why a `temp-vault-` bleeds * through the caption band and rewrites a checked-in PNG on every run. */ import type { ObsidianTransport } from './transport.cjs'; /** * Options for {@link captureObsidianScreenshot}. */ export interface CaptureObsidianScreenshotOptions { /** * The exact height in pixels the captured image should have. * * Desktop only, and only meaningful together with {@link widthInPixels}. * Ignored on mobile, where the image is always the device's native * framebuffer — size those by choosing an AVD with the wanted screen * geometry. */ readonly heightInPixels?: number; /** * Whether to hide the vault's name before capturing, so the frame does not * depend on the random suffix of the harness's temporary vault. * * A default rather than a knob: reproducibility is what a checked-in * screenshot is for, and the row it collapses sits under the caption band, * so nothing a reader sees moves. Turn it off only to photograph the vault * switcher itself. * * @default `true` */ readonly shouldHideVaultName?: boolean; /** * Override the transport. When omitted, the transport the current test * context is driving is used. */ readonly transport?: ObsidianTransport; /** * The vault path to capture. When omitted, the current test context's vault * is used. */ readonly vaultPath?: string; /** * The exact width in pixels the captured image should have. * * See {@link heightInPixels} — the two are set together or not at all. */ readonly widthInPixels?: number; } /** * Captures a PNG screenshot of the running Obsidian instance, resolving the * transport and vault from the current test context. * * The vault's name is hidden first, so two runs of the same suite against two * differently-named temporary vaults produce byte-identical PNGs. Pass * {@link CaptureObsidianScreenshotOptions.shouldHideVaultName} as `false` to * photograph it. * * @param options - Optional size, transport and vault overrides. * @returns A {@link Promise} that resolves to the raw PNG bytes. * @throws Error if the active transport cannot capture screenshots. */ export declare function captureObsidianScreenshot(options?: CaptureObsidianScreenshotOptions): Promise;