@nova-ui/bits
Version:
SolarWinds Nova Framework
49 lines (48 loc) • 2.57 kB
TypeScript
import { ElementFinder } from "protractor";
import { By, ILocation } from "selenium-webdriver";
export interface IAtomClass<T extends Atom> {
new (element: ElementFinder): T;
CSS_CLASS?: string;
CSS_SELECTOR?: string;
findIn<M extends Atom>(atomClass: IAtomClass<M>, parentElement: ElementFinder, index?: number): M;
}
export declare class Atom {
/**
* Finds given component based on unique css id
*/
static find<T extends Atom>(atomClass: IAtomClass<T>, id: string): T;
static getSelector<T extends Atom>(atomClass: IAtomClass<T>): string;
static getLocator<T extends Atom>(atomClass: IAtomClass<T>): By;
/**
* Finds given component inside provided element
* - Will match provided element directly if it's a component
* - Will provide a warning if more child components are found
* - Uses static CSS_CLASS property in component's class
*/
static findIn<T extends Atom>(atomClass: IAtomClass<T>, parentElement: ElementFinder, index?: number): T;
static findCount<T extends Atom>(atomClass: IAtomClass<T>, parentElement?: ElementFinder): Promise<number>;
static getClasses(el: ElementFinder): Promise<string[]>;
static hasClass(el: ElementFinder, className: string): Promise<boolean>;
static hasAnyClass(el: ElementFinder, classNamesToSearch: string[]): Promise<boolean>;
static wait<T>(callback: () => Promise<T>, timeout?: number): Promise<T>;
private element;
constructor(element: ElementFinder);
isDisabled(): Promise<boolean>;
isDisplayed(): Promise<boolean>;
isPresent(): Promise<boolean>;
hasClass(className: string): Promise<boolean>;
getElement(): ElementFinder;
waitElementVisible(): Promise<void>;
isChildElementPresent(locator: any): Promise<boolean>;
/**
* If no arguments are provided, will hover over center of the current element.
* If only an element argument is provided, will hover over center of provided element.
* If null element argument and location is provided, will offset from the top left corner of current element.
* If an element and location is provided, will offset from top left of provided element.
* @param {ElementFinder} [el] - accepts an element to mouse over center
* @param {ILocation} [location] - offsets the mouse from top left of element
*/
hover(el?: ElementFinder, location?: ILocation): Promise<void>;
readonly scrollTo: (options?: ScrollIntoViewOptions) => Promise<void>;
wait<T>(callback: () => Promise<T>, timeout?: number): Promise<T>;
}