import { Effect } from 'effect'; import type { CommandDefinition } from '../command/index.js'; import type { File } from '../file/index.js'; import type { Document, Html, KeyboardModifiers } from '../html/index.js'; import type { MountDefinition } from '../mount/index.js'; import type { VNode } from '../vdom.js'; import type { AnyCommand, AnyMount, CommandMatcher, MountMatcher, MountResolver, PendingMount, Resolver } from './internal.js'; import type { Locator, LocatorAll } from './query.js'; export type { AnyCommand, AnyMount, MountMatcher, MountResolver, PendingMount, Resolver, }; export { find, findAll, textContent, attr, getByRole, getAllByRole, getByText, getByPlaceholder, getByLabel, getByAltText, getByTitle, getByTestId, getByDisplayValue, role, placeholder, label, altText, title, testId, displayValue, selector, text, within, getAllByText, getAllByLabel, getAllByPlaceholder, getAllByAltText, getAllByTitle, getAllByTestId, getAllByDisplayValue, first, last, nth, filter, } from './query.js'; export type { Locator, LocatorAll } from './query.js'; /** Multi-match Locator factories. Each returns a `LocatorAll` that resolves * to every matching VNode. Convert to a single `Locator` via `first`, * `last`, or `nth(n)`, or narrow via `filter`. */ export declare const all: { readonly role: (roleValue: string, options?: Readonly<{ name?: string | RegExp; level?: number; checked?: boolean | "mixed"; selected?: boolean; pressed?: boolean | "mixed"; expanded?: boolean; disabled?: boolean; }>) => LocatorAll; readonly text: (target: string, options?: Readonly<{ exact?: boolean; }>) => LocatorAll; readonly label: (labelValue: string) => LocatorAll; readonly placeholder: (placeholderValue: string) => LocatorAll; readonly altText: (altValue: string) => LocatorAll; readonly title: (titleValue: string) => LocatorAll; readonly testId: (testIdValue: string) => LocatorAll; readonly displayValue: (valueString: string) => LocatorAll; readonly selector: (css: string) => LocatorAll; }; export { sceneMatchers } from './matchers.js'; /** An immutable test simulation that includes the rendered VNode tree. * The Model and Message are intentionally opaque. Scene tests assert * through the view, not the model. Use Story for model-level assertions. */ export type SceneSimulation = Readonly<{ /** @internal Phantom type that preserves Model and Message for step chain inference. */ _phantom: [Model, Message]; commands: ReadonlyArray; mounts: ReadonlyArray; outMessage: OutMessage; html: VNode; }>; /** A callable step that sets the initial Model. Carries phantom type for compile-time validation. */ type WithStep = Readonly<{ _phantomModel: Model; }> & ((simulation: SceneSimulation) => SceneSimulation); /** A single step in a scene: either a `with` step or a scene simulation transform. */ export type SceneStep = WithStep> | ((simulation: SceneSimulation) => SceneSimulation); /** A typed Command instance carrying the result Message type via its * `effect` field, so passing `FetchWeather({ zipCode })` to `Scene.Command.resolve` * preserves the link between the Command and its declared result Message. */ type SceneCommandInstance = Readonly<{ name: string; args?: Record; effect: Effect.Effect; }>; /** Sets the initial Model for a scene test. */ export { with_ as with }; declare const with_: (model: Model) => WithStep; /** Steps that operate on the pending Commands of a scene simulation. * Destructure as `const { Command } = Scene` for concise call sites. */ export declare const Command: { /** Resolves a specific pending Command with the given result Message. */ readonly resolve: { (definition: CommandDefinition, resultMessage: ResultMessage): (simulation: SceneSimulation) => SceneSimulation; (definition: CommandDefinition, resultMessage: ResultMessage, toParentMessage: (message: ResultMessage) => ParentMessage): (simulation: SceneSimulation) => SceneSimulation; (instance: SceneCommandInstance, resultMessage: ResultMessage): (simulation: SceneSimulation) => SceneSimulation; (instance: SceneCommandInstance, resultMessage: ResultMessage, toParentMessage: (message: ResultMessage) => ParentMessage): (simulation: SceneSimulation) => SceneSimulation; }; /** Resolves listed Commands with their result Messages, cascading through any * Commands the result produces. Each entry resolves exactly one matching * dispatch in declaration order; compose with `Array.makeBy` for N * identical responses. Resolvers carry across calls; a new entry replaces * any leftovers sharing its Definition or Instance shape (latest wins). */ readonly resolveAll: >(...resolvers: { [K in keyof R]: Resolver; }) => (simulation: SceneSimulation) => SceneSimulation; /** Asserts that every given Command is among the pending Commands. */ readonly expectHas: (...matchers: ReadonlyArray) => (simulation: SceneSimulation) => SceneSimulation; /** Asserts that the pending Commands match the given definitions exactly (order-independent). */ readonly expectExact: (...matchers: ReadonlyArray) => (simulation: SceneSimulation) => SceneSimulation; /** Asserts that there are no pending Commands. */ readonly expectNone: () => (simulation: SceneSimulation) => SceneSimulation; }; /** Steps that operate on the pending Mounts of a scene simulation. * Destructure as `const { Mount } = Scene` for concise call sites. */ export declare const Mount: { /** Resolves a specific pending Mount with the given result Message. */ readonly resolve: { (matcher: MountDefinition | AnyMount, resultMessage: ResultMessage): (simulation: SceneSimulation) => SceneSimulation; (matcher: MountDefinition | AnyMount, resultMessage: ResultMessage, toParentMessage: (message: ResultMessage) => ParentMessage): (simulation: SceneSimulation) => SceneSimulation; }; /** Resolves all listed Mounts with their result Messages. */ readonly resolveAll: >(...resolvers: { [K in keyof R]: MountResolver; }) => (simulation: SceneSimulation) => SceneSimulation; /** Asserts that every given Mount is among the pending Mounts. */ readonly expectHas: (...matchers: ReadonlyArray) => (simulation: SceneSimulation) => SceneSimulation; /** Asserts that the pending Mounts match the given definitions exactly (order-independent, by name). */ readonly expectExact: (...matchers: ReadonlyArray) => (simulation: SceneSimulation) => SceneSimulation; /** Asserts that there are no pending Mounts. */ readonly expectNone: () => (simulation: SceneSimulation) => SceneSimulation; /** Acknowledges Mounts that disappeared from the rendered tree. Required for * every Mount that fires and then unmounts during a scene. */ readonly expectEnded: (...matchers: ReadonlyArray) => (simulation: SceneSimulation) => SceneSimulation; }; /** Runs a function for side effects (e.g. assertions) without breaking the step chain. */ export declare const tap: (f: (simulation: SceneSimulation) => void) => (simulation: SceneSimulation) => SceneSimulation; /** Scopes a sequence of steps to a parent element. Every Locator referenced by * child steps (assertions, interactions) resolves within the parent's subtree. * Use this when several steps share the same scope. For a single scoped query, * prefer `within(parent, child)` directly. Nested `inside` calls compose scopes * via `within(outer, inner)`. */ export declare const inside: (parent: Locator, ...steps: ReadonlyArray>>) => (simulation: SceneSimulation) => SceneSimulation; /** Simulates a click on the element matching the target. * When the element has no click handler, the event bubbles up to the * nearest ancestor with one, mirroring browser event propagation. * When the element is a submit button (`