flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
169 lines (168 loc) • 7.1 kB
TypeScript
/// <reference types="node" />
import { iAssertionContext, iValue, iScenario, KeyValue, iBounds, iNextCallback, iAssertionIs, IteratorCallback, IteratorBoolCallback, ReducerCallback, MapperCallback, HttpRequestOptions } from "./interfaces";
import { Link } from "./link";
import { EvaluateFn, PageFnOptions, SerializableOrJSHandle } from "puppeteer-core";
import { ValuePromise } from "./value-promise";
import { ScenarioType } from "./scenario-types";
import { HttpResponse } from "./httpresponse";
export declare class Value implements iValue {
protected _input: any;
protected _context: iAssertionContext;
protected _name: string | null;
protected _parent: any;
protected _highlight: string;
protected _sourceCode: string | null;
protected _path: string | undefined;
protected _tagName: string | undefined;
get context(): iAssertionContext;
get $(): any;
get tagName(): string;
get outerHTML(): string;
get is(): iAssertionIs;
selectOption(value: string | string[]): Promise<void>;
pressEnter(): Promise<void>;
get length(): iValue;
get trim(): iValue;
get uppercase(): iValue;
get lowercase(): iValue;
get first(): iValue;
get mid(): iValue;
get last(): iValue;
get random(): iValue;
get string(): iValue;
get array(): iValue;
get float(): iValue;
get int(): iValue;
get bool(): iValue;
get json(): iValue;
get path(): string;
get name(): string;
get highlight(): string;
get parent(): any;
get sourceCode(): string;
get isFlagpoleValue(): true;
constructor(input: any, context: iAssertionContext, name?: string, parent?: any, highlight?: string);
toArray(): any[];
valueOf(): any;
toString(): string;
toBoolean(): boolean;
toFloat(): number;
toInteger(): number;
toJSON(): any;
toURL(baseUrl?: string | URL): URL;
toType(): string;
isNullOrUndefined(): boolean;
isUndefined(): boolean;
isNull(): boolean;
isPromise(): boolean;
isArray(): boolean;
isString(): boolean;
isObject(): boolean;
isNumber(): boolean;
isNumeric(): boolean;
isNaN(): boolean;
isCookie(): boolean;
isRegularExpression(): boolean;
isCheerioElement(): boolean;
isPuppeteerElement(): boolean;
hasProperty(key: string, value: any): Promise<boolean>;
hasValue(value: any): Promise<boolean>;
as(aliasName: string): iValue;
getProperty(key: string): Promise<iValue>;
click(): Promise<iValue>;
submit(): Promise<iValue>;
open(message: string): iScenario;
open(message: string, type: ScenarioType): iScenario;
open(message: string, type: ScenarioType, callback: iNextCallback): iScenario;
open(message: string, callback: iNextCallback): iScenario;
open(callback: iNextCallback): iScenario;
open(scenario: iScenario): iScenario;
isVisible(): Promise<boolean>;
isHidden(): Promise<boolean>;
isTag(...tagNames: string[]): boolean;
getLink(): Promise<Link>;
getUrl(): Promise<iValue>;
fillForm(attributeName: string, formData: KeyValue): Promise<iValue>;
fillForm(formData: KeyValue): Promise<iValue>;
exists(selector?: string): Promise<iValue>;
find(selector: string): ValuePromise;
findAll(selector: string): Promise<iValue[]>;
getClassName(): Promise<iValue>;
hasClassName(name?: string | RegExp): Promise<boolean>;
getTag(): Promise<iValue>;
hasTag(tag?: string | RegExp): Promise<boolean>;
getInnerText(): Promise<iValue>;
getInnerHtml(): Promise<iValue>;
getOuterHtml(): Promise<iValue>;
hasAttribute(key: string, value?: string | RegExp): Promise<boolean>;
getAttribute(key: string): Promise<iValue>;
getStyleProperty(key: string): Promise<iValue>;
getValue(): Promise<iValue>;
scrollTo(): Promise<void>;
hasText(text?: string): Promise<boolean>;
getText(): Promise<iValue>;
get values(): iValue;
get keys(): iValue;
screenshot(): Promise<Buffer>;
eval(js: string): Promise<any>;
focus(): Promise<void>;
hover(): Promise<void>;
blur(): Promise<void>;
tap(): Promise<void>;
press(key: string, opts?: any): Promise<void>;
clearThenType(textToType: string, opts?: any): Promise<void>;
type(textToType: string, opts?: any): Promise<void>;
clear(): Promise<void>;
getAncestor(selector: string): Promise<iValue>;
getChildren(selector?: string): Promise<iValue[]>;
getAncestors(selector: string): Promise<iValue[]>;
getAncestorOrSelf(selector: string): Promise<iValue>;
getFirstChild(selector?: string): Promise<iValue>;
getLastChild(selector?: string): Promise<iValue>;
getFirstSibling(selector?: string): Promise<iValue>;
getLastSibling(selector?: string): Promise<iValue>;
getChildOrSelf(selector?: string): Promise<iValue>;
getDescendantOrSelf(selector?: string): Promise<iValue>;
getDescendants(selector?: string): Promise<iValue[]>;
getParent(): Promise<iValue>;
getSiblings(selector?: string): Promise<iValue[]>;
getPreviousSibling(selector?: string): Promise<iValue>;
getPreviousSiblings(selector?: string): Promise<iValue[]>;
getNextSibling(selector?: string): Promise<iValue>;
getNextSiblings(selector?: string): Promise<iValue[]>;
getBounds(boxType: string): Promise<iBounds | null>;
download(): Promise<HttpResponse | null>;
download(localFilePath: string): Promise<HttpResponse | null>;
download(localFilePath: string, opts: HttpRequestOptions): Promise<HttpResponse | null>;
download(opts: HttpRequestOptions): Promise<HttpResponse | null>;
waitForFunction(js: EvaluateFn<any>, opts?: PageFnOptions | number, ...args: SerializableOrJSHandle[]): Promise<iValue>;
waitForHidden(): Promise<iValue>;
waitForVisible(): Promise<iValue>;
setValue(text: string): Promise<void>;
assert(message?: string): import("./interfaces").iAssertion;
split(by: string | RegExp, limit?: number): iValue;
join(by: string): iValue;
map(callback: MapperCallback): iValue;
filter(func: (value: any, i?: number, arr?: any[]) => boolean): iValue;
each(callback: IteratorCallback): iValue;
min(key?: string): iValue;
max(key?: string): iValue;
sum(key?: string): iValue;
count(key?: string): iValue;
unique(): iValue;
groupBy(key: string): iValue;
asc(key?: string): iValue;
desc(key?: string): iValue;
median(key?: string): iValue;
avg(key?: string): iValue;
reduce(callback: ReducerCallback, initial?: any): iValue;
every(callback: IteratorBoolCallback): iValue;
some(callback: IteratorBoolCallback): iValue;
none(callback: IteratorBoolCallback): iValue;
item(key: string | number): iValue;
echo(callback?: (str: string) => void): iValue;
col(key: string | string[]): iValue;
protected _completedAction(verb: string, noun?: string): Promise<void>;
protected _failedAction(verb: string, noun?: string): Promise<void>;
protected _wrapAsValue(data: any, name: string, parent?: any, highlight?: string): iValue;
}