UNPKG

selenium-state-machine

Version:
49 lines 2.08 kB
import winston = require('winston'); import { DependencyMap } from './Dependency'; import { Provide, ProvideComplete, ProvidePublic } from './Provide'; import { BaseContext } from './StateMachine'; import { Timer } from './Timer'; export interface StateProvideData<TContext extends BaseContext> { context: TContext; logger: winston.Logger; timers: { [name: string]: Timer; }; timeout: number; } /** * Definition of state arguments. * @param f State functions which is called each tick. The function must return ProvideComplete object by using given DSL. * In case no dependencies are provides, use provide.nothing() otherwise use provide.dependency(dependencyObject, value). * After that select one of next, previous or transition. If nothing was provides tryAgain is available. Depending on selected option * the state machine will perform transition to next/previous/selected state or repeat itself. * @param name name of the state * @param timeout timeout on the state * @returns self */ export interface StateData<TContext extends BaseContext, TDependencyMap extends DependencyMap> { f: (provide: ProvidePublic<TContext, TDependencyMap>, dependencies: TDependencyMap) => Promise<ProvideComplete<TContext, TDependencyMap>> | ProvideComplete<TContext, TDependencyMap>; name?: string; timeout?: number; } export declare class State<TContext extends BaseContext, TDependencyMap extends DependencyMap> { private config; readonly index: number; private readonly provideConfig; constructor(config: StateData<TContext, TDependencyMap>, index: number, provideConfig: StateProvideData<TContext>); /** * State timeout. If it is reached, error is threw. */ get timeout(): number; /** * Get state name */ get name(): string; /** * Call the state function. * @param dependencies provided dependencies so far * @returns provide object */ execute(dependencies: TDependencyMap): Promise<Provide<TContext, TDependencyMap>>; } //# sourceMappingURL=State.d.ts.map