UNPKG

wdio-ui5-service

Version:

WebdriverIO plugin for testing UI5 browser-based apps

153 lines 5.92 kB
import type { $EnterTextSettings } from "sap/ui/test/actions/EnterText"; import type { wdi5ControlMetadata, wdi5Selector } from "../types/wdi5.types.js"; export declare const ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf"; export type WDI5ControlParams = { browserInstance: WebdriverIO.Browser; controlSelector?: wdi5Selector; wdio_ui5_key?: string; forceSelect?: boolean; generatedUI5Methods?: string[]; webdriverRepresentation?: WebdriverIO.Element; webElement?: WebdriverIO.Element; domId?: string; }; /** * This is a bridge object to use from selector to UI5 control, * can be seen as a generic representation of a UI5 control */ export declare class WDI5Control { _controlSelector?: WDI5ControlParams["controlSelector"]; _webElement?: WDI5ControlParams["webElement"]; _webdriverRepresentation?: WDI5ControlParams["webdriverRepresentation"]; _metadata: wdi5ControlMetadata; _wdio_ui5_key?: WDI5ControlParams["wdio_ui5_key"]; _generatedUI5Methods?: WDI5ControlParams["generatedUI5Methods"]; _initialisation: boolean; _forceSelect: boolean; _logging: boolean; _wdioBridge: WebdriverIO.Element; _generatedWdioMethods?: string[]; _domId?: WDI5ControlParams["domId"]; _browserInstance: WDI5ControlParams["browserInstance"]; constructor(oOptions: WDI5ControlParams); init(controlSelector?: wdi5Selector, forceSelect?: boolean): Promise<this>; /** * after retrieving the ui5 control and connection this can be false eg. in cases when no DOM element was found by RecordReplay API * @return {Boolean} whether this control was successfully initialized */ isInitialized(): boolean; getControlInfo(): wdi5ControlMetadata; setControlInfo(metadata?: wdi5ControlMetadata): wdi5ControlMetadata; /** * tries to retrieve the webdriver representation of the current wdi5 control * @return {WebdriverIO.Element} the webdriver Element */ getWebElement(): Promise<WebdriverIO.Element | import("webdriverio").ChainablePromiseElement>; /** * add convenience to the getWebElement Function * @returns {WebdriverIO.Element} the webdriver Element */ $(): WebdriverIO.Element; /** * bridge to UI5 control api "getAggregation" * @param name name of the aggregation * @return array of UI5 controls representing the aggregation */ getAggregation(name: string): Promise<WDI5Control[]>; /** * enters a text into a UI5 control * @param text * @param oOptions options for the interaction */ enterText(text: string, oOptions?: $EnterTextSettings): Promise<this>; /** * click on a UI5 control * this works both on a standalone control as well as with the fluent async api */ press(): Promise<this>; /** * fire a named event on a UI5 control * @param {String} eventName * @param {any} oOptions * @param {WebdriverIO.Element} webElement */ fireEvent(eventName: string, oOptions: any, webElement?: WebdriverIO.Element): Promise<any>; /** * @deprecated -> use isInitialized() * @return {Boolean} */ getInitStatus(): boolean; /** * Interact with specific control. */ private _interactWithControl; /** * returns the wdio web element. * @throws will throw an error when no DOM Element was found * @return {WebdriverIO.Element} the webdriver Element */ private _getWebElement; /** * @param id * @returns */ private _renewWebElement; /** * retrieve UI5 control representation of a UI5 control's aggregation * * @param aControls strings of IDs of aggregation items * @returns instances of wdi5 class per control in the aggregation */ private _retrieveElements; /** * retrieve UI5 control representation of a UI5 control's aggregation * * @param eControl ID * @returns instances of wdi5 class per control in the aggregation */ private _retrieveElement; /** * attaches to the instance of this class the functions given in the parameter sReplFunctionNames * * @param sReplFunctionNames */ private _attachControlBridge; private _attachWdioControlBridge; /** * runtime - proxied browser-time UI5 controls' method at Node.js-runtime * * @param methodName UI5 control method * @param webElement representation of selected UI5 control in wdio * @param args proxied arguments to UI5 control method at runtime */ private _executeControlMethod; /** * retrieve an aggregation's members as UI5 controls * * @param aggregationName * @param webElement * @throws will throw an error when no webElement was found * @return {any} */ private _getAggregation; /** * used to update the wdio control reference * this can be used to manually trigger an control reference update after a ui5 control rerendering * this method is also used wdi5-internally to implement the extended forceSelect option * @param {Boolean} isRefresh whether to treat the incoming call as a refresh attempt on a stale web element */ private _renewWebElementReference; /** * expose internal API to refresh a stale web element reference * @param {Boolean} asRefresh whether to treat the incoming call as a refresh attempt on a stale web element */ renewWebElementReference(asRefresh?: boolean): Promise<WebdriverIO.Element>; /** * retrieve a DOM element via UI5 locator * @param {sap.ui.test.RecordReplay.ControlSelector} controlSelector * @return {[WebdriverIO.Element | String, [aProtoFunctions]]} UI5 control or error message, array of function names of this control */ private _getControl; private _writeObjectResultLog; } //# sourceMappingURL=wdi5-control.d.ts.map