@o3r/testing
Version:
The module provides testing (e2e, unit test) utilities to help you build your own E2E pipeline integrating visual testing.
79 lines • 2.6 kB
TypeScript
/**
* Interface to describe the ElementProfile that are queried inside a fixture.
* As for ComponentFixture, this abstracts the testing framework that is used by choosing the right
* implementation at runtime.
*/
export interface ElementProfile {
/**
* Click on the element. Simple click with left button.
*/
click(): Promise<void>;
/**
* Returns a promise that resolves with the value of the attribute given in parameter.
*/
getAttribute(attributeName: string): Promise<string | undefined>;
/**
* Returns a promise that resolves with the text of the element or undefined.
*/
getText(): Promise<string | undefined>;
/**
* Get the text of an element, remove the multiple whitespaces and linebreaks
* Returns a promise that resolves with the formatted text or undefined.
*/
getPlainText(): Promise<string | undefined>;
/**
* Returns a promise that resolves with the inner html of the element or undefined.
*/
getInnerHTML(): Promise<string | undefined>;
/**
* Put the cusrsor on the element.
*/
mouseOver(): Promise<void>;
/**
* Returns a promise that resolves with the current value of an input or undefined.
*/
getValue(): Promise<string | undefined>;
/**
* Set the value in an input.
*/
setValue(input: string): Promise<void>;
/**
* Clears the value in the input
*/
clearValue(): Promise<void>;
/**
* Check if an element is visible ( display !none and visibility !hidden)
*/
isVisible(): Promise<boolean>;
}
/**
* Constructor of a O3rElement
*/
export type O3rElementConstructor<T extends ElementProfile> = new (sourceElement: any) => T;
/**
* Mock for ElementProfile class.
* This class is used for fixture compilation purpose.
*/
export declare class O3rElement implements ElementProfile {
constructor(_sourceElement: any);
getInnerHTML(): Promise<string | undefined>;
/** @inheritdoc */
getText(): Promise<string | undefined>;
/** @inheritdoc */
getPlainText(): Promise<string | undefined>;
/** @inheritdoc */
click(): Promise<void>;
/** @inheritdoc */
getAttribute(_attributeName: string): Promise<string | undefined>;
/** @inheritdoc */
mouseOver(): Promise<void>;
/** @inheritdoc */
getValue(): Promise<string | undefined>;
/** @inheritdoc */
setValue(_input: string): Promise<void>;
/** @inheritdoc */
clearValue(): Promise<void>;
/** @inheritdoc */
isVisible(): Promise<boolean>;
}
//# sourceMappingURL=element.d.ts.map