flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
49 lines (48 loc) • 2.33 kB
TypeScript
/// <reference types="node" />
import { Value } from './value';
import { iValue, iResponse, iScenario, iDOMElement, iAssertionContext } from './interfaces';
import { ResponseType } from './enums';
import { HttpResponse } from './httpresponse';
export declare function isPuppeteer(type: ResponseType): boolean;
export declare abstract class ProtoResponse implements iResponse {
readonly scenario: iScenario;
private _httpResponse;
abstract readonly responseType: ResponseType;
abstract readonly responseTypeName: string;
abstract find(path: string): Promise<any | null>;
abstract findAll(path: string): Promise<any[]>;
abstract evaluate(context: any, callback: Function): Promise<any>;
readonly isBrowser: boolean;
readonly httpResponse: HttpResponse;
readonly statusCode: Value;
readonly statusMessage: Value;
readonly body: Value;
readonly length: Value;
readonly headers: Value;
readonly cookies: Value;
readonly jsonBody: Value;
readonly url: Value;
readonly finalUrl: Value;
readonly loadTime: Value;
readonly context: iAssertionContext;
constructor(scenario: iScenario);
init(httpResponse: HttpResponse): void;
absolutizeUri(uri: string): string;
getRoot(): any;
header(key: string): Value;
cookie(key: string): Value;
waitForNavigation(timeout?: number, waitFor?: string | string[]): Promise<void>;
waitForLoad(timeout?: number): Promise<void>;
waitForReady(timeout?: number): Promise<void>;
waitForNetworkIdle(timeout?: number): Promise<void>;
waitForHidden(selector: string, timeout?: number): Promise<iValue | null>;
waitForVisible(selector: string, timeout?: number): Promise<iValue | null>;
waitForExists(selector: string, timeout?: number): Promise<iValue | null>;
screenshot(opts: any): Promise<Buffer | string>;
type(selector: string, textToType: string, opts?: any): Promise<any>;
clear(selector: string): Promise<any>;
findHavingText(selector: string, searchForText: string | RegExp): Promise<iDOMElement | null>;
findAllHavingText(selector: string, searchForText: string | RegExp): Promise<iDOMElement[]>;
selectOption(selector: string, value: string | string[]): Promise<string[]>;
protected _wrapAsValue(data: any, name: string, source?: any): Value;
}