@qavajs/steps-playwright
Version:
qavajs steps to interact with playwright
39 lines • 1.44 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("./utils/utils");
const core_1 = require("@qavajs/core");
/**
* Press mouse key
* @param {string} button - button to press (left, right, middle)
* @example When I press left mouse button
*/
(0, core_1.When)('I press {playwrightMouseButton} mouse button', async function (button) {
await this.playwright.page.mouse.down({ button });
});
/**
* Release mouse key
* @param {string} button - button to release (left, right, middle)
* @example When I release left mouse button
*/
(0, core_1.When)('I release {playwrightMouseButton} mouse button', async function (button) {
await this.playwright.page.mouse.up({ button });
});
/**
* Move mouse to coordinates
* @param {string} coords - x, y coordinates to move
* @example When I move mouse to '10, 15'
*/
(0, core_1.When)('I move mouse to {value}', async function (coords) {
const [x, y] = (0, utils_1.parseCoords)(await coords.value());
await this.playwright.page.mouse.move(x, y);
});
/**
* Scroll mouse wheel by x, y offset
* @param {string} coords - x, y offset to scroll
* @example When I scroll mouse wheel by '0, 15'
*/
(0, core_1.When)('I scroll mouse wheel by {value}', async function (offset) {
const [x, y] = (0, utils_1.parseCoords)(await offset.value());
await this.playwright.page.mouse.wheel(x, y);
});
//# sourceMappingURL=mouseActions.js.map
;