import { AppBundleSource, AppSignalCb } from "@holochain/client"; import { Conductor } from "./conductor.js"; import { AgentHappOptions, HappBundleOptions, IPlayer, IScenario } from "../types.js"; /** * A player tied to a {@link Conductor}. * * @public */ export interface Player extends IPlayer { conductor: Conductor; } /** * Options when creating a scenario. * * @public */ export interface ScenarioOptions { timeout?: number; } /** * An abstraction of a test scenario to write tests against Holochain hApps, * running on a local conductor. * * @public */ export declare class Scenario implements IScenario { private timeout; uid: string; conductors: Conductor[]; /** * Scenario constructor. * * @param options - Timeout for requests to Admin and App API calls. */ constructor(options?: ScenarioOptions); /** * Create and add a conductor to the scenario. * * @param signalHandler - A callback function to handle signals. * @returns The newly added conductor instance. */ addConductor(signalHandler?: AppSignalCb): Promise; /** * Create and add a single player to the scenario, with a set of DNAs * installed. * * @param agentHappOptions - {@link AgentHappOptions}. * @returns A local player instance. */ addPlayerWithHapp(agentHappOptions: AgentHappOptions): Promise; /** * Create and add multiple players to the scenario, with a set of DNAs * installed for each player. * * @param agentHappOptions - {@link AgentHappOptions} for each player. * @returns An array with the added players. */ addPlayersWithHapps(agentHappOptions: AgentHappOptions[]): Promise; /** * Create and add a single player to the scenario, with a hApp bundle * installed. * * @param appBundleSource - The bundle or path to the bundle. * @param options - {@link HappBundleOptions} plus a signal handler * (optional). * @returns A local player instance. */ addPlayerWithHappBundle(appBundleSource: AppBundleSource, options?: HappBundleOptions & { signalHandler?: AppSignalCb; }): Promise; /** * Create and add multiple players to the scenario, with a hApp bundle * installed for each player. * * @param playersHappBundles - An array with a hApp bundle for each player, * and a signal handler (optional). * @returns */ addPlayersWithHappBundles(playersHappBundles: Array<{ appBundleSource: AppBundleSource; options?: HappBundleOptions & { signalHandler?: AppSignalCb; }; }>): Promise; /** * Register all agents of all passed in conductors to each other. This skips * peer discovery through gossip and thus accelerates test runs. * * @public */ shareAllAgents(): Promise; /** * Shut down all conductors in the scenario. */ shutDown(): Promise; /** * Shut down and delete all conductors in the scenario. */ cleanUp(): Promise; } /** * A wrapper function to create and run a scenario. A scenario is created * and all involved conductors are shut down and cleaned up after running. * * @param testScenario - The test to be run. * @param cleanUp - Whether to delete conductors after running. @defaultValue true * * @public */ export declare const runScenario: (testScenario: (scenario: Scenario) => Promise, cleanUp?: boolean, options?: ScenarioOptions) => Promise;