UNPKG

e2ed

Version:

E2E testing framework over Playwright

19 lines (18 loc) 862 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dispatchEvent = void 0; const step_1 = require("../step"); const waitFor_1 = require("./waitFor"); /** * Dispatches an event over a specified DOM element. */ const dispatchEvent = (selector, eventName, { eventInit, stabilizationInterval, ...options } = {}) => (0, step_1.step)(`Dispatches an event "${eventName}" over a specified element`, async () => { await selector.getPlaywrightLocator().dispatchEvent(eventName, eventInit, options); if (stabilizationInterval !== undefined && stabilizationInterval > 0) { await (0, waitFor_1.waitForInterfaceStabilization)(stabilizationInterval); } }, { payload: { eventInit, ...options, selector, stabilizationInterval }, type: 5 /* LogEventType.InternalAction */, }); exports.dispatchEvent = dispatchEvent;