UNPKG

flagpole

Version:

Simple and fast DOM integration, headless or headful browser, and REST API testing framework.

97 lines (96 loc) 5.91 kB
/// <reference types="node" /> import { Assertion } from "./assertion"; import { iSuite } from "../interfaces/isuite"; import { asyncSome, asyncNone } from "../util"; import { FlagpoleExecution } from "../flagpole-execution"; import { ValuePromise } from "../value-promise"; import { IteratorBoolCallback } from "../interfaces/iterator-callbacks"; import { FindAllOptions, FindOptions } from "../interfaces/find-options"; import { iHttpRequest } from "../interfaces/http"; import { iAssertionResult } from "../interfaces/iassertion-result"; import { JsFunction, KeyValue, OptionalXY } from "../interfaces/generic-types"; import { ScreenshotOpts } from "../interfaces/screenshot"; import { GestureOpts, GestureType } from "../interfaces/gesture"; import { PointerMove } from "../interfaces/pointer"; import { ScreenProperties } from "../interfaces/screen-properties"; import { iAssertionContext } from "../interfaces/iassertioncontext"; import { iResponse, iScenario, iValue } from ".."; export declare class AssertionContext implements iAssertionContext { readonly scenario: iScenario; readonly response: iResponse; protected _assertions: Assertion[]; protected _subScenarios: Promise<any>[]; constructor(scenario: iScenario, response: iResponse); result: any; get request(): iHttpRequest; get suite(): iSuite; get executionOptions(): FlagpoleExecution; get incompleteAssertions(): Assertion[]; get assertionsResolved(): Promise<(iAssertionResult | null)[]>; get subScenariosResolved(): Promise<any[]>; get currentUrl(): iValue; comment(input: any): this; assert(message: string, value: any): Assertion; assert(value: any): Assertion; pause(milliseconds: number): Promise<void>; clearThenType(selector: string, textToType: string, opts?: any): ValuePromise; clear(selector: string): ValuePromise; type(selector: string, textToType: string, opts?: any): ValuePromise; selectOption(selector: string, value: string | string[]): Promise<void>; eval(js: JsFunction, ...args: any[]): Promise<any>; waitForFunction(js: JsFunction, opts?: KeyValue, ...args: any[]): Promise<void>; waitForReady(timeout?: number): Promise<void>; waitForLoad(timeout?: number): Promise<void>; waitForNetworkIdle(timeout?: number): Promise<void>; waitForNavigation(timeout?: number, waitFor?: string | string[]): Promise<void>; waitForXPath(xPath: string, timeout?: number): ValuePromise; waitForHidden(selector: string, timeout?: number): ValuePromise; waitForVisible(selector: string, timeout?: number): ValuePromise; waitForHavingText(selector: string, text: string | RegExp, timeout?: number): ValuePromise; waitForExists(selector: string, timeout?: number): ValuePromise; waitForExists(selector: string, contains: string | RegExp, timeout?: number): ValuePromise; waitForNotExists(selector: string, a?: number | string | RegExp, b?: number): ValuePromise; exists(selector: string | string[], a?: string | FindOptions | RegExp, b?: FindOptions): ValuePromise; existsAll(selector: string | string[], a?: string | FindAllOptions | RegExp, b?: FindAllOptions): Promise<iValue[]>; existsAny(selectors: string[], a?: string | FindAllOptions | RegExp, b?: FindAllOptions): Promise<iValue[]>; find<T extends iValue>(selector: string | string[], a?: string | RegExp | FindOptions, b?: FindOptions): ValuePromise<T>; findAll(selector: string | string[], a?: string | RegExp | FindAllOptions, b?: FindAllOptions): Promise<iValue[]>; findXPath(xPath: string): ValuePromise; findAllXPath(xPath: string): Promise<iValue[]>; submit(selector: string): ValuePromise; logFailure(message: string, errorDetails?: any, sourceCode?: any, highlightText?: any): iAssertionResult; logOptionalFailure(message: string, errorDetails?: any): iAssertionResult; logPassing(message: string): iAssertionResult; click(selector: string, opts?: FindOptions): ValuePromise; click(selector: string, contains: string, opts?: FindOptions): ValuePromise; click(selector: string, matches: RegExp, opts?: FindOptions): ValuePromise; openInBrowser(): Promise<string>; screenshot(): Promise<Buffer>; screenshot(localFilePath: string): Promise<Buffer>; screenshot(localFilePath: string, opts: ScreenshotOpts): Promise<Buffer>; screenshot(opts: ScreenshotOpts): Promise<Buffer>; movePointer(...pointers: PointerMove[]): Promise<iResponse>; gesture(type: GestureType, opts: GestureOpts): Promise<iResponse>; push(key: string, value: any): this; set(aliasName: string, value: any): this; get<T = any>(aliasName: string): T; scrollTo(point: OptionalXY): Promise<iAssertionContext>; map: <T, F = unknown>(array: F[], callback: import("../interfaces/iterator-callbacks").IteratorCallback) => Promise<T[]>; some: typeof asyncSome; every: <T>(array: T[], callback: IteratorBoolCallback) => Promise<boolean>; filter: <T>(array: T[], callback: IteratorBoolCallback) => Promise<T[]>; none: typeof asyncNone; each: <T>(array: T[], callback: import("../interfaces/iterator-callbacks").IteratorCallback) => Promise<void>; count<T>(arr: T[], callback?: IteratorBoolCallback): ValuePromise; abort(message?: string): Promise<void>; rotateScreen(rotation: string | number): Promise<string | number>; getScreenProperties(): Promise<ScreenProperties>; hideKeyboard(): Promise<void>; getSource(): ValuePromise; protected _findAllForSelectors(selectors: string[], a?: string | FindAllOptions | RegExp, b?: FindAllOptions): Promise<{ [selector: string]: iValue[]; }>; protected _completedAction(verb: string, noun?: string): Promise<void>; protected _failedAction(verb: string, noun?: string): Promise<void>; protected _assertExists(message: string | null, name: string, el: iValue): void; }