UNPKG

@sap_oss/wdio-qmate-service

Version:

[![REUSE status](https://api.reuse.software/badge/github.com/SAP/wdio-qmate-service)](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[![Node.js CI](https://github.com/SAP/wdio-qmate-service/actions/workflows/node.js.yml/badge.svg)](http

203 lines (202 loc) 11.5 kB
import { Element } from "../../../../@types/wdio"; import { AlignmentOptions, AlignmentValues } from "../types"; /** * @class userInteraction * @memberof nonUi5 */ export declare class UserInteraction { private vlf; private ErrorHandler; /** * @function click * @memberOf nonUi5.userInteraction * @description Clicks on the passed element. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {Number} [timeout=30000] - The timeout to wait (ms). * @example const elem = await nonUi5.element.getById("button01"); * await nonUi5.userInteraction.click(elem); */ click(elementOrSelector: Element | string, timeout?: number): Promise<void>; /** * @function clickAndRetry * @memberOf nonUi5.userInteraction * @description Clicks on the passed element, retries in case it fails. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {Number} [timeout=30000] - The timeout to wait (ms). * @param {Number} [retries=3] - The number of retries, can be set in config for all functions under params stepsRetries. * @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. * @example const elem = await nonUi5.element.getById("button01"); * await nonUi5.userInteraction.clickAndRetry(elem); */ clickAndRetry(elementOrSelector: Element | string, timeout?: number, retries?: number, interval?: number): Promise<void>; /** * @function doubleClick * @memberOf nonUi5.userInteraction * @description Double Clicks on the passed element. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {Number} [timeout=30000] - The timeout to wait (ms). * @example const elem = await nonUi5.element.getById("button01"); * await nonUi5.userInteraction.doubleClick(elem); */ doubleClick(elementOrSelector: Element | string, timeout?: number): Promise<void>; /** * @function rightClick * @memberOf nonUi5.userInteraction * @description Right Clicks on the passed element. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {Number} [timeout=30000] - The timeout to wait (ms). * @example const elem = await nonUi5.element.getById("button01"); * await nonUi5.userInteraction.rightClick(elem); */ rightClick(elementOrSelector: Element | string, timeout?: number): Promise<void>; /** * @function check * @memberOf nonUi5.userInteraction * @description Checks the given checkbox. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @example await nonUi5.userInteraction.check(selector); */ check(elementOrSelector: Element | string): Promise<void>; /** * @function uncheck * @memberOf nonUi5.userInteraction * @description Unchecks the given checkbox. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @example await nonUi5.userInteraction.uncheck(selector); */ uncheck(elementOrSelector: Element | string): Promise<void>; /** * @function fill * @memberOf nonUi5.userInteraction * @description Fills the given value into the passed input. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {String | Number} value - The value to enter. * @example const elem = await nonUi5.element.getById("input01"); * await nonUi5.userInteraction.fill(elem, "Service 01"); */ fill(elementOrSelector: Element | string, value: string | number): Promise<void>; /** * @function fillAndRetry * @memberOf nonUi5.userInteraction * @description Fills the given value into the passed input, retries in case of a failure. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {String | Number} value - The value to enter. * @param {Number} [retries=3] - The number of retries, can be set in config for all functions under params stepsRetries. * @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. * @example const elem = await nonUi5.element.getById("input01"); * await nonUi5.userInteraction.fillAndRetry(elem, "Service 01"); */ fillAndRetry(elementOrSelector: Element | string, value: string | number, retries?: number, interval?: number): Promise<void>; /** * @function clear * @memberOf nonUi5.userInteraction * @description Clears the passed input element. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @example const elem = await nonUi5.element.getById("input01"); * await nonUi5.userInteraction.clear(elem); */ clear(elementOrSelector: Element | string): Promise<void>; /** * @function clearAndRetry * @memberOf nonUi5.userInteraction * @description Clears the passed input element, retries in case of a failure. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {Number} [retries=3] - The number of retries, can be set in config for all functions under params stepsRetries. * @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. * @example const elem = await nonUi5.element.getById("input01", 10000); * await nonUi5.userInteraction.clearAndRetry(elem); */ clearAndRetry(elementOrSelector: Element | string, retries?: number, interval?: number): Promise<void>; /** * @function clearAndFill * @memberOf nonUi5.userInteraction * @description Clears and fills the passed input element. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {String | Number} value - The value to enter in. * @example const elem = await nonUi5.element.getById("input01"); * await nonUi5.userInteraction.clearAndFill(elem, "Service 01"); */ clearAndFill(elementOrSelector: Element | string, value: string | number): Promise<void>; /** * @function clearAndFillAndRetry * @memberOf nonUi5.userInteraction * @description Clears and fills the passed input, retries in case it fails. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {String | Number} value - The value to enter in. * @param {Number} [retries=3] - The number of retries, can be set in config for all functions under params stepsRetries. * @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. * @param {Boolean} [verify=true] - Specifies if the filled value should be verified. * @example const elem = await nonUi5.element.getById("input01"); * await nonUi5.userInteraction.clearAndFillAndRetry(elem, "Service 01"); */ clearAndFillAndRetry(elementOrSelector: Element | string, value: string | number, retries?: number, interval?: number, verify?: boolean): Promise<void>; /** * @function mouseOverElement * @memberOf nonUi5.userInteraction * @description Moves the cursor/focus to the passed element. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {Number} [xOffset] - X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element. * @param {Number} [yOffset] - Y offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element. * @example const elem = await nonUi5.element.getById("dropdown42"); * await nonUi5.userInteraction.mouseOverElement(elem); */ mouseOverElement(elementOrSelector: Element | string, xOffset: number, yOffset: number): Promise<void>; /** * @function scrollToElement * @memberOf nonUi5.userInteraction * @description Scrolls an element into view. * @param {Element} elem - The target element to scroll to. * @param {String | Object} [alignment="center"] - The alignment option for scrolling. * Can be one of: "start", "center", "end", "nearest", or an object with properties: * - block: Vertical alignment ("start", "center", "end", "nearest"). * - inline: Horizontal alignment ("start", "center", "end", "nearest"). * * @example * // Scroll to element with center alignment. * const elem = await nonUi5.userInteraction.getElementById("footer01"); * await nonUi5.userInteraction.scrollToElement(elem, "center"); * * @example * // Scroll to element with custom alignment. * const elem = await nonUi5.userInteraction.getElementById("footer01"); * const alignment = { * block: "start", * inline: "center" * }; * await nonUi5.userInteraction.scrollToElement(elem, alignment); */ scrollToElement(elementOrSelector: Element | string, alignment?: AlignmentOptions | AlignmentValues): Promise<void>; /** * @function dragAndDrop * @memberOf nonUi5.userInteraction * @description Drags and drops the given element to the given target element. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @param {Object} targetElem - The target element to drop the element. * @example const elem = await nonUi5.element.getById("drag01"); * @example const targetElem = await nonUi5.element.getById("drop02"); * await nonUi5.userInteraction.dragAndDrop(elem, targetElem); */ dragAndDrop(elementOrSelector: Element | string, targetElem: Element): Promise<void>; /** * @function moveCursorAndClick * @memberOf nonUi5.userInteraction * @description Moves the cursor to the target element and clicks on it. Can be used for charts. * @param {Element | string} elementOrSelector - The element or CSS selector describing the element. * @example const elem = await nonUi5.element.getById("chartPartToClick"); * await nonUi5.userInteraction.moveCursorAndClick(elem); */ moveCursorAndClick(elementOrSelector: Element | string): Promise<void>; /** * @function clickElementInSvg * @memberOf nonUi5.userInteraction * @description Clicks on an inner element within a SVG element. * @param {Object | string} elementOrSelector - The SVG element or CSS selector describing the element. * @param {String} innerSelector - The CSS selector describing the inner element to be clicked. * @example const svgElem = await nonUi5.element.getByCss("svg"); * const innerSelector = "circle:nth-child(6)"; * await nonUi5.userInteraction.clickElementInSvg(svgElem, innerSelector); */ clickElementInSvg(elementOrSelector: Element | string, innerSelector: string): Promise<void>; } declare const _default: UserInteraction; export default _default;