web-snaps
Version:
Browser automation with automatic snapshotting.
44 lines (43 loc) • 1.4 kB
TypeScript
import { type PartialWithUndefined } from '@augment-vir/common';
import { type Page } from 'rebrowser-playwright';
import { type LoadedBrowser } from '../browser/loaded-browser.js';
import { type WebFlow } from './web-flow.js';
/**
* Options for {@link runWebFlow}.
*
* @category Internal
*/
export type RunWebFlowOptions = PartialWithUndefined<{
/**
* Disable logging. Errors will still be logged.
*
* @default false
*/
silent: boolean;
/**
* Disable all phase snapshots, even when a phase has `takeSnapshot` set to `true`.
*
* @default false
*/
disableSnapshots: boolean;
/** Path to the directory that phase snapshots will be saved to. */
webSnapDirPath: string;
/** A page that you want to use instead of creating a new one internally. */
existingPage: Page;
}>;
/**
* Params for {@link runWebFlow}.
*
* @category Internal
*/
export type RunWebFlowParams<Context, Output> = {
browserParams: Readonly<LoadedBrowser<Context>>;
webFlow: Readonly<WebFlow<Context, Output>>;
options?: Readonly<RunWebFlowOptions> | undefined;
};
/**
* Run a single {@link WebFlow}. A browser must already be loaded beforehand.
*
* @category Internal
*/
export declare function runWebFlow<Context, Output>({ browserParams, webFlow, options, }: Readonly<RunWebFlowParams<Context, Output>>): Promise<(undefined | Output)[]>;