UNPKG

@nice-digital/wdio-cucumber-steps

Version:

Shared step definitions for Cucumber JS BDD tests in WebdriverIO

33 lines 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkContainsAnyText = void 0; /** * Check if the given elements contains text * @param {String} elementType Element type (element or button) * @param {String} selector Element selector * @param {String} falseCase Whether to check if the content contains * text or not */ async function checkContainsAnyText(elementType, selector, falseCase) { const element = await $(selector), elementValueAttr = (await element.getAttribute("value")); let command = "getValue"; if (elementType === "button" || elementValueAttr === null) { command = "getText"; } let boolFalseCase; const text = await element[command](); if (typeof falseCase === "undefined") { boolFalseCase = false; } else { boolFalseCase = !!falseCase; } if (boolFalseCase) { expect(text).toEqual(""); } else { expect(text).not.toEqual(""); } } exports.checkContainsAnyText = checkContainsAnyText; //# sourceMappingURL=checkContainsAnyText.js.map