import { PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestType } from "@playwright/test"; import { FoundrySetupConfig } from "./auth.js"; import { FoundryState } from "./state.js"; import { FoundryUI } from "./ui/index.js"; import { FoundryCanvas } from "./canvas.js"; import { FoundryPage } from "./types/index.js"; export interface SetupWorldHelpers { page: FoundryPage; state: FoundryState; ui: FoundryUI; canvas: FoundryCanvas; } export interface BaseWorldConfig extends FoundrySetupConfig { /** * Label for the base backup. Defaults to `fp-base-`. * On V14 this backup is created once and restored before every spec. * On V13 this label is unused; the world is recreated from scratch each spec. */ backupName?: string; /** * Callback that configures the world's initial state. * On V14 it runs once before the base backup is taken. * On V13 it runs before every spec (after the world is recreated). * Must be safe to call on a freshly created, empty world. */ setupWorld?: (helpers: SetupWorldHelpers) => Promise; /** * When true, a named backup is captured after each spec (V14 only). * Useful for post-mortem inspection on another Foundry instance. */ captureAfterSpec?: boolean; /** * Override the snapshot name for captureAfterSpec. * Receives the test title; defaults to `-`. */ captureNameFn?: (title: string) => string; /** * When true, the world is deleted in afterAll. Defaults to false — the * world (and its base backup) are left in place for reuse across runs. */ deleteAfterAll?: boolean; } type UseFoundryTest = TestType; /** * One-time: creates the base world backup from the current world state. * Call this after `foundrySetup` and any initial world configuration. * Skips silently if a backup with the same name already exists. */ export declare function createBaseWorldBackup(page: FoundryPage, config: BaseWorldConfig): Promise; /** * Restores the world to its base backup state and re-launches it. * The page will be on `/join` after this call; use `loginAs` to enter as a specific user. */ export declare function restoreBaseWorld(page: FoundryPage, config: BaseWorldConfig): Promise; /** * Captures a named snapshot of the current world state (V14 only, no-op on V13). * Useful for post-mortem inspection: copy the backup to another Foundry instance. */ export declare function captureWorldSnapshot(page: FoundryPage, config: BaseWorldConfig, snapshotName: string): Promise; /** * Drop-in replacement for `useFoundry` that leverages Foundry's backup system. * * On **V14+**: * - `beforeAll`: creates the world once, runs `setupWorld`, takes the base backup * (skips creation if the backup already exists from a previous run). * - `beforeEach`: restores the base backup and re-launches the world, then logs in. * - `afterEach` (opt): captures a named snapshot when `captureAfterSpec` is true. * - `afterAll` (opt): deletes the world when `deleteAfterAll` is true. * * On **V13**: * - `beforeAll`: creates the world once and runs `setupWorld`. * - `beforeEach`: tears down and re-creates the world, runs `setupWorld` again, then logs in. * - `afterAll`: deletes the world. */ export declare function useBaseWorld(test: UseFoundryTest, config: BaseWorldConfig): void; export {};