@nice-digital/wdio-cucumber-steps
Version:
Shared step definitions for Cucumber JS BDD tests in WebdriverIO
19 lines • 925 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.clickElement = void 0;
/*! https://github.com/webdriverio/cucumber-boilerplate/blob/master/src/support/action/clickElement.js */
const checkIfElementExists_1 = require("../lib/checkIfElementExists");
/**
* Perform an click action on the given element
* @param action The action to perform (click or doubleClick)
* @param type Type of the element (link or selector)
* @param selector Element selector
*/
async function clickElement(action, type, selector) {
const actualSelector = type === "link" ? `=${selector}` : selector, method = action === "click" ? "click" : "doubleClick";
await (0, checkIfElementExists_1.checkIfElementExists)(actualSelector);
const element = await $(actualSelector);
await element[method]();
}
exports.clickElement = clickElement;
//# sourceMappingURL=clickElement.js.map