/** * Step level hooks: BeforeStep / AfterStep. */ import { KeyValue, PlaywrightLocation, TestTypeCommon } from '../playwright/types'; import { BddAutoInjectFixtures } from '../runtime/bddTestFixturesAuto'; import { HookConstructorOptions } from './shared'; import { TagsExpression } from '../steps/tags'; type StepHookType = 'beforeStep' | 'afterStep'; type StepHookOptions = { name?: string; tags?: string; timeout?: number; }; type StepHookFixtures = BddAutoInjectFixtures & { [key: string]: unknown; }; type StepHookFn = (this: World, fixtures: Fixtures) => unknown; type StepHook = { type: StepHookType; options: StepHookOptions; fn: StepHookFn; tagsExpression?: TagsExpression; location: PlaywrightLocation; customTest?: TestTypeCommon; defaultTags?: string; worldFixture?: string; }; /** * When calling BeforeStep() / After() you can pass: * 1. hook fn * 2. tags string + hook fn * 3. options object + hook fn * * See: https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/api_reference.md#afteroptions-fn */ type StepHookDefinitionArgs = [StepHookFn] | [NonNullable, StepHookFn] | [StepHookOptions, StepHookFn]; export type GeneralStepHook = StepHook; /** * Returns BeforeStep() / AfterStep() functions. */ export declare function stepHookFactory(type: StepHookType, { customTest, defaultTags, worldFixture }: HookConstructorOptions): (...args: StepHookDefinitionArgs) => void; export declare function runStepHooks(hooks: GeneralStepHook[], world: unknown, fixtures: StepHookFixtures): Promise; export declare function getStepHooksFixtureNames(hooks: GeneralStepHook[]): string[]; export declare function getStepHooksToRun(type: StepHookType, tags?: string[]): GeneralStepHook[]; export {}; //# sourceMappingURL=step.d.ts.map