diff --git a/lib/command/definitions.js b/lib/command/definitions.js index 96b1afdd9..fdfd5eeae 100644 --- a/lib/command/definitions.js +++ b/lib/command/definitions.js @@ -206,9 +206,9 @@ module.exports = function (genPath, options) { function addAllMethodsInObject(supportObj, actions, methods, translations) { for (const action of methodsOfObject(supportObj)) { - let fn = supportObj[action]; + const fn = supportObj[action]; if (!fn.name) { - Object.defineProperty(fn, "name", {value: action}); + Object.defineProperty(fn, 'name', { value: action }); } const actionAlias = translations ? translations.actionAliasFor(action) : action; if (!actions[actionAlias]) { diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index 573bad4a3..5d09f9e04 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -1950,7 +1950,7 @@ async function proceedSee(assertType, text, context, strict = false) { const selected = await forEachAsync(res, async el => this.browser.getElementText(getElementId(el))); if (strict) { - if (Array.isArray(selected)) { + if (Array.isArray(selected) && selected.length !== 0) { return selected.map(elText => equals(description)[assertType](text, elText)); } return equals(description)[assertType](text, selected); diff --git a/lib/parser.js b/lib/parser.js index 7583eb050..99eaa4460 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -87,7 +87,7 @@ function getParams(fn) { }); return params; } catch (err) { - console.log('Error in ' + newFn.toString()); + console.log(`Error in ${newFn.toString()}`); console.error(err); } } diff --git a/lib/utils.js b/lib/utils.js index 1f02abd7c..9b6b5c28e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -40,7 +40,7 @@ const isGenerator = module.exports.isGenerator = function (fn) { }; const isFunction = module.exports.isFunction = function (fn) { - return typeof fn === 'function' + return typeof fn === 'function'; }; const isAsyncFunction = module.exports.isAsyncFunction = function (fn) { diff --git a/test/helper/WebDriver_test.js b/test/helper/WebDriver_test.js index ea8ba3000..b8e25f872 100644 --- a/test/helper/WebDriver_test.js +++ b/test/helper/WebDriver_test.js @@ -198,6 +198,13 @@ describe('WebDriver', function () { // e.should.be.instanceOf(AssertionFailedError); // e.inspect().should.include("expected element h1 'Welcome to test app' to equal 'Welcome to test app!'"); })); + + it('should check text is not equal to empty string of element text', () => wd.amOnPage('https://codecept.discourse.group/') + .then(() => wd.seeTextEquals('This is not empty', '[id="site-logo"]')) + .catch((e) => { + e.should.be.instanceOf(Error); + e.message.should.be.equal('expected element [id="site-logo"] "This is not empty" to equal ""'); + })); }); describe('#waitForFunction', () => {