/// import { BrowserControl } from "./browsercontrol"; import { Page, LaunchOptions } from "puppeteer-core"; import { LogItemType, ConsoleLineType, ConsoleColor, ResponseType } from "./enums"; import { HttpResponse } from "./httpresponse"; import { URL } from "url"; import { CookieJar } from "tough-cookie"; import { RequestPromiseOptions } from "request-promise"; import { FlagpoleExecutionOptions } from "./flagpoleexecutionoptions"; export interface RequestOptions extends RequestPromiseOptions { encoding?: never; resolveWithFullResponse?: never | false; } export interface RequestOptionsWithEncoding extends RequestPromiseOptions { encoding: string; resolveWithFullResponse?: never | false; } export interface ScreenshotOpts { path?: string; fullPage?: boolean; clip?: { x: number; y: number; width: number; height: number; }; omitBackground?: boolean; } export interface iNextCallback { (context: iAssertionContext): Promise | void; } export declare type IteratorCallback = (value: any, index: number, arr: any[]) => any; export interface iConsoleLine { timestamp: Date; color: ConsoleColor; message: string; type: ConsoleLineType; toConsoleString(): string; toString(): string; } export interface iLogItem { type: LogItemType; className: string; message: string; passed: boolean; failed: boolean; isOptional: boolean; timestamp: Date; toConsole(): iConsoleLine[]; toJson(): any; toCsv(): string; toPsv(): string; toTsv(): string; toHtml(): string; } export interface iAssertionResult { className: string; toConsole(): iConsoleLine[]; type: LogItemType; message: string; passed: boolean; failed: boolean; isOptional: boolean; timestamp: Date; toConsole(): iConsoleLine[]; toJson(): any; toCsv(): string; toPsv(): string; toTsv(): string; toHtml(): string; } export interface iValue { $: any; name: string; tagName: string; outerHTML: string; path: string; length: iValue; highlight: string; parent: any; sourceCode: string; valueOf(): any; toArray(): any[]; toString(): string; toInteger(): number; toFloat(): number; toType(): string; isNullOrUndefined(): boolean; isUndefined(): boolean; isNull(): boolean; isNaN(): boolean; isNumber(): boolean; isNumeric(): boolean; isObject(): boolean; isPromise(): boolean; isRegularExpression(): boolean; isString(): boolean; isArray(): boolean; isCookie(): boolean; isPuppeteerElement(): boolean; isCheerioElement(): boolean; hasProperty(key: string): Promise; as(aliasName: string): iValue; click(): Promise; click(scenario: iScenario): Promise; click(message: string): Promise; click(callback: Function): Promise; click(message: string, callback: Function): Promise; submit(): Promise; submit(scenario: iScenario): Promise; submit(message: string): Promise; submit(callback: Function): Promise; submit(message: string, callback: Function): Promise; load(): void; load(message: string): iScenario; load(scenario: iScenario): iScenario; load(callback: Function): iScenario; load(message: string, callback: Function): iScenario; fillForm(formData: any): Promise; exists(): Promise; exists(selector: string): Promise; find(selector: string): Promise; findAll(selector: string): Promise; getClassName(): Promise; hasClassName(className: string): Promise; getTagName(): Promise; getInnerText(): Promise; getInnerHtml(): Promise; getOuterHtml(): Promise; hasAttribute(key: string): Promise; getAttribute(key: string): Promise; getProperty(key: string): Promise; hasData(key: string): Promise; getData(key: string): Promise; getValue(): Promise; getText(): Promise; getStyleProperty(key: string): Promise; download(): Promise; download(localFilePath: string): Promise; download(localFilePath: string, opts: RequestOptions): Promise; download(opts: RequestOptions): Promise; download(localFilePath: string, opts: RequestOptionsWithEncoding): Promise; download(opts: RequestOptionsWithEncoding): Promise; screenshot(): Promise; screenshot(localFilePath: string): Promise; screenshot(localFilePath: string, opts: ScreenshotOpts): Promise; screenshot(opts: ScreenshotOpts): Promise; } export interface iResponse { responseType: ResponseType; responseTypeName: string; statusCode: iValue; statusMessage: iValue; body: iValue; jsonBody: iValue; url: iValue; finalUrl: iValue; length: iValue; loadTime: iValue; context: iAssertionContext; headers: iValue; cookies: iValue; isBrowser: boolean; init(httpResponse: HttpResponse): void; getRoot(): any; find(path: string): Promise; findAll(path: string): Promise; findHavingText(selector: string, searchForText: string | RegExp): Promise; findAllHavingText(selector: string, searchForText: string | RegExp): Promise; header(key?: string): iValue; cookie(key?: string): iValue; absolutizeUri(uri: string): string; evaluate(context: any, callback: Function): Promise; waitForNavigation(timeout: number, waitFor?: string | string[]): Promise; waitForLoad(timeout: number): Promise; waitForNetworkIdle(timeout: number): Promise; waitForReady(timeout: number): Promise; waitForHidden(selector: string, timeout: number): Promise; waitForVisible(selector: string, timeout: number): Promise; waitForExists(selector: string, timeout?: number): Promise; screenshot(): Promise; screenshot(localFilePath: string): Promise; screenshot(localFilePath: string, opts: ScreenshotOpts): Promise; screenshot(opts: ScreenshotOpts): Promise; clear(selector: string): Promise; type(selector: string, textToType: string, opts: any): Promise; selectOption(selector: string, value: string | string[]): Promise; readonly scenario: iScenario; } export interface iAssertion { and: iAssertion; type: iAssertion; length: iAssertion; keys: iAssertion; values: iAssertion; not: iAssertion; optional: iAssertion; result: Promise; assertionMade: boolean; name: string; passed: boolean | null; isFinalized: boolean; as(aliasName: string): iAssertion; exactly(value: any): iAssertion; equals(value: any): iAssertion; like(value: any): iAssertion; greaterThan(value: any): iAssertion; greaterThanOrEquals(value: any): iAssertion; lessThan(value: any): iAssertion; lessThanOrEquals(value: any): iAssertion; between(min: any, max: any): iAssertion; matches(value: any): iAssertion; contains(value: any): iAssertion; startsWith(value: any): iAssertion; endsWith(value: any): iAssertion; in(values: any[]): iAssertion; includes(value: any): iAssertion; exists(): iAssertion; resolves(continueOnReject?: boolean): Promise; rejects(continueOnReject?: boolean): Promise; none(callback: IteratorCallback): Promise; every(callback: IteratorCallback): Promise; some(callback: IteratorCallback): Promise; schema(schema: any, simple?: boolean): Promise; assert(a: any, b?: any): iAssertion; comment(value: iValue): iAssertion; comment(message: string): iAssertion; comment(input: string | iValue): iAssertion; looksLike(image: Buffer | string): iAssertion; looksLike(image: Buffer | string, threshhold: number): iAssertion; looksLike(image: Buffer | string, percent: string): iAssertion; } export interface iAssertionContext { result: any; response: iResponse; scenario: iScenario; suite: iSuite; browserControl: BrowserControl | null; executionOptions: FlagpoleExecutionOptions; page: Page | null; incompleteAssertions: iAssertion[]; assertionsResolved: Promise<(iAssertionResult | null)[]>; subScenariosResolved: Promise; comment(value: iValue): iAssertionContext; comment(message: string): iAssertionContext; comment(input: string | iValue): iAssertionContext; assert(a: any, b?: any): iAssertion; pause(milliseconds: number): Promise; exists(message: string, selector: string): Promise; exists(selector: string): Promise; set(aliasName: string, value: any): iAssertionContext; get(aliasName: string): any; find(selector: string): Promise; findAll(selector: string): Promise; findHavingText(selector: string, searchForText: string | RegExp): Promise; findAllHavingText(selector: string, searchForText: string | RegExp): Promise; clearThenType(selector: string, textToType: string, opts?: any): Promise; clear(selector: string): Promise; click(selector: string): Promise; click(selector: string, scenario: iScenario): Promise; click(selector: string, message: string): Promise; click(selector: string, callback: Function): Promise; click(selector: string, message: string, callback: Function): Promise; submit(selector: string): Promise; submit(selector: string, scenario: iScenario): Promise; submit(selector: string, message: string): Promise; submit(selector: string, callback: Function): Promise; submit(selector: string, message: string, callback: Function): Promise; type(selector: string, textToType: string, opts?: any): Promise; select(selector: string, value: string | string[]): Promise; evaluate(callback: Function): Promise; waitForReady(timeout?: number): Promise; waitForLoad(timeout?: number): Promise; waitForNetworkIdle(timeout?: number): Promise; waitForNavigation(timeout?: number, waitFor?: string | string[]): Promise; waitForHidden(selector: string, timeout?: number): Promise; waitForVisible(selector: string, timeout?: number): Promise; waitForExists(selector: string, timeout?: number): Promise; openInBrowser(): Promise; screenshot(): Promise; screenshot(localFilePath: string): Promise; screenshot(localFilePath: string, opts: {}): Promise; screenshot(opts: {}): Promise; } export interface iSuite { scenarios: Array; baseUrl: URL | null; failCount: number; hasPassed: boolean; hasFailed: boolean; hasExecuted: boolean; hasFinished: boolean; totalDuration: number | null; executionDuration: number | null; title: string; suite: iSuite; finished: Promise; subscribe(callback: Function): iSuite; verifySslCert(verify: boolean): iSuite; wait(bool?: boolean): iSuite; print(exitAfterPrint?: boolean): void; scenario(title: string, type: ResponseType, opts: any): iScenario; json(title: string, opts?: any): iScenario; image(title: string, opts?: any): iScenario; video(title: string, opts?: any): iScenario; html(title: string, opts?: any): iScenario; stylesheet(title: string, opts?: any): iScenario; script(title: string, opts?: any): iScenario; resource(title: string, opts?: any): iScenario; browser(title: string, opts?: any): iScenario; extjs(title: string, opts?: any): iScenario; base(url: string | {}): iSuite; buildUrl(path: string): string; execute(): iSuite; beforeAll(callback: Function): iSuite; beforeEach(callback: Function): iSuite; afterEach(callback: Function): iSuite; afterAll(callback: Function): iSuite; error(callback: Function): iSuite; success(callback: Function): iSuite; failure(callback: Function): iSuite; finally(callback: Function): iSuite; promise(): Promise; } export interface iScenario { suite: iSuite; responseType: ResponseType; title: string; totalDuration: number | null; executionDuration: number | null; requestDuration: number | null; hasFailed: boolean; hasPassed: boolean; canExecute: boolean; hasExecuted: boolean; hasFinished: boolean; url: string | null; finalUrl: string | null; requestUrl: string; redirectCount: number; redirectChain: string[]; requestOptions: any; set(aliasName: string, value: any): iScenario; get(aliasName: string): any; getLog(): Promise; subscribe(callback: Function): iScenario; setJsonBody(jsonObject: any): iScenario; setRawBody(str: string): iScenario; verifySslCert(verify: boolean): iScenario; setProxyUrl(proxyUrl: string): iScenario; setTimeout(timeout: number): iScenario; setFormData(form: {}): iScenario; setMaxRedirects(n: number): iScenario; shouldFollowRedirects(onRedirect: boolean | Function): iScenario; setBasicAuth(authorization: { username: string; password: string; }): iScenario; setBearerToken(token: string): iScenario; setCookie(key: string, value: string, opts?: any): iScenario; setHeaders(headers: {}): iScenario; setHeader(key: string, value: any): iScenario; setMethod(method: string): iScenario; wait(bool?: boolean): iScenario; comment(value: iValue): iScenario; comment(message: string): iScenario; comment(input: string | iValue): iScenario; result(result: iAssertionResult): iScenario; ignore(assertions?: boolean | Function): iScenario; open(url: string): iScenario; next(callback: iNextCallback): iScenario; next(message: string, callback: iNextCallback): iScenario; nextPrepend(callback: iNextCallback): iScenario; nextPrepend(message: string, callback: iNextCallback): iScenario; skip(message?: string): Promise; cancel(): Promise; getBrowserControl(): BrowserControl; execute(): Promise; execute(params: { [key: string]: string | number; }): Promise; error(message: string, callback: Function): iScenario; error(callback: Function): iScenario; success(message: string, callback: Function): iScenario; success(callback: Function): iScenario; failure(message: string, callback: Function): iScenario; failure(callback: Function): iScenario; before(message: string, callback: Function): iScenario; before(callback: Function): iScenario; after(message: string, callback: Function): iScenario; after(callback: Function): iScenario; finally(message: string, callback: Function): iScenario; finally(callback: Function): iScenario; mock(localPath: string): iScenario; setResponseType(type: ResponseType, opts?: any): iScenario; promise(): Promise; waitFor(thatScenario: iScenario): iScenario; } export interface iMessageAndCallback { isSubScenario: boolean; message: string; callback: iNextCallback; scenario?: iScenario; } export interface iBounds { x: number; y: number; width: number; height: number; points: { x: number; y: number; }[]; } export declare enum BrowserProduct { chrome = "chrome", firefox = "firefox" } export interface BrowserOptions extends LaunchOptions { uri?: string; width?: number; height?: number; jar?: CookieJar; recordConsole?: boolean; outputConsole?: boolean; product?: BrowserProduct; }