UNPKG

flagpole

Version:

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

86 lines (85 loc) 5.25 kB
/// <reference types="node" /> import { BrowserControl } from "./puppeteer/browsercontrol"; import { Page, EvaluateFn, SerializableOrJSHandle, PageFnOptions } from "puppeteer-core"; import { Assertion } from "./assertion"; import { iResponse, iValue, iAssertionContext, iScenario, iSuite, iAssertionResult, ScreenshotOpts, iAssertion, FindOptions, FindAllOptions, OptionalXY, iHttpRequest } from "./interfaces"; import { asyncSome, asyncEvery, asyncFilter, asyncNone, asyncForEach } from "./util"; import { FlagpoleExecution } from "./flagpoleexecution"; import { ValuePromise } from "./value-promise"; import { SchemaValidator } from "./assertionschema"; export declare class AssertionContext implements iAssertionContext { protected _scenario: iScenario; protected _response: iResponse; protected _assertions: Assertion[]; protected _subScenarios: Promise<any>[]; result: any; get request(): iHttpRequest; get response(): iResponse; get scenario(): iScenario; get suite(): iSuite; get browserControl(): BrowserControl | null; get executionOptions(): FlagpoleExecution; get page(): Page | null; get incompleteAssertions(): Assertion[]; get assertionsResolved(): Promise<(iAssertionResult | null)[]>; get subScenariosResolved(): Promise<any[]>; constructor(scenario: iScenario, response: iResponse); comment(input: any): iAssertionContext; assert(message: string, value: any): iAssertion; assert(value: any): iAssertion; pause(milliseconds: number): Promise<any>; clearThenType(selector: string, textToType: string, opts?: any): Promise<any>; clear(selector: string): Promise<void>; type(selector: string, textToType: string, opts?: any): Promise<void>; selectOption(selector: string, value: string | string[]): Promise<void>; eval(js: EvaluateFn<any>, ...args: SerializableOrJSHandle[]): Promise<any>; waitForFunction(js: EvaluateFn<any>, opts?: PageFnOptions, ...args: SerializableOrJSHandle[]): 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): Promise<iValue>; waitForHidden(selector: string, timeout?: number): Promise<iValue>; waitForVisible(selector: string, timeout?: number): Promise<iValue>; waitForHavingText(selector: string, text: string | RegExp, timeout?: number): Promise<iValue>; waitForExists(selector: string, timeout?: number): Promise<iValue>; waitForExists(selector: string, contains: string | RegExp, timeout?: number): Promise<iValue>; waitForNotExists(selector: string, a?: number | string | RegExp, b?: number): Promise<iValue>; exists(selector: string | string[], a?: string | FindOptions | RegExp, b?: FindOptions): Promise<iValue>; existsAll(selector: string | string[], a?: string | FindAllOptions | RegExp, b?: FindAllOptions): Promise<iValue[]>; existsAny(selectors: string[], a?: string | FindAllOptions | RegExp, b?: FindAllOptions): Promise<iValue[]>; find(selector: string | string[], a?: string | RegExp | FindOptions, b?: FindOptions): ValuePromise; findAll(selector: string | string[], a?: string | RegExp | FindAllOptions, b?: FindAllOptions): Promise<iValue[]>; findXPath(xPath: string): Promise<iValue>; findAllXPath(xPath: string): Promise<iValue[]>; submit(selector: string): Promise<void>; 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): Promise<iValue>; click(selector: string, contains: string, opts?: FindOptions): Promise<iValue>; click(selector: string, matches: RegExp, opts?: FindOptions): Promise<iValue>; openInBrowser(): Promise<string>; screenshot(): Promise<Buffer>; screenshot(localFilePath: string): Promise<Buffer>; screenshot(localFilePath: string, opts: ScreenshotOpts): Promise<Buffer>; screenshot(opts: ScreenshotOpts): Promise<Buffer>; push(key: string, value: any): iAssertionContext; set(aliasName: string, value: any): iAssertionContext; get<T = any>(aliasName: string): T; scrollTo(point: OptionalXY): Promise<iAssertionContext>; map: <T>(array: any[], callback: import("./interfaces").IteratorCallback) => Promise<T[]>; some: typeof asyncSome; every: typeof asyncEvery; filter: typeof asyncFilter; none: typeof asyncNone; each: typeof asyncForEach; abort(message?: string): Promise<iScenario>; schema(schema: any): SchemaValidator; 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; }