/// import { ScenarioStatusEvent, ScenarioDisposition } from "./interfaces/enums"; import { iSuite } from "./interfaces/isuite"; import { AssertionResult } from "./logging/assertion-result"; import { LogCollection } from "./logging/log-collection"; import { HttpRequest } from "./http/http-request"; import { ServerOptions } from "https"; import { iLogItem } from "./interfaces/ilog-item"; import { ResponsePipe, ResponsePipeCallbackAndMessage } from "./interfaces/response-pipe"; import { WebhookServer } from "./interfaces/webhook"; import { HttpAuth, HttpMethodVerb, HttpProxy, HttpAdapter, HttpRequestOptions, HttpResponseOptions, HttpTimeout, iHttpResponse } from "./interfaces/http"; import { ClassConstructor, KeyValue } from "./interfaces/generic-types"; import { iScenario, ScenarioCallback, ScenarioCallbackAndMessage, ScenarioStatusCallback } from "./interfaces/iscenario"; import { iAssertionContext, iNextCallback } from "./interfaces/iassertioncontext"; import { iResponse } from "./interfaces/iresponse"; import { iValue } from "./interfaces/ivalue"; declare enum ScenarioRequestType { httpRequest = "httpRequest", localFile = "localFile", manual = "manual", webhook = "webhook" } export declare abstract class ProtoScenario implements iScenario { readonly suite: iSuite; readonly title: string; readonly type: ClassConstructor; abstract readonly adapter: HttpAdapter; abstract readonly response: iResponse; abstract readonly typeName: string; readonly request: HttpRequest; readonly defaultRequestOptions: HttpRequestOptions; constructor(suite: iSuite, title: string, type: ClassConstructor, opts: KeyValue); get context(): iAssertionContext; get totalDuration(): number; get executionDuration(): number | null; get requestDuration(): number | null; get hasFailed(): boolean; get hasPassed(): boolean; get hasAborted(): boolean; get hasBeenCancelled(): boolean; get hasBeenSkipped(): boolean; get isPending(): boolean; get isExecuting(): boolean; get isCompleted(): boolean; get disposition(): ScenarioDisposition; get opts(): any; get isReadyToExecute(): boolean; get hasExecuted(): boolean; get hasFinished(): boolean; private get isImplicitWait(); private get isExplicitWait(); private get hasNextCallbacks(); get hasRequestStarted(): boolean; get url(): string | null; set url(value: string | null); get finalUrl(): string | null; get redirectCount(): number; get redirectChain(): string[]; get nextCallbacks(): Array<{ message: string; callback: iNextCallback; }>; protected _log: LogCollection; protected _subscribers: ScenarioStatusCallback[]; protected _nextCallbacks: iNextCallback[]; protected _nextMessages: Array; protected _beforeCallbacks: ScenarioCallbackAndMessage[]; protected _afterCallbacks: ScenarioCallbackAndMessage[]; protected _finallyCallbacks: ScenarioCallbackAndMessage[]; protected _failureCallbacks: ScenarioCallbackAndMessage[]; protected _successCallbacks: ScenarioCallbackAndMessage[]; protected _pipeCallbacks: ResponsePipeCallbackAndMessage[]; protected _timeScenarioInitialized: number; protected _timeScenarioExecuted: number | null; protected _timeRequestStarted: number | null; protected _timeRequestLoaded: number | null; protected _timeScenarioFinished: number | null; protected _requestType: ScenarioRequestType; protected _redirectChain: string[]; protected _finalUrl: string | null; protected _waitToExecute: boolean; protected _waitTime: number; protected _flipAssertion: boolean; protected _ignoreAssertion: boolean; protected _mockResponseOptions: HttpResponseOptions | null; protected _aliasedData: any; protected _requestPromise: Promise; protected _requestResolve: Function; protected _finishedPromise: Promise; protected _finishedResolve: Function; protected _disposition: ScenarioDisposition; protected _webhookPromise: Promise; protected _webhookResolver: Function; protected _getArray(key: string): any[]; push(key: string, value: any): this; set(aliasName: string, value: any): this; get(aliasName: string): T; getLog(): Promise; subscribe(callback: ScenarioStatusCallback): this; setJsonBody(json: KeyValue): this; setRawBody(str: string): this; verifyCert(verify: boolean): this; setProxy(proxy: HttpProxy): this; setTimeout(n: number): this; setTimeout(timeouts: HttpTimeout): this; setFormData(form: FormData): this; setFormData(form: KeyValue, isMultipart?: boolean): this; setMaxRedirects(n: number): this; setBasicAuth(auth: HttpAuth): this; setDigestAuth(auth: HttpAuth): this; setBearerToken(token: string): this; setCookie(key: string, value: string): this; setCookies(cookies: KeyValue): this; setHeaders(headers: KeyValue): this; setHeader(key: string, value: any): this; setMethod(method: HttpMethodVerb): this; wait(bool?: boolean): this; waitFor(thatScenario: iScenario): this; comment(input: any): this; result(result: AssertionResult): this; ignore(assertions?: boolean | Function): this; pause(milliseconds: number): this; open(url: string, opts?: HttpRequestOptions): this; open(link: iValue, opts?: HttpRequestOptions): this; next(callback: iNextCallback): this; next(message: string, callback: iNextCallback): this; next(...callbacks: iNextCallback[]): this; next(responseValues: { [key: string]: any; }): this; nextPrepend(message: string, callback: iNextCallback): this; nextPrepend(callback: iNextCallback): this; skip(message?: string): Promise; cancelOrAbort(message?: string): Promise; abort(message?: string): Promise; cancel(message?: string): Promise; execute(): Promise; execute(params: { [key: string]: string | number; }): Promise; go(): Promise; success(callback: ScenarioCallback): this; success(message: string, callback: ScenarioCallback): this; success(...callbacks: ScenarioCallback[]): this; failure(callback: ScenarioCallback): this; failure(message: string, callback: ScenarioCallback): this; failure(...callbacks: ScenarioCallback[]): this; pipe(callback: ResponsePipe): this; pipe(...callbacks: ResponsePipe[]): this; pipe(message: string, callback: ResponsePipe): this; before(callback: ScenarioCallback): this; before(...callbacks: ScenarioCallback[]): this; before(message: string, callback: ScenarioCallback): this; after(callback: ScenarioCallback): this; after(...callbacks: ScenarioCallback[]): this; after(message: string, callback: ScenarioCallback): this; finally(callback: ScenarioCallback): this; finally(...callbacks: ScenarioCallback[]): this; finally(message: string, callback: ScenarioCallback): this; mock(): this; mock(opts: HttpResponseOptions): this; mock(content: string): this; local(localPath: string): this; webhook(a?: string | number | ServerOptions, b?: number | ServerOptions, c?: ServerOptions): this; server(): Promise; waitForFinished(): Promise; waitForResponse(): Promise; promise(): Promise; repeat(): iScenario; repeat(count: number): iScenario[]; buildUrl(): URL; private _pushCallbacks; protected _reset(): this; protected _pipeResponses(httpResponse: iHttpResponse): Promise; protected _processResponse(httpResponse: iHttpResponse): Promise; private _executeDefaultRequest; protected _markRequestAsStarted(): void; protected _executeHttpRequest(): void; protected _executeLocalRequest(): void; protected _executeMock(): void; protected _markScenarioCompleted(message?: string | null, details?: string | null, disposition?: ScenarioDisposition): Promise; private _fireCallbacks; private _logScenarioHeading; private _markExecutionAsStarted; protected _fireBefore(): Promise; protected _fireAfter(): Promise; protected _fireSuccess(): Promise; protected _fireFailure(errorMessage?: string): Promise; protected _fireFinally(): Promise; protected _getOverloads(a: any, b?: any): { message: string | null; callback: Function; }; protected _expect(responseValues: { [key: string]: any; }): iNextCallback; protected _getCallbackOverload(a: any, b?: any): Function; protected _getMessageOverload(a: any): string | null; protected _next(a: iNextCallback | string | { [key: string]: any; }, b?: iNextCallback | { [key: string]: any; } | null, append?: boolean): this; protected _publish(statusEvent: ScenarioStatusEvent): Promise; protected _pushToLog(logItem: iLogItem): this; } export {};