UNPKG

@vibe/testkit

Version:
70 lines 3.61 kB
import { Locator, Page } from "@playwright/test"; import { BoundingBox, Coordinates, MouseButton, WheelScrollPixels } from "./types"; /** * Presses a key on the page (e.g., Escape) * @param {Page} page - The Playwright page object * @param {string} key - The key to press (e.g., 'Escape', 'Enter') * @param {number} delay - The delay between each key press (default: 100) * @returns {Promise<void>} */ export declare const pressKey: (page: Page, key: string, delay?: number) => Promise<void>; /** * Moves the mouse to the center of the element * @param {Page} page - The Playwright page object * @param {BoundingBox} boundingBox - The bounding box of the element to move to * @param {number} steps - The number of steps to take when moving (default: 1) * @returns {Promise<void>} */ export declare const mouseMove: (page: Page, boundingBox: BoundingBox, steps?: number) => Promise<void>; /** * Mouses down at the center of the element * @param {Page} page - The Playwright page object * @param {MouseButton} button - The mouse button to click (default: "left") * @param {number} clickCount - The number of clicks to perform (default: 1) * @returns {Promise<void>} */ export declare const mouseDown: (page: Page, button?: MouseButton, clickCount?: number) => Promise<void>; /** * Mouses up at the center of the element * @param {Page} page - The Playwright page object * @param {MouseButton} button - The mouse button to click (default: "left") * @param {number} clickCount - The number of clicks to perform (default: 1) * @returns {Promise<void>} */ export declare const mouseUp: (page: Page, button?: MouseButton, clickCount?: number) => Promise<void>; /** * Drags an element from one location and drops it to another * @param {Page} page - The Playwright page object * @param {Locator} sourceLocator - The locator of the element to drag * @param {Locator} targetLocator - The locator of the element to drop to * @param {number} steps - The number of steps to take when dragging (default: 5) * @returns {Promise<void>} */ export declare const dragAndDrop: (page: Page, sourceLocator: Locator, targetLocator: Locator, steps?: number) => Promise<void>; /** * Scrolls the mouse wheel by a given number of pixels * @param {Page} page - The Playwright page object * @param {WheelScrollPixels} wheelScrollPixels - The number of pixels to scroll by * @returns {Promise<void>} */ export declare const mouseWheelScroll: (page: Page, wheelScrollPixels: WheelScrollPixels) => Promise<void>; /** * Double clicks at the given coordinates * @param {Page} page - The Playwright page object * @param {Coordinates} coordinates - The coordinates to double click at * @param {MouseButton} button - The mouse button to click (default: "left") * @param {number} delay - The delay between each click (default: 100) * @returns {Promise<void>} */ export declare const mouseDoubleClick: (page: Page, coordinates: Coordinates, button?: MouseButton, delay?: number) => Promise<void>; /** * Clicks at the given coordinates * @param {Page} page - The Playwright page object * @param {Coordinates} coordinates - The coordinates to click at * @param {MouseButton} button - The mouse button to click (default: "left") * @param {number} delay - The delay between each click (default: 100) * @param {number} clickCount - The number of clicks to perform (default: 1) * @returns {Promise<void>} */ export declare const mouseClick: (page: Page, coordinates: Coordinates, button?: MouseButton, delay?: number, clickCount?: number) => Promise<void>; //# sourceMappingURL=common-actions.d.ts.map